Type Function Library math.* Return value Number Revision Release 2022.3683 Keywords frexp, normalized fraction See also math.ldexp()
Splits x
into a normalized fraction and an exponent.
Returns two numbers:
m
— a number that contains the significant (binary) digits and whose absolute value is in the range [0.5, 1.0]
(or 0
when x
is 0
)e
— an integral exponent of 2
Such that:
x = m * 2^e^
print(math.frexp(2)) ---> 0.5 2 print(math.frexp(3)) ---> 0.75 2 print(math.frexp(128)) ---> 0.5 8