Documentation  |   Table of Contents   |  < Previous   |  Next >   |  Index

C    1.0 Float Manager

Palm OS® Programmer's API Reference

Palm OS® 68K SDK

     

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 ^TOP^

FplAdd Function ^TOP^

Purpose

Add two floating-point numbers (returns a + b).

Prototype

FloatType FplAdd (
   FloatType a,
   FloatType b
)

Parameters

a, b
The floating-point numbers.

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 ^TOP^

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

s
Pointer to the ASCII string.

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 ^TOP^

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 ^TOP^

Purpose

Divide two floating-point numbers (result = dividend/divisor).

Prototype

FloatType FplDiv (
   FloatType dividend,
   FloatType divisor
)

Parameters

dividend
Floating-point dividend.
divisor
Floating-point divisor.

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 ^TOP^

Purpose

Convert a floating-point number to a long integer.

Prototype

Long FplFloatToLong (
   FloatType f
)

Parameters

f
Floating-point number to be converted.

Returns

Returns the long integer.

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 ^TOP^

Purpose

Convert a floating-point number to an unsigned long integer.

Prototype

ULong FplFloatToULong (
   FloatType f
)

Parameters

f
Floating-point number to be converted.

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 ^TOP^

Purpose

Release all memory allocated by the floating-point initialization.

Prototype

void FplFree()

Parameters

None.

Returns

Returns nothing.

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

FplInit()

FplFToA Function ^TOP^

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

a
Floating-point number.
s
Pointer to buffer to contain the ASCII string.

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 ^TOP^

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

None.

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

FplFree()

FplLongToFloat Function ^TOP^

Purpose

Convert a long integer to a floating-point number.

Prototype

FloatType FplLongToFloat (
   Long x
)

Parameters

x
A long integer.

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 ^TOP^

Purpose

Multiply two floating-point numbers.

Prototype

FloatType FplMul (
   FloatType a,
   FloatType b
) 

Parameters

a, b
The floating-point numbers.

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 ^TOP^

Purpose

Subtract two floating-point numbers (returns a - b).

Prototype

FloatType FplSub (
   FloatType a,
   FloatType b
)

Parameters

a, b
The floating-point numbers.

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).