Skip to main content

modf

Function modf 

Source
pub fn modf(x: number) -> (number, number)
Expand description

Splits a number into its integral and fractional parts.

§Parameters

  • x: a number.

§Return value

Two values: the integral part of x and the fractional part of x. Its second result is always a float.

§Examples

print(math.modf(3.7))     --> 3.0   0.7000000000000002
print(math.modf(-3.7))    --> -3.0  -0.7000000000000002

§See also

floor, ceil, fmod