Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python math.modf() function is used to return the fractional and integral parts of a given number. Both parts carry the sign as x and are floats.

Syntax

math.modf(x)

Parameters

x Required. Specify the number.

Return Value

Returns the fractional and integral parts of x.

Example:

The below example shows the usage of modf() function.

import math

print(math.modf(10.55))
print(math.modf(-10.55))

The output of the above code will be:

(0.5500000000000007, 10.0)
(-0.5500000000000007, -10.0)

❮ Python Math Module