[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4 Files Reference

math.h File


Defines math subroutines and constants.


The /usr/include/math.h header file contains declarations of all the subroutines in the Math library (libm.a) and of various subroutines in the Standard C Library (libc.a) that return floating-point values.

Among other things, the math.h file defines the following macro, which is used as an error-return value:

HUGE_VAL Specifies the maximum value of a double-precision floating-point number: +infinity on machines that support IEEE-754 and DBL_MAX otherwise.

If you define the __MATH__ preprocessor variable before including the math.h file, the math.h file defines macros that make the names of certain math subroutines appear to the compiler as __xxxx. The following names are redefined to have the __ (double underscore) prefix:

exp sin
asin log
cos acos
log10 tan
atan sqrt
fabs atan2

These special names instruct the C compiler to generate code that avoids the overhead of the Math library subroutines and issues compatible-mode floating-point subroutines directly. The __MATH__ variable is defined by default.

If _XOPEN_SOURCE variable is defined, the following mathematical constants are defined for your convenience. The values are of type double and are accurate to the precision of this type. That is, the machine value is the mathematical value rounded to double precision.

M_E Base of natural logarithms (e)
M_LOG2E Base-2 logarithm of e
M_LOG10E Base-10 logarithm of e
M_LN2 Natural logarithm of 2
M_LN10 Natural logarithm of 10
M_PI Pi, the ratio of the circumference of a circle to its diameter
M_PI_2 Value of pi divided by 2
M_PI_4 Value of pi divided by 4
M_1_PI Value of 1 divided by pi
M_2_PI Value of 2 divided by pi
M_2_SQRTPI Value of 2 divided by the positive square root of pi
M_SQRT2 Positive square root of 2
M_SQRT1_2 Positive square root of 1/2

Related Information

The values.h file.

Header Files Overview defines header files, describes how they are used, and lists several of the header files for which information is provided in this documentation.

[ Previous | Next | Contents | Glossary | Home | Search ]