EXPONENT()

EXPONENT()

Evaluate the exponent of a floating point number

Syntax

      EXPONENT( <nFloatingPointNumber> ) --> nExponent

Arguments

<nFloatingPointNumber> Designate any Harbour number.

Returns

EXPONENT() returns the exponent of the <nFloatingPointNumber> number in base 2.

Description

This function supplements MANTISSA() to return the exponent of the <nFloatingPointNumber> number.

Values > 1 or values < -1 return a positive number 0 to 1023.

Values < 1 or values > -1 return a negative number -1 to -1023.

The EXPONENT( 0 ), return 0.

The following calculation reproduces the original value:

2ˆEXPONENT(<nFloatingPointNumber>) * MANTISSA(<nFloatingPointNumber>) = <nFloatingPointNumber>

TODO: add documentation

Compliance

EXPONENT() is compatible with CT3’s EXPONENT()

Platforms

All

Files

Source is exponent.c, library is libct.

Seealso

MANTISSA()

Harbour Math Functions

Abs

ACos

ASin

ATan

ATn2

Cos

CosH

DToR

Exp

Exponent 

Fact

Floor

GetPrec

hb_mathErBlock
hb_mathErMode
hb_mathGetErrMode
hb_mathGetHandler
hb_mathGetLastError
hb_mathIsMathErr
hb_mathResetError
hb_mathSetErrMode
hb_mathSetHandler

Infinity
Int
Log

Log10
Max

Mantissa
Min
Mod

Pi
Round

RToD

SetPrec

Sign

Sin

SinH
Sqrt

Tan

TanH

CT_MANTISSA

 MANTISSA()
 Determines the mantissa of a floating point number (base2)
------------------------------------------------------------------------------
 Syntax

     MANTISSA(<nFloatingPointNumber>) --> nMantissa

 Arguments

     <nFloatingPointNumber>  Designates any decimal number.

 Returns

     MANTISSA() returns the mantissa of the <nFloatingPointNumber> number.

 Description

     This function supplements EXPONENT() to return the mantissa of the
     <nFloatingPointNumber> number.

 Notes

     .  The mantissa value can be 0 or in the range of 1 to 2.

     .  The following calculation reproduces the original value:

       MANTISSA(<nFloatingPointNumber>)* 2^EXPONENT(<FloatingPointNumber =
        <nFloatingPointNumber>)

 Example

     Display the mantissa for the following values:

     ? MANTISSA(0)            // Result:  0.00
     ? MANTISSA(100)          // Result:  1.56
     ? MANTISSA(INFINITY)     // Result:  2.00
     ? MANTISSA(0.01)         // Result:  1.28
     ? MANTISSA(-100)         // Result: -1.56
     ? MANTISSA(-0.01)        // Result: -1.28
     ? MANTISSA(-1.01)        // Result: -1.01
     ? MANTISSA(-2.01)        // Result: -1.01

See Also: EXPONENT()

 

Tools – Numbers/Bit Manipulation

Introduction
BITTOC()     Converts position-dependent bits into characters
CELSIUS()    Converts a Fahrenheit temperature value into Celsius
CLEARBIT()   Clears one or more bits within a number to zero
CTOBIT()     Converts a character string into a bit pattern
CTOF()       Converts a special 8-byte string into a floating point number
CTON()       Converts a numeric string into a different base
EXPONENT()   Determines the exponent of a floating point number (base 2)
FAHRENHEIT() Converts a temperature value from Celsius into Fahrenheit
FTOC()       Converts a floating point number into a special 8-byte string
INFINITY()   Creates the largest number possible (21023)
INTNEG()     Converts an unsigned integer into a signed integer
INTPOS()     Converts a signed integer into an unsigned integer
ISBIT()      Tests the bits in a number
LTON()       Converts a logical value into a numeric value
MANTISSA()   Determines the mantissa of a floating point number (base2)
NTOC()       Converts numbers in a digit string into a different number base
NUMAND()     Performs a 16-bit "AND" of a list of numbers
NUMCOUNT()   Uses the internal CA-Clipper Tools counter
NUMHIGH()    Returns the higher value byte in a 16-bit number
NUMLOW()     Returns the lower value byte in a 16-bit number
NUMMIRR()    Mirrors 8-bit or 16-bit values
NUMNOT()     Performs a 16-bit "NOT" of a number
NUMOR()      Performs a 16-bit "OR" of a list of numbers
NUMROL()     Performs a 16-bit left rotation of a number
NUMXOR()     Performs a 16-bit "XOR" of two numbers
RAND()       Generates random numbers
RANDOM()     Generates random numbers
SETBIT()     Sets one or more bits in a number