Overview:
- Given a floating point number, the function frexp() returns the mantissa and the exponent whose base is 2.
- Multiplying the mantissa with two raised to the power of exponent gives back the original number passed as the argument (num = m*2^e).
Example:
# Example Python program that gets the mantisa and exponent # Get the tuple of mantissa and exponent # Using the mantissa, exponent and the base of 2 |
Output:
Mantissa:0.833375 Exponent:3 Input number: 6.667 |