<cmath>
Home Up

 

Same level pages:
<algorithms>
<cassert>
<cerrno>
<cctype>
<cfloat>
<climits>
<clocale>
<cmath>
<complex>
<csetjmp>
<csignal>
<cstdarg>
<cstddef>
<cstdio>
<cstdlib>
<cstring>
<ctime>
<cwchar>
<cwctype>
<exception>
<fstream>
<functional>
<iomanip>
<ios>
<iostream>
<istream>
<iterator>
<limits>
<locale>
<memory>
<new>
<numeric>
<ostream>
<sstream>
<stdexcept>
<streambuf>
<string>
<typeinfo>
<utility>
<valarray>

Parent level pages:
STL
FAQs
Headers
Libraries

<cmath> is part of the Standard C++ Numerics Library and is essentially equivalent to the Standard C <math.h> header.

Macros

HUGE_VAL

Functions

Standard C++ overloads float and long double functions for each of the functions in the Standard C library.

float abs (float x)
double abs (double x)
long double abs (long double x)
Overloads int abs(int x) and replaces the Standard C fabs().
float acos (float x)
double acos (double x)
long double acos (long double x)
The acos function returns the arccosine of x in the range 0 to π radians. If x is less than –1 or greater than 1, acos is out of its domain.
float asin ( float x)
double asin (double x)
long double asin (long double x)
Calculates the arcsine. The asin function returns the arcsine of x in the range –π/2 to π/2 radians. If x is less than –1 or greater than 1, asin is out of its domain.
float atan (float x)
double atan (double x)
long double atan (long double)
Calculates the arctangent of x. If x is 0, atan returns 0. atan returns a value in the range –π/2 to π/2 radians.
float atan2 (float y, float x)
double atan2 (double y, double x)
long double atan2 (long double y, long double x)
Calculates the arctangent of y/x. If both parameters of atan2 are 0, the function returns 0. atan2 returns a value in the range –π to π radians, using the signs of both parameters to determine the quadrant of the return value.
float ceil (float x)
double ceil (double x)
long double ceil (long double x)
Calculates the ceiling of a value. The ceil function returns a value representing the smallest integer that is greater than or equal to x.
float cos (float x)
double cos (double x)
long double cos (long double x)
The cos  function returns the cosine of x.
float cosh (float x)
double cosh (double x)
long double cosh (long double x)
The cosh function returns the  hyperbolic cosine of x. If the result is too large in a cosh call, the function returns HUGE_VAL and sets errno to ERANGE.
float exp (float x)
double exp (double x)
long double exp (long double x)
The exp function returns the exponential value of the floating-point parameter, x, if successful.
double fabs (double x)
Same as double abs (double x), for backward compatibility with Standard C which does not support overloading function names. On underflow, exp returns 0.
float floor (float x)
double floor (double x)
long double floor (long double x)
 The floor function returns a floating-point value representing the largest integer that is less than or equal to x.
float fmod (float, float)
double fmod (double, double)
long double fmod (long double, long double)
 The fmod function calculates the floating-point remainder f of x / y such that x = i * y + f, where i is an integer, f has the same sign as x, and the absolute value of f is less than the absolute value of y.
float frexp (float x, int* expptr)
double frexp (double x, int* expptr)
long double frexp (long double x, int* expptr)
The frexp function breaks down the floating-point value (x) into a mantissa (m) and an exponent (n), such that the absolute value of m is greater than or equal to 0.5 and less than 1.0, and x = m*2n. The integer exponent n is stored at the location pointed to by expptr.
float ldexp (float x, int exp)
double ldexp (double x, int exp)
long double ldexp (long double x, int exp)
 The ldexp function returns the value of x * 2exp if successful. On overflow (depending on the sign of x), ldexp returns +/– HUGE_VAL; the errno variable is set to ERANGE.
float log (float x)
double log (double x)
long double log (long double x)
The log function  returns the natural logarithm of x if successful. If x is not positive, this function is out of its domain.
float log10 (float x)
double log10 (double x)
long double log10 (long double x)
The log10 function  returns the base-10 logarithm of x if successful. If x is not positive, this function is out of its domain.
float modf (float x, float* intptr)
double modf (double x, double* intptr)
long double modf (long double x, long double* intptr)
 The modf function breaks down the floating-point value x into fractional and integer parts, each of which has the same sign as x. The signed fractional portion of x is returned. The integer portion is stored as a floating-point value at intptr.
float pow (float, float)
double pow (double, double)
long double pow (long double, long double)
 pow returns the value of xy.
float sin (float x)
double sin (double x)
long double sin (long double x)
sin returns the sine of x.
 
float sinh (float x)
double sinh (double x)
long double sinh (long double x)
 sinh returns the hyperbolic sine of x. If the result is too large, sinh sets errno to ERANGE and returns ±HUGE_VAL.
float sqrt (float x)
double sqrt (double x)
long double sqrt (long double x)
 The sqrt function returns the square-root of x. If x is negative, this function is out of its domain.
 
©Paul Buis & Ball State University Author: Paul Buis (peb@bsu.edu) Last Modified:10/31/00 02:35 PM

NOTICE: The information presented on this page represents the personal views, ideas, and opinions of the author. This is not an official Ball State University web page. Links contained at this web site to other organizations, are presented as a service and neither constitute nor imply university endorsement or warranty.