| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Calculates the mantissa of a floating point number.
Mantissa( <nFloat> ) --> nMantissa
The function returns the mantissa base 2 of a floating point number. It is used together with the Exponent() for the binary representation of floating point numbers.
| See also: | Exponent() |
| Category: | CT:NumBits , Numbers and Bits |
| Source: | ct\exponent.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example displays results of Mantissa() and shows
// how a number is calculated from its mantissa and exponent.
PROCEDURE Main
LOCAL nE, nM
? Mantissa( -10 ) // result: -1.25
? Mantissa( -1 ) // result: -1.00
? Mantissa(-0.1 ) // result: -1.60
? Mantissa( 0 ) // result: 0.00
? Mantissa( 0.1 ) // result: 1.60
? Mantissa( 1 ) // result: 1.00
? Mantissa( 10 ) // result: 1.25
nE := Exponent( 10 )
nM := Mantissa( 10 )
? nM * 2ˆnE // result: 10.0000
RETURN
http://www.xHarbour.com