|
|
|
|
Math.h
|
| |
|
| |
math.h is a header file in the standard library of C programming language designed for basic mathematical operations. Most of the functions involve the use of floating point numbers. C++ also implements these functions for compatibility reasons and declares them in the header cmath.
All functions that take or return an angle work in radians.
All these functions take doubles for floating-point arguments, unless otherwise specified.

Discussion
Ask a question about 'Math.h'
Start a new discussion about 'Math.h'
Answer questions from other users
|
Encyclopedia
math.h is a header file in the standard library of C programming language designed for basic mathematical operations. Most of the functions involve the use of floating point numbers. C++ also implements these functions for compatibility reasons and declares them in the header cmath.
All functions that take or return an angle work in radians.
All these functions take doubles for floating-point arguments, unless otherwise specified. To work with floats or long doubles, append an f or an l to the name, respectively.
Pre-C99 functions
C99 functions
| Name | Description |
|---|
acosh | inverse hyperbolic cosine | asinh | inverse hyperbolic sine | atanh | inverse hyperbolic tangent | cbrt | cube root | copysign(x,y) | returns the value of x with the sign of y | erf | error function | erfc | complementary error function | exp2(x) | raise 2 to the power of x, 2x | expm1(x) | one less than the exponential of x, ex − 1 | fdim(x,y) | positive difference between x and y, fmax(x−y, 0) | fma(x,y,z) | multiply and add, (x * y) + z | fmax(x,y) | largest value of x and y | fmin(x,y) | smallest value of x and y | hypot(x,y) | hypotenuse, sqrt(x2 + y2) | ilogb | the exponent of a floating-point value, converted to an int | lgamma | natural log of the absolute value of the gamma function | llrint | round to integer (returns long long) using current rounding mode | lrint | round to integer (returns long) using current rounding mode | llround | round to integer (returns long long) | lround | round to integer (returns long) | log1p(x) | natural logarithm of 1 + x | log2 | base-2 logarithm | logb | extract exponent from floating-point number | nan(s) | returns NaN, possibly using string argument | nearbyint | round floating-point number to nearest integer | nextafter(x,y) | returns next representable value after x (towards y) | nexttoward(x,y) | same as nextafter, except y is always a long double | remainder(x,y) | calculates remainder, as required by IEC 60559 | remquo(x,y,p) | same as remainder, but store quotient (as int) at target of pointer p | rint | round to integer (returns int) using current rounding mode | round | round to integer (returns int) | scalbln(x,n) | x * FLT_RADIXn (n is long) | scalbn(x,n) | x * FLT_RADIXn (n is int) | tgamma | gamma function | trunc | truncate floating-point number |
XSI Extensions
Extra functions may be available as X/Open System Interfaces Extensions. These are not present in any ANSI or ISO C standard.
| Name | Description |
|---|
j0(x) | Bessel function of x of the first kind of order 0 | j1(x) | Bessel function of x of the first kind of order 1 | jn(n,x) | Bessel function of x of the first kind of order n | scalb(x,y) | x * FLT_RADIXy (x and y are doubles) | y0(x) | Bessel function of x of the second kind of order 0 | y1(x) | Bessel function of x of the second kind of order 1 | yn(n,x) | Bessel function of x of the second kind of order n |
The double-to-string conversion functions ecvt, fcvt and gcvt have been deprecated in favour of sprintf.
Extra links
- , a reference of all
math.h functions
|
| |
|
|