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

13    PalmMath.h

Palm OS® Protein C/C++ Compiler Language & Library Reference

Palm OS® Developer Suite

The <PalmMath.h> header defines Palm OS specific mathematical functions not specified in the ANSI/ISO standard.

Constants ^TOP^

Math Constants ^TOP^

Purpose

These constants are intended to be used as 32-bit floats. These constants should not be used as double precision arguments. However, a new double precision version of each of these may be created by removing the "f" suffix from the end of each decimal string.

Declared In

posix/sys/palmmath.h

Constants

#define M_E 2.7182818284590452354f
Approximates the mathematical constant e.
#define M_LOG2E 1.4426950408889634074f
Approximates the mathematical constant log2(e).
#define M_LOG10E 0.43429448190325182765f
Approximates the mathematical constant log10(e).
#define M_LN2 0.69314718055994530942f
Approximates the mathematical constant loge(2).
#define M_LN10 2.30258509299404568402f
Approximates the mathematical constant loge(10).
#define M_PI 3.14159265358979323846f
Single precision approximation to p.
#define M_PI_2 1.57079632679489661923f
Single precision approximation to p/2.
#define M_1_PI 0.31830988618379067154f
Single precision approximation to 1/p.
#define M_PI_4 0.78539816339744830962f
Single precision approximation to p/4.
#define M_2_PI 0.63661977236758134308f
Single precision approximation to 2/p.
#define M_2_SQRTPI 1.12837916709551257390f
Single precision approximation to 2/Ðp.
#define M_SQRT2 1.41421356237309504880f
Approximates the mathematical constant Ð2.
#define M_SQRT1_2 0.70710678118654752440f
Approximates the mathematical constant 1/Ð2.
#define PI M_PI
Single precision approximation to p.
#define PI2 M_PI_2
Single precision approximation to p/2.
#define M_PI_3 1.047197551196597746154f
Single precision approximation to p/3.
#define M_3_PI_4 2.356194490192344928846f
Single precision approximation to 3*p/4.
#define M_5_PI_4 3.926990816987241548076f
Single precision approximation to 5*p/4.
#define M_3_PI_2 4.71238898038468985769f
Single precision approximation to 3*p/2.
#define M_7_PI_4 5.497787143782138167306f
Single precision approximation to 7*p/4.

Functions and Macros ^TOP^

lceilf Function ^TOP^

Purpose

Computes the nearest 32-bit signed integer not less than x.

Declared In

posix/sys/palmmath.h

Prototype

int32_t lceilf (
   float x
)

Parameters

x
Value of type float to be evaluated.

Returns

Returns the nearest 32-bit signed integer not less than x. In cases where x is out of the range of representable integers, +/-INT_MAX is returned.

Comments

Exceptions are never raised.

Compatibility

This function is not in the C99 specification.

This function is a Palm OS extension (not present in C99 or Unix).

See Also

lfloorf()

lfloorf Function ^TOP^

Purpose

Computes the nearest 32-bit signed integer not greater than x.

Declared In

posix/sys/palmmath.h

Prototype

int32_t lfloorf (
   float x
)

Parameters

x
Value of type float to be evaluated.

Returns

Returns the nearest 32-bit signed integer not greater than x. In cases where x is out of the range of representable integers, +/-INT_MAX is returned.

Comments

Exceptions are never raised.

Compatibility

This function is not in the C99 specification.

This function is a Palm OS extension (not present in C99 or Unix).

See Also

lceilf()

max_c Macro ^TOP^

Purpose

Returns the larger of two values.

Declared In

posix/sys/PalmMath.h

Prototype

#define max_c(
   real floating a,
   real floating b
)

Parameters

a
The first value to compare.
b
The second value to compare.

Returns

Returns the greater of the two input values.

Compatibility

This macro can be used in C code, unlike the standard max() macro, which uses C++ templates.

See Also

min_c()

min_c Macro ^TOP^

Purpose

Returns the lesser of two values.

Declared In

posix/sys/PalmMath.h

Prototype

#define min_c(
   real floating a,
   real floating b
)

Parameters

a
The first value to compare.
b
The second value to compare.

Returns

Returns the lesser of the two input values.

Compatibility

This macro can be used in C code, unlike the standard min() macro, which uses C++ templates.

See Also

max_c()

sincosf Function ^TOP^

Purpose

Computes an approximation to the sine (sin_val) and cosine (cos_val) of any angle in a single call.

Declared In

posix/sys/palmmath.h

Prototype

void sincosf (
   float angle,
   float *cos_val,
   float *sin_val
) 

Parameters

angle
Must be specified in radians.
cos_val
Cosine value.
sin_val
Sine value.

Returns

Returns the approximation to the sine (sin_val) and cosine (cos_val) of the specified angle.

Compatibility

This function is not in the C99 specification.

This function is a Palm OS extension (not present in C99 or Unix).