Python modf function

modf() function calculates the fractional and integer parts of x. It's a method of math module.

>>> import math
>>> math.modf(2.1)
(0.10000000000009, 2.0)
>>> math.modf(-2.1)
(-0.10000000000009, -2.0)
>>> math.modf(0.1)
(0.1,0.0)
















endmemo.com © 2024  | Terms of Use | Privacy | Home