# <math.h>
<math.h>
# ``
* * *
**`HUGE_VAL`**
**`abs· acos· asin· atan· atan2· ceil· cos· cosh· exp· fabs· floor· fmod· frexp· ldexp· log· log10· modf· pow· sin· sinh· sqrt· tan· tanh`**
**`acosf· asinf· atanf· atan2f· ceilf· cosf· coshf· expf· fabsf· floorf· fmodf· frexpf· ldexpf· logf· log10f· modff· pow· sinf· sinhf· sqrtf· tanf· tanhf`**
**`acosl· asinl· atanl· atan2l· ceill· cosl· coshl· expl· fabsl· floorl· fmodl· frexpl· ldexpl· logl· log10l· modfl· pow· sinl· sinhl· sqrtl· tanl· tanhl`**
* * *
Include the standard header **``**
to declare a number of functions that perform
common mathematical operations on real floating-point values
(of type *float, double,* or *long double*).
A **domain error**
occurs when the function is
not defined for its input argument value or values. A function can report
a domain error by storing the value of
[`EDOM`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_errno.html#EDOM) in
[`errno`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_errno.html#errno)
and returning a particular value defined for each implementation.
A **range error**
occurs when the return value of the
function is defined but cannot be represented.
A function can report a range error by storing the value of
[`ERANGE`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_errno.html#ERANGE) in
[`errno`](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_errno.html#errno)
and returning one of several 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
- zero -- if the value of the function is too small to represent
with a finite value
* * *
/* MACROS */
#define HUGE_VAL
/* FUNCTIONS */
double acos(double x);
double asin(double x);
double atan(double x);
double atan2(double y, double x);
double ceil(double x);
double cos(double x);
double cosh(double x);
double exp(double x);
double fabs(double x);
double floor(double x);
double fmod(double x, double y);
double frexp(double x, int *pexp);
double ldexp(double x, int ex);
double log(double x);
double log10(double x);
double modf(double x, double *pint);
double pow(double x, double y);
double sin(double x);
double sinh(double x);
double sqrt(double x);
double tan(double x);
double tanh(double x);
Copy to clipboard
## `abs`,
`fabs`,
`fabsf`,
`fabsl`
double fabs(double x);Copy to clipboard
The function returns the magnitude of `x`,
`|x|`.
## `acos`,
`acosf`,
`acosl`
double acos(double x);Copy to clipboard
The function returns the angle whose cosine is `x`, in
the range [0, pi] radians. A domain error occurs if `1 < |x|`.
## `asin`,
`asinf`,
`asinl`
double asin(double x);Copy to clipboard
The function returns the angle whose sine is `x`, in the
range [-pi/2, +pi/2] radians. A domain error occurs
if `1 < |x|`.
## `atan`,
`atanf`,
`atanl`
double atan(double x);Copy to clipboard
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);Copy to clipboard
The function returns the angle whose tangent is `y/x`,
in the full angular range [-pi, +pi] radians. A domain error may occur
if both `x` and `y` are zero.
## `ceil`,
`ceilf`,
`ceill`
double ceil(double x);Copy to clipboard
The function returns the smallest integer value not less than
`x`.
## `cos`,
`cosf`,
`cosl`
double cos(double x);Copy to clipboard
The function returns the cosine of `x`.
If `x` is large the value returned
might not be meaningful, but the function reports no error.
## `cosh`,
`coshf`,
`coshl`
double cosh(double x);Copy to clipboard
The function returns the hyperbolic cosine of `x`.
## `exp`,
`expf`,
`expl`
double exp(double x);Copy to clipboard
The function returns the exponential of `x`,
e^`x`.
## `floor`,
`floorf`,
`floorl`
double floor(double x);Copy to clipboard
The function returns the largest integer value not greater than
`x`.
## `fmod`,
`fmodf`,
`fmodl`
double fmod(double x, double y);Copy to clipboard
The function returns the remainder of `x/y`,
which is defined as follows:
- If `y` is zero,
the function either reports a domain error or simply returns zero.
- Otherwise, the function determines the unique signed integer value
`i` such that the returned value `x - i * y` has the
same sign as `x` and magnitude less than `|y|`.
## `frexp`,
`frexpf`,
`frexpl`
double frexp(double x, int *pexp);Copy to clipboard
The function determines a fraction `frac` and an exponent integer
`ex` that represent the value of `x`.
It returns the value `frac` and stores the integer
`ex` in `*pexp`, such that:
- `|frac|` is in the interval [1/2, 1) or is zero
- `x == frac * 2^ex`
If `x` is zero, `*pexp` is also zero.
## `HUGE_VAL`
#define HUGE_VAL Copy to clipboard
The macro yields the *double* value returned by some functions
on a range error. The value can be a representation of infinity.
## `ldexp`,
`ldexpf`,
`ldexpl`
double ldexp(double x, int ex);Copy to clipboard
The function returns `x * 2^ex`.
## `log`,
`logf`,
`logl`
double log(double x);Copy to clipboard
The function returns the natural logarithm of `x`.
A domain error occurs if `x < 0`.
## `log10`,
`log10f`,
`log10l`
double log10(double x);Copy to clipboard
The function returns the base-10 logarithm of `x`.
A domain error occurs if `x < 0`.
## `modf`,
`modff`,
`modfl`
double modf(double x, double *pint);Copy to clipboard
The function determines an integer `i` plus a fraction
`frac` that represent the value of `x`.
It returns the value `frac` and stores the integer
`i` in `*pint`, such that:
- `x == frac + i`
- `|frac|` is in the interval [0, 1)
- both `frac` and `i` have the
same sign as `x`
## `pow`,
`powf`,
`powl`
double pow(double x, double y);Copy to clipboard
The function returns `x` raised to the power `y`,
`x^y`.
## `sin`,
`sinf`,
`sinl`
double sin(double x);Copy to clipboard
The function returns the sine of `x`.
If `x` is large
the value returned might not be meaningful, but
the function reports no error.
## `sinh`,
`sinhf`,
`sinhl`
double sinh(double x);Copy to clipboard
The function returns the hyperbolic sine of `x`.
## `sqrt`,
`sqrtf`,
`sqrtl`
double sqrt(double x);Copy to clipboard
The function returns the real square root of `x`,
`x^(1/2)`. A domain error occurs if `x < 0`.
## `tan`,
`tanf`,
`tanl`
double tan(double x);Copy to clipboard
The function returns the tangent of `x`.
If `x` is large the value returned
might not be meaningful,
but the function reports no error.
## `tanh`,
`tanhf`,
`tanhl`
double tanh(double x);Copy to clipboard
The function returns the hyperbolic tangent of `x`.
* * *
See also the
**[Table of Contents](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_index.html#Table%20of%20Contents)** and the
**[Index](https://docs.qualcomm.com/doc/80-N3040-23/topic/_cpp_index.html)**.
*[Copyright](https://docs.qualcomm.com/doc/80-N3040-23/topic/cpp_crit_pjp.html) © 1992-2006by P.J. Plauger and Jim Brodie. All rights reserved.*
Last Published: Oct 06, 2026
Previous Topic
Next Topic