Math Functions

math.modf()

Split a real value into fractional and whole parts, both floats with the original sign.

Formal Syntax & Structure

python syntaxpython
math.modf(x, /)

Parameters & Attributes

NameTypeDescription
xreal numberInput real value.

Return Value

tuple[float, float]

Pair (fractional part, whole part).

Working Example

Example Snippetpython
import mathprint(math.modf(-3.75))
Python Reference