The <math.h>
header file defines one macro and several
mathematical functions. The functions take double
arguments and return double-precision values.
The behavior of the functions in this header is defined for all representable values of their input arguments. Each function executes as if it were a single operation, without generating any externally visible exceptions.
For all functions, a domain error occurs if an input
argument is outside the domain over which the mathematical function
is defined. The description of each function lists any domain
errors. On a domain error, the function returns an implementation-
defined value; the value of the EDOM
macro is stored in
errno
.
For all functions, a range error occurs if the result
of the function cannot be represented as a double
value. If the result overflows (the magnitude of the result is so
large that it cannot be represented in an object of the specified
type), the function returns the value of the macro HUGE_
VAL
, with the same sign (except for the tan
function) as the correct value of the function; the value of the
ERANGE
macro is stored in errno
. If the
result underflows (the magnitude of the result is so small that
it cannot be represented in an object of the specified type), the
function returns 0; whether the value of the ERANGE
macro is stored in errno
is implementation-defined.
HUGE_VAL
double
expression.
double acos(double x);
double asin(double x);
double atan(double x);
double atan2(double y, double x);
double cos(double x);
double sin(double x);
double tan(double x);
double cosh(double x);
double sinh(double x);
double tanh(double x);
Exponential and Logarithmic Functions
double exp(double x);
double frexp(double value, int
*eptr);
int
object pointed to by eptr. If
value is 0, both parts of the result are 0.
double ldexp(double x, int exp);
double log(double x);
double log10(double x);
double modf(double value, double
*iptr);
modf
function returns the
signed fractional part and stores the integral part as a
double
in the object pointed to by iptr.
double pow(double x, double y);
double sqrt(double x);
Nearest Integer, Absolute Value, and Remainder Functions
double ceil(double x);
double fabs(double x);
double floor(double x);
double fmod(double x, double y);
fmod
function returns the value
x - i * y, for some integer i
such that if y is nonzero, the result has the same
sign as x and magnitude less than the magnitude of
y. The function returns 0 if y is 0.