This section provides reference material for the Palm OS 1.0 float manager. In Palm OS 1.0, the float manager API is declared in the header file FloatMgr.h
. In Palm OS 2.0, this file was renamed to FloatMgrOld.h
. In Palm OS 3.5, this file was made private.
NOTE: New applications should no longer use the 1.0 Float Manager. See Chapter 36, "Float Manager," for the functions now provided by the Float Manager.
Float Manager Functions
FplAdd Function
Purpose
Add two floating-point numbers (returns a + b).
Prototype
FloatType FplAdd ( FloatType a, FloatType b )
Parameters
Returns
Returns the normalized floating-point result of the addition.
Comments
Under Palm OS® 2.0 and later, most applications will want to use the arithmetic symbols instead. See the "Floating-Point" section in the Palm OS Programmer's Companion, vol. I.
Compatibility
This function is not supported by PACE (5.0 New Feature Set or Palm OS Cobalt Feature Set).
FplAToF Function
Purpose
Convert a zero-terminated ASCII string to a floating-point number. The string must be in the format: [-]x[.]yyyyyyyy[e[-]zz]
Prototype
FloatType FplAToF ( char *s )
Parameters
Returns
Returns the floating-point number.
Comments
The mantissa of the number is limited to 32 bits.
Compatibility
This function is not supported by PACE (5.0 New Feature Set or Palm OS Cobalt Feature Set).
See Also
FplFToA()
, FplFree()
, FplInit()
FplBase10Info Function
Purpose
Extract detailed information on the base 10 form of a floating-point number: the base 10 mantissa, exponent, and sign.
Prototype
Err FplBase10Info ( FloatType a, ULong *mantissaP, Int *exponentP, Int *signP )
Parameters
-
a
- The floating-point number.
-
mantissaP
- The base 10 mantissa (return value).
-
exponentP
- The base 10 exponent (return value).
-
signP
- The sign, 1 or -1 (return value).
Returns
Returns an error code, or 0 if no error.
Comments
The mantissa is normalized so it contains at least kMaxSignificantDigits
significant digits when printed as an integer value.
FlpBase10Info
reports that zero is "negative"; that is, it returns a one for xSign. If this is a problem, a simple workaround is:
if (xMantissa == 0) xSign = 0;
Compatibility
This function is not supported by PACE (5.0 New Feature Set or Palm OS Cobalt Feature Set).
FplDiv Function
Purpose
Divide two floating-point numbers (result = dividend/divisor).
Prototype
FloatType FplDiv ( FloatType dividend, FloatType divisor )
Parameters
Returns
Returns the normalized floating-point result of the division.
Under Palm OS 2.0 and later, most applications will want to use the arithmetic symbols instead. See the "Floating-Point" section in the Palm OS Programmer's Companion, vol. I.
Compatibility
This function is not supported by PACE (5.0 New Feature Set or Palm OS Cobalt Feature Set).
FplFloatToLong Function
Purpose
Convert a floating-point number to a long integer.
Prototype
Long FplFloatToLong ( FloatType f )
Parameters
Returns
Compatibility
This function is not supported by PACE (5.0 New Feature Set or Palm OS Cobalt Feature Set).
See Also
FplLongToFloat()
, FplFloatToULong()
FplFloatToULong Function
Purpose
Convert a floating-point number to an unsigned long integer.
Prototype
ULong FplFloatToULong ( FloatType f )
Parameters
Returns
Returns an unsigned long integer.
Compatibility
This function is not supported by PACE (5.0 New Feature Set or Palm OS Cobalt Feature Set).
See Also
FplLongToFloat()
, FplFloatToLong()
FplFree Function
Purpose
Release all memory allocated by the floating-point initialization.
Prototype
void FplFree()
Parameters
Returns
Comments
Applications must call this routine after they've called other functions that are part of the float manager.
Compatibility
If either 5.0 New Feature Set or Palm OS Cobalt Feature Set is present, this function does nothing.
See Also
FplFToA Function
Purpose
Convert a floating-point number to a zero-terminated ASCII string in exponential format: [-]x.yyyyyyye[-]zz
Prototype
Err FplFToA ( FloatType a, char *s )
Parameters
Returns
Returns an error code, or 0 if no error.
Compatibility
This function is not supported by PACE (5.0 New Feature Set or Palm OS Cobalt Feature Set).
See Also
FplAToF()
, FplFree()
, FplInit()
FplInit Function
Purpose
Initialize the floating-point conversion routines.
Allocate space in the system heap for floating-point globals.
Initialize the tenPowers
array in the globals area to the powers of 10 from -99 to +99 in floating-point format.
Prototype
Err FplInit()
Parameters
Returns
Returns an error code, or 0 if no error.
Comments
Applications must call this routine before calling any other Fpl
function.
Compatibility
If either 5.0 New Feature Set or Palm OS Cobalt Feature Set is present, this function does nothing.
See Also
FplLongToFloat Function
Purpose
Convert a long integer to a floating-point number.
Prototype
FloatType FplLongToFloat ( Long x )
Parameters
Returns
Returns the floating-point number.
Compatibility
This function is not supported by PACE (5.0 New Feature Set or Palm OS Cobalt Feature Set).
FplMul Function
Purpose
Multiply two floating-point numbers.
Prototype
FloatType FplMul ( FloatType a, FloatType b )
Parameters
Returns
Returns the normalized floating-point result of the multiplication.
Comments
Under Palm OS 2.0 and later, most applications will want to use the arithmetic symbols instead. See the "Floating-Point" section in the Palm OS Programmer's Companion, vol. I.
Compatibility
This function is not supported by PACE (5.0 New Feature Set or Palm OS Cobalt Feature Set).
FplSub Function
Purpose
Subtract two floating-point numbers (returns a - b).
Prototype
FloatType FplSub ( FloatType a, FloatType b )
Parameters
Returns
Returns the normalized floating-point result of the subtraction.
Comments
Under Palm OS 2.0 and later, most applications will want to use the arithmetic symbols instead. See the "Floating-Point" section in the Palm OS Programmer's Companion, vol. I.
Compatibility
This function is not supported by PACE (5.0 New Feature Set or Palm OS Cobalt Feature Set).