VxWorks Reference Manual : Libraries
mathALib - C interface library to high-level math functions
acos( ) - compute an arc cosine (ANSI)
asin( ) - compute an arc sine (ANSI)
atan( ) - compute an arc tangent (ANSI)
atan2( ) - compute the arc tangent of y/x (ANSI)
cbrt( ) - compute a cube root
ceil( ) - compute the smallest integer greater than or equal to a specified value (ANSI)
cos( ) - compute a cosine (ANSI)
cosh( ) - compute a hyperbolic cosine (ANSI)
exp( ) - compute an exponential value (ANSI)
fabs( ) - compute an absolute value (ANSI)
floor( ) - compute the largest integer less than or equal to a specified value (ANSI)
fmod( ) - compute the remainder of x/y (ANSI)
infinity( ) - return a very large double
irint( ) - convert a double-precision value to an integer
iround( ) - round a number to the nearest integer
log( ) - compute a natural logarithm (ANSI)
log10( ) - compute a base-10 logarithm (ANSI)
log2( ) - compute a base-2 logarithm
pow( ) - compute the value of a number raised to a specified power (ANSI)
round( ) - round a number to the nearest integer
sin( ) - compute a sine (ANSI)
sincos( ) - compute both a sine and cosine
sinh( ) - compute a hyperbolic sine (ANSI)
sqrt( ) - compute a non-negative square root (ANSI)
tan( ) - compute a tangent (ANSI)
tanh( ) - compute a hyperbolic tangent (ANSI)
trunc( ) - truncate to integer
acosf( ) - compute an arc cosine (ANSI)
asinf( ) - compute an arc sine (ANSI)
atanf( ) - compute an arc tangent (ANSI)
atan2f( ) - compute the arc tangent of y/x (ANSI)
cbrtf( ) - compute a cube root
ceilf( ) - compute the smallest integer greater than or equal to a specified value (ANSI)
cosf( ) - compute a cosine (ANSI)
coshf( ) - compute a hyperbolic cosine (ANSI)
expf( ) - compute an exponential value (ANSI)
fabsf( ) - compute an absolute value (ANSI)
floorf( ) - compute the largest integer less than or equal to a specified value (ANSI)
fmodf( ) - compute the remainder of x/y (ANSI)
infinityf( ) - return a very large float
irintf( ) - convert a single-precision value to an integer
iroundf( ) - round a number to the nearest integer
logf( ) - compute a natural logarithm (ANSI)
log10f( ) - compute a base-10 logarithm (ANSI)
log2f( ) - compute a base-2 logarithm
powf( ) - compute the value of a number raised to a specified power (ANSI)
roundf( ) - round a number to the nearest integer
sinf( ) - compute a sine (ANSI)
sincosf( ) - compute both a sine and cosine
sinhf( ) - compute a hyperbolic sine (ANSI)
sqrtf( ) - compute a non-negative square root (ANSI)
tanf( ) - compute a tangent (ANSI)
tanhf( ) - compute a hyperbolic tangent (ANSI)
truncf( ) - truncate to integer
This library provides a C interface to high-level floating-point math functions, which can use either a hardware floating-point unit or a software floating-point emulation library. The appropriate routine is called based on whether mathHardInit( ) or mathSoftInit( ) or both have been called to initialize the interface.
All angle-related parameters are expressed in radians. All functions in this library with names corresponding to ANSI C specifications are ANSI compatible.
Not all functions in this library are available on all architectures. The architecture-specific appendices of the VxWorks Programmer's Guide list any math functions that are not available.
math.h
mathALib, ansiMath, fppLib, floatLib, mathHardLib, mathSoftLib, .br Kernighan & Ritchie: The C Programming Language, 2ndEdition, .pG Architecture-specific Appendices
acos( ) - compute an arc cosine (ANSI)
double acos ( double x /* angle in radians */ )
math.h
The double-precision arc cosine of x in the range 0.0 to pi radians.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
asin( ) - compute an arc sine (ANSI)
double asin ( double x /* angle in radians */ )
math.h
The double-precision arc sine of x in the range -pi/2 to pi/2 radians.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
atan( ) - compute an arc tangent (ANSI)
double atan ( double x /* angle in radians */ )
math.h
The double-precision arc tangent of x in the range -pi/2 to pi/2.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
atan2( ) - compute the arc tangent of y/x (ANSI)
double atan2 ( double y, /* numerator */ double x /* denominator */ )
math.h
The double-precision arc tangent of y/x in the range -pi to pi.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
cbrt( ) - compute a cube root
double cbrt ( double x /* value to compute the cube root of */ )
This routine returns the cube root of x in double precision.
math.h
The double-precision cube root of x.
ceil( ) - compute the smallest integer greater than or equal to a specified value (ANSI)
double ceil ( double v /* value to return the ceiling of */ )
Performs a round-to-positive-infinity.
math.h
The smallest integral value greater than or equal to v, represented in double precision.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
cos( ) - compute a cosine (ANSI)
double cos ( double x /* angle in radians */ )
math.h
The double-precision cosine of x.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
cosh( ) - compute a hyperbolic cosine (ANSI)
double cosh ( double x /* angle in radians */ )
math.h
The double-precision hyperbolic cosine of x if the parameter is greater than 1.0, or NaN if the parameter is less than 1.0.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
exp( ) - compute an exponential value (ANSI)
double exp ( double x /* exponent */ )
This routine returns the exponential value of x -- the inverse natural logarithm (e ** x) -- in double precision.
math.h
The double-precision exponential value of x.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
fabs( ) - compute an absolute value (ANSI)
double fabs ( double v /* number to return the absolute value of */ )
math.h
The double-precision absolute value of v.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
floor( ) - compute the largest integer less than or equal to a specified value (ANSI)
double floor ( double v /* value to return the floor of */ )
Performs a round-to-negative-infinity.
math.h
The largest integral value less than or equal to v, in double precision.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
fmod( ) - compute the remainder of x/y (ANSI)
double fmod ( double x, /* numerator */ double y /* denominator */ )
math.h
The double-precision modulus of x/y with the sign of x.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
infinity( ) - return a very large double
double infinity (void)
This routine returns a very large double.
math.h
The double-precision representation of positive infinity.
irint( ) - convert a double-precision value to an integer
int irint ( double x /* argument */ )
This routine converts a double-precision value x to an integer using the selected IEEE rounding direction.
The rounding direction is not pre-selectable and is fixed for round-to-the-nearest.
math.h
The integer representation of x.
iround( ) - round a number to the nearest integer
int iround ( double x /* argument */ )
This routine rounds a double-precision value x to the nearest integer value.
If x is spaced evenly between two integers, it returns the even integer.
math.h
The integer nearest to x.
log( ) - compute a natural logarithm (ANSI)
double log ( double x /* value to compute the natural logarithm of */ )
math.h
The double-precision natural logarithm of x.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
log10( ) - compute a base-10 logarithm (ANSI)
double log10 ( double x /* value to compute the base-10 logarithm of */ )
math.h
The double-precision base-10 logarithm of x.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
log2( ) - compute a base-2 logarithm
double log2 ( double x /* value to compute the base-two logarithm of */ )
This routine returns the base-2 logarithm of x in double precision.
math.h
The double-precision base-2 logarithm of x.
pow( ) - compute the value of a number raised to a specified power (ANSI)
double pow ( double x, /* operand */ double y /* exponent */ )
math.h
The double-precision value of x to the power of y.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
round( ) - round a number to the nearest integer
double round ( double x /* value to round */ )
This routine rounds a double-precision value x to the nearest integral value.
math.h
The double-precision representation of x rounded to the nearest integral value.
sin( ) - compute a sine (ANSI)
double sin ( double x /* angle in radians */ )
math.h
The double-precision floating-point sine of x.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
sincos( ) - compute both a sine and cosine
void sincos ( double x, /* angle in radians */ double * sinResult, /* sine result buffer */ double * cosResult /* cosine result buffer */ )
This routine computes both the sine and cosine of x in double precision. The sine is copied to sinResult and the cosine is copied to cosResult.
math.h
N/A
sinh( ) - compute a hyperbolic sine (ANSI)
double sinh ( double x /* angle in radians */ )
math.h
The double-precision hyperbolic sine of x.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
sqrt( ) - compute a non-negative square root (ANSI)
double sqrt ( double x /* value to compute the square root of */ )
math.h
The double-precision square root of x.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
tan( ) - compute a tangent (ANSI)
double tan ( double x /* angle in radians */ )
math.h
The double-precision tangent of x.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
tanh( ) - compute a hyperbolic tangent (ANSI)
double tanh ( double x /* angle in radians */ )
math.h
The double-precision hyperbolic tangent of x.
mathALib, Kernighan & Ritchie: The C Programming Language, 2nd Edition
trunc( ) - truncate to integer
double trunc ( double x /* value to truncate */ )
This routine discards the fractional part of a double-precision value x.
math.h
The integer portion of x, represented in double-precision.
acosf( ) - compute an arc cosine (ANSI)
float acosf ( float x /* number between -1 and 1 */ )
This routine computes the arc cosine of x in single precision. If x is the cosine of an angle T, this function returns T.
math.h
The single-precision arc cosine of x in the range 0 to pi radians.
asinf( ) - compute an arc sine (ANSI)
float asinf ( float x /* number between -1 and 1 */ )
This routine computes the arc sine of x in single precision. If x is the sine of an angle T, this function returns T.
math.h
The single-precision arc sine of x in the range -pi/2 to pi/2 radians.
atanf( ) - compute an arc tangent (ANSI)
float atanf ( float x /* tangent of an angle */ )
This routine computes the arc tangent of x in single precision. If x is the tangent of an angle T, this function returns T (in radians).
math.h
The single-precision arc tangent of x in the range -pi/2 to pi/2.
atan2f( ) - compute the arc tangent of y/x (ANSI)
float atan2f ( float y, /* numerator */ float x /* denominator */ )
This routine returns the principal value of the arc tangent of y/x in single precision.
math.h
The single-precision arc tangent of y/x in the range -pi to pi.
cbrtf( ) - compute a cube root
float cbrtf ( float x /* argument */ )
This routine returns the cube root of x in single precision.
math.h
The single-precision cube root of x.
ceilf( ) - compute the smallest integer greater than or equal to a specified value (ANSI)
float ceilf ( float v /* value to find the ceiling of */ )
This routine returns the smallest integer greater than or equal to v, in single precision.
math.h
The smallest integral value greater than or equal to v, in single precision.
cosf( ) - compute a cosine (ANSI)
float cosf ( float x /* angle in radians */ )
This routine returns the cosine of x in single precision. The angle x is expressed in radians.
math.h
The single-precision cosine of x.
coshf( ) - compute a hyperbolic cosine (ANSI)
float coshf ( float x /* value to compute the hyperbolic cosine of */ )
This routine returns the hyperbolic cosine of x in single precision.
math.h
The single-precision hyperbolic cosine of x if the parameter is greater than 1.0, or NaN if the parameter is less than 1.0.
Special cases:
If x is +INF, -INF, or NaN, coshf( ) returns x.
expf( ) - compute an exponential value (ANSI)
float expf ( float x /* exponent */ )
This routine returns the exponential of x in single precision.
math.h
The single-precision exponential value of x.
fabsf( ) - compute an absolute value (ANSI)
float fabsf ( float v /* number to return the absolute value of */ )
This routine returns the absolute value of v in single precision.
math.h
The single-precision absolute value of v.
floorf( ) - compute the largest integer less than or equal to a specified value (ANSI)
float floorf ( float v /* value to find the floor of */ )
This routine returns the largest integer less than or equal to v, in single precision.
math.h
The largest integral value less than or equal to v, in single precision.
fmodf( ) - compute the remainder of x/y (ANSI)
float fmodf ( float x, /* numerator */ float y /* denominator */ )
This routine returns the remainder of x/y with the sign of x, in single precision.
math.h
The single-precision modulus of x/y.
infinityf( ) - return a very large float
float infinityf (void)
This routine returns a very large float.
math.h
The single-precision representation of positive infinity.
irintf( ) - convert a single-precision value to an integer
int irintf ( float x /* argument */ )
This routine converts a single-precision value x to an integer using the selected IEEE rounding direction.
The rounding direction is not pre-selectable and is fixed as round-to-the-nearest.
math.h
The integer representation of x.
iroundf( ) - round a number to the nearest integer
int iroundf ( float x /* argument */ )
This routine rounds a single-precision value x to the nearest integer value.
If x is spaced evenly between two integers, the even integer is returned.
math.h
The integer nearest to x.
logf( ) - compute a natural logarithm (ANSI)
float logf ( float x /* value to compute the natural logarithm of */ )
This routine returns the logarithm of x in single precision.
math.h
The single-precision natural logarithm of x.
log10f( ) - compute a base-10 logarithm (ANSI)
float log10f ( float x /* value to compute the base-10 logarithm of */ )
This routine returns the base-10 logarithm of x in single precision.
math.h
The single-precision base-10 logarithm of x.
log2f( ) - compute a base-2 logarithm
float log2f ( float x /* value to compute the base-2 logarithm of */ )
This routine returns the base-2 logarithm of x in single precision.
math.h
The single-precision base-2 logarithm of x.
powf( ) - compute the value of a number raised to a specified power (ANSI)
float powf ( float x, /* operand */ float y /* exponent */ )
This routine returns the value of x to the power of y in single precision.
math.h
The single-precision value of x to the power of y.
roundf( ) - round a number to the nearest integer
float roundf ( float x /* argument */ )
This routine rounds a single-precision value x to the nearest integral value.
math.h
The single-precision representation of x rounded to the nearest integral value.
sinf( ) - compute a sine (ANSI)
float sinf ( float x /* angle in radians */ )
This routine returns the sine of x in single precision. The angle x is expressed in radians.
math.h
The single-precision sine of x.
sincosf( ) - compute both a sine and cosine
void sincosf ( float x, /* angle in radians */ float * sinResult, /* sine result buffer */ float * cosResult /* cosine result buffer */ )
This routine computes both the sine and cosine of x in single precision. The sine is copied to sinResult and the cosine is copied to cosResult. The angle x is expressed in radians.
math.h
N/A
sinhf( ) - compute a hyperbolic sine (ANSI)
float sinhf ( float x /* number whose hyperbolic sine is required */ )
This routine returns the hyperbolic sine of x in single precision.
math.h
The single-precision hyperbolic sine of x.
sqrtf( ) - compute a non-negative square root (ANSI)
float sqrtf ( float x /* value to compute the square root of */ )
This routine returns the non-negative square root of x in single precision.
math.h
The single-precision square root of x.
tanf( ) - compute a tangent (ANSI)
float tanf ( float x /* angle in radians */ )
This routine returns the tangent of x in single precision. The angle x is expressed in radians.
math.h
The single-precision tangent of x.
tanhf( ) - compute a hyperbolic tangent (ANSI)
float tanhf ( float x /* number whose hyperbolic tangent is required */ )
This routine returns the hyperbolic tangent of x in single precision.
math.h
The single-precision hyperbolic tangent of x.
truncf( ) - truncate to integer
float truncf ( float x /* value to truncate */ )
This routine discards the fractional part of a single-precision value x.
math.h
The integer portion of x, represented in single precision.