xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

Mantissa()

Calculates the mantissa of a floating point number.

Syntax

Mantissa( <nFloat> ) --> nMantissa

Arguments

<nFloatNumber>
Any numeric value can be passed.

Return

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.

Info

See also:Exponent()
Category: CT:NumBits , Numbers and Bits
Source:ct\exponent.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe