<math.h>
#define HUGE_VAL
<double rvalue>
double abs(double x);
[C++ only]
float abs(float x);
[C++ only]
long double abs(long double x);
[C++ only]
double acos(double x);
float acos(float x);
[C++ only]
long double acos(long double x);
[C++ only]
float acosf(float x);
[optional]
long double acosl(long double x);
[optional]
double asin(double x);
float asin(float x);
[C++ only]
long double asin(long double x);
[C++ only]
float asinf(float x);
[optional]
long double asinl(long double x);
[optional]
double atan(double x);
float atan(float x);
[C++ only]
long double atan(long double x);
[C++ only]
float atanf(float x);
[optional]
long double atanl(long double x);
[optional]
double atan2(double y, double x);
float atan2(float y, float x);
[C++ only]
long double atan2(long double y,
long double x); [C++ only]
float atan2f(float y, float x);
[optional]
long double atan2l(long double y,
long double x); [optional]
double ceil(double x);
float ceil(float x);
[C++ only]
long double ceil(long double x);
[C++ only]
float ceilf(float x);
[optional]
long double ceill(long double x);
[optional]
double cos(double x);
float cos(float x);
[C++ only]
long double cos(long double x);
[C++ only]
float cosf(float x);
[optional]
long double cosl(long double x);
[optional]
double cosh(double x);
float cosh(float x);
[C++ only]
long double cosh(long double x);
[C++ only]
float coshf(float x);
[optional]
long double coshl(long double x);
[optional]
double exp(double x);
float exp(float x);
[C++ only]
long double exp(long double x);
[C++ only]
float expf(float x);
[optional]
long double expl(long double x);
[optional]
double fabs(double x);
float fabs(float x);
[C++ only]
long double fabs(long double x);
[C++ only]
float fabsf(float x);
[optional]
long double fabsl(long double x);
[optional]
double floor(double x);
float floor(float x);
[C++ only]
long double floor(long double x);
[C++ only]
float floorf(float x);
[optional]
long double floorl(long double x);
[optional]
double fmod(double x, double y);
float fmod(float x, float y);
[C++ only]
long double fmod(long double x,
long double y); [C++ only]
float fmodf(float x, float y);
[optional]
long double fmodl(long double x,
long double y); [optional]
double frexp(double x, int *pexp);
float frexp(float x, int *pexp);
[C++ only]
long double frexp(long double x,
int *pexp); [C++ only]
float frexpf(float x, int *pexp);
[optional]
long double frexpl(long double x,
int *pexp); [optional]
double ldexp(double x, int exp);
float ldexp(float x, int exp);
[C++ only]
long double ldexp(long double x,
int exp); [C++ only]
float ldexpf(float x, int exp);
[optional]
long double ldexpl(long double x,
int exp); [optional]
double log(double x);
float log(float x);
[C++ only]
long double log(long double x);
[C++ only]
float logf(float x);
[optional]
long double logl(long double x);
[optional]
double log10(double x);
float log10(float x);
[C++ only]
long double log10(long double x);
[C++ only]
float log10f(float x);
[optional]
long double log10l(long double x);
[optional]
double modf(double x, double *pint);
float modf(float x, float *pint);
[C++ only]
long double modf(long double x,
long double *pint); [C++ only]
float modff(float x, float *pint);
[optional]
long double modfl(long double x,
long double *pint); [optional]
double pow(double x, double y);
float pow(float x, float y);
[C++ only]
long double pow(long double x,
long double y); [C++ only]
double pow(double x, int y);
[C++ only]
float pow(float x, int y);
[C++ only]
long double pow(long double x, int y);
[C++ only]
float powf(float x, float y);
[optional]
long double powl(long double x,
long double y); [optional]
double sin(double x);
float sin(float x);
[C++ only]
long double sin(long double x);
[C++ only]
float sinf(float x);
[optional]
long double sinl(long double x);
[optional]
double sinh(double x);
float sinh(float x);
[C++ only]
long double sinh(long double x);
[C++ only]
float sinhf(float x);
[optional]
long double sinhl(long double x);
[optional]
double sqrt(double x);
float sqrt(float x);
[C++ only]
long double sqrt(long double x);
[C++ only]
float sqrtf(float x);
[optional]
long double sqrtl(long double x);
[optional]
double tan(double x);
float tan(float x);
[C++ only]
long double tan(long double x);
[C++ only]
float tanf(float x);
[optional]
long double tanl(long double x);
[optional]
double tanh(double x);
float tanh(float x);
[C++ only]
long double tanh(long double x);
[C++ only]
float tanhf(float x);
[optional]
long double tanhl(long double x);
[optional]
Include the standard header <math.h>
to declare several functions that perform
common mathematical operations on floating-point values.
A domain error
exception occurs when the function is
not defined for its input argument value or values. A function reports
a domain error by storing the value of
EDOM
in
errno
and returning a peculiar value defined for each implementation.
A range error
exception occurs when the return value of the
function is defined but cannot be represented.
A function reports a range error by storing the value of
ERANGE
in
errno
and returning one of three values:
HUGE_VAL
-- if the value of a function returning double is positive
and too large in magnitude to represent
-HUGE_VAL
-- if the value of a function returning double is negative
and too large in magnitude to represent
HUGE_VAL
#define HUGE_VAL <double rvalue>
The macro yields the value returned by some functions on a range error. The value can be a representation of infinity.
abs
double abs(double x); [C++ only]
float abs(float x); [C++ only]
long double abs(long double x); [C++ only]
The function returns the absolute value of x
,
|x|
, the same as
fabs
.
acos
,
acosf
,
acosl
double acos(double x);
float acos(float x); [C++ only]
long double acos(long double x); [C++ only]
float acosf(float x); [optional]
long double acosl(long double x); [optional]
The function returns the angle whose cosine is x
, in
the range [0, pi] radians.
asin
,
asinf
,
asinl
double asin(double x);
float asin(float x); [C++ only]
long double asin(long double x); [C++ only]
float asinf(float x); [optional]
long double asinl(long double x); [optional]
The function returns the angle whose sine is x
, in the
range [-pi/2, +pi/2] radians.
atan
,
atanf
,
atanl
double atan(double x);
float atan(float x); [C++ only]
long double atan(long double x); [C++ only]
float atanf(float x); [optional]
long double atanl(long double x); [optional]
The function returns the angle whose tangent is x
, in
the range [-pi/2, +pi/2] radians.
atan2
,
atan2f
,
atan2l
double atan2(double y, double x);
float atan2(float y, float x); [C++ only]
long double atan2(long double y, long double x); [C++ only]
float atan2f(float y, float x); [optional]
long double atan2l(long double y, long double x); [optional]
The function returns the angle whose tangent is y/x
,
in the full angular range [-pi, +pi] radians.
ceil
,
ceilf
,
ceill
double ceil(double x);
float ceil(float x); [C++ only]
long double ceil(long double x); [C++ only]
float ceilf(float x); [optional]
long double ceill(long double x); [optional]
The function returns the smallest integer value not less than
x
.
cos
,
cosf
,
cosl
double cos(double x);
float cos(float x); [C++ only]
long double cos(long double x); [C++ only]
float cosf(float x); [optional]
long double cosl(long double x); [optional]
The function returns the cosine of x
for x
in
radians. If x
is large the value returned
might not be meaningful, but the function reports no error.
cosh
,
coshf
,
coshl
double cosh(double x);
float cosh(float x); [C++ only]
long double cosh(long double x); [C++ only]
float coshf(float x); [optional]
long double coshl(long double x); [optional]
The function returns the hyperbolic cosine of x
.
exp
,
expf
,
expl
double exp(double x);
float exp(float x); [C++ only]
long double exp(long double x); [C++ only]
float expf(float x); [optional]
long double expl(long double x); [optional]
The function returns the exponential of x
,
e^x
.
fabs
,
fabsf
,
fabsl
double fabs(double x);
float fabs(float x); [C++ only]
long double fabs(long double x); [C++ only]
float fabsf(float x); [optional]
long double fabsl(long double x); [optional]
The function returns the absolute value of x
,
|x|
, the same as
abs
.
floor
,
floorf
,
floorl
double floor(double x);
float floor(float x); [C++ only]
long double floor(long double x); [C++ only]
float floorf(float x); [optional]
long double floorl(long double x); [optional]
The function returns the largest integer value not greater than
x
.
fmod
,
fmodf
,
fmodl
double fmod(double x, double y);
float fmod(float x, float y); [C++ only]
long double fmod(long double x, long double y); [C++ only]
float fmodf(float x, float y); [optional]
long double fmodl(long double x, long double y); [optional]
The function returns the remainder of x/y
,
which is defined as follows:
y
is zero,
the function either reports a domain error or simply returns zero.
0 <= x
,
the value is x - i*y
for some integer i
such that:0 <= i*|y| <= x < (i + 1)*|y|
x < 0
and the value is x - i*y
for some integer i
such that:i*|y| <= x < (i + 1)*|y| <= 0
frexp
,
frexpf
,
frexpl
double frexp(double x, int *pexp);
float frexp(float x, int *pexp); [C++ only]
long double frexp(long double x, int *pexp); [C++ only]
float frexpf(float x, int *pexp); [optional]
long double frexpl(long double x, int *pexp); [optional]
The function determines a fraction f
and base-2 integer
i
that represent the value of x
.
It returns the value f
and stores the integer
i
in *pexp
, such that
|f|
is in the interval [1/2, 1) or has the value 0,
and x
equals f*2^i
.
If x
is zero, *pexp
is also zero.
ldexp
,
ldexpf
,
ldexpl
double ldexp(double x, int exp);
float ldexp(float x, int exp); [C++ only]
long double ldexp(long double x, int exp); [C++ only]
float ldexpf(float x, int exp); [optional]
long double ldexpl(long double x, int exp); [optional]
The function returns x*2^exp
.
log
,
logf
,
logl
double log(double x);
float log(float x); [C++ only]
long double log(long double x); [C++ only]
float logf(float x); [optional]
long double logl(long double x); [optional]
The function returns the natural logarithm of x
.
log10
,
log10f
,
log10l
double log10(double x);
float log10(float x); [C++ only]
long double log10(long double x); [C++ only]
float log10f(float x); [optional]
long double log10l(long double x); [optional]
The function returns the base-10 logarithm of x
.
modf
,
modff
,
modfl
double modf(double x, double *pint);
float modf(float x, float *pint); [C++ only]
long double modf(long double x, long double *pint); [C++ only]
float modff(float x, float *pint); [optional]
long double modfl(long double x, long double *pint); [optional]
The function determines an integer i
plus a fraction
f
that represent the value of x
.
It returns the value f
and stores the integer
i
in *pint
, such that
f + i == x
, |f| is in the interval [0, 1),
and both
f
and i
have the
same sign as x
.
pow
,
powf
,
powl
double pow(double x, double y);
float pow(float x, float y); [C++ only]
long double pow(long double x, long double y); [C++ only]
double pow(double x, int y); [C++ only]
float pow(float x, int y); [C++ only]
long double pow(long double x, int y); [C++ only]
float powf(float x, float y); [optional]
long double powl(long double x, long double y); [optional]
The function returns x
raised to the power y
,
x^y
.
sin
,
sinf
,
sinl
double sin(double x);
float sin(float x); [C++ only]
long double sin(long double x); [C++ only]
float sinf(float x); [optional]
long double sinl(long double x); [optional]
The function returns the sine of x
for x
in radians. If x
is large
the value returned might not be meaningful, but
the function reports no error.
sinh
,
sinhf
,
sinhl
double sinh(double x);
float sinh(float x); [C++ only]
long double sinh(long double x); [C++ only]
float sinhf(float x); [optional]
long double sinhl(long double x); [optional]
The function returns the hyperbolic sine of x
.
sqrt
,
sqrtf
,
sqrtl
double sqrt(double x);
float sqrt(float x); [C++ only]
long double sqrt(long double x); [C++ only]
float sqrtf(float x); [optional]
long double sqrtl(long double x); [optional]
The function returns the square root of x
,
x^(1/2)
.
tan
,
tanf
,
tanl
double tan(double x);
float tan(float x); [C++ only]
long double tan(long double x); [C++ only]
float tanf(float x); [optional]
long double tanl(long double x); [optional]
The function returns the tangent of x
for x
in
radians.If x
is large the value returned
might not be meaningful,
but the function reports no error.
tanh
,
tanhf
,
tanhl
double tanh(double x);
float tanh(float x); [C++ only]
long double tanh(long double x); [C++ only]
float tanhf(float x); [optional]
long double tanhl(long double x); [optional]
The function returns the hyperbolic tangent of x
.
See also the Table of Contents and the Index.
Copyright © 1989-1996 by P.J. Plauger and Jim Brodie. All rights reserved.