This chapter groups a wide variety of mathematical functions. The corresponding definitions and declarations are in math.h. The definition of HUGE_VAL from math.h is of particular interest.
double
is defined as
HUGE_VAL
; this number is returned on overflow by many functions.
The macro HUGE_VALF
is a corresponding value for float
.
Alternative declarations of the mathematical functions, which exploit specific machine capabilities to operate faster—but generally have less error checking and may reflect additional limitations on some machines—are available when you include fastmath.h instead of math.h.
acos
, acosf
—arc cosineacosh
, acoshf
—inverse hyperbolic cosineasin
, asinf
—arc sineasinh
, asinhf
—inverse hyperbolic sineatan
, atanf
—arc tangentatan2
, atan2f
—arc tangent of y/xatanh
, atanhf
—inverse hyperbolic tangentjN
, jNf
, yN
, yNf
—Bessel functionscbrt
, cbrtf
—cube rootcopysign
, copysignf
—sign of y, magnitude of xcosh
, coshf
—hyperbolic cosineerf
, erff
, erfc
, erfcf
—error functionexp
, expf
—exponentialexp10
, exp10f
—exponential, base 10exp2
, exp2f
—exponential, base 2expm1
, expm1f
—exponential minus 1fabs
, fabsf
—absolute value (magnitude)fdim
, fdimf
—positive differencefloor
, floorf
, ceil
, ceilf
—floor and ceilingfma
, fmaf
—floating multiply addfmax
, fmaxf
—maximumfmin
, fminf
—minimumfmod
, fmodf
—floating-point remainder (modulo)frexp
, frexpf
—split floating-point numbergamma
, gammaf
, lgamma
, lgammaf
, gamma_r
, gammaf_r
, lgamma_r
, lgammaf_r
, tgamma
, and tgammaf
—logarithmic and plain gamma functionshypot
, hypotf
—distance from originilogb
, ilogbf
—get exponent of floating-point numberinfinity
, infinityf
—representation of infinityisgreater
, isgreaterequal
, isless
, islessequal
, islessgreater
, and isunordered
—comparison macrosfpclassify
, isfinite
, isinf
, isnan
, and isnormal
—floating-point classification macros; finite
, finitef
, isinf
, isinff
, isnan
, isnanf
—test for exceptional numbersldexp
, ldexpf
—load exponentlog
, logf
—natural logarithmslog10
, log10f
—base 10 logarithmslog1p
, log1pf
—log of 1 + x
log2
, log2f
—base 2 logarithmlogb
, logbf
—get exponent of floating-point numberlrint
, lrintf
, llrint
, llrintf
—round to integerlround
, lroundf
, llround
, llroundf
—round to integer, to nearestmodf
, modff
—split fractional and integer partsnan
, nanf
—representation of “Not a Number”nearbyint
, nearbyintf
—round to integernextafter
, nextafterf
—get next numberpow
, powf
—x to the power ypow10
, pow10f
—base 10 power functionsremainder
, remainderf
—round and remainderremquo
, remquof
—remainder and part of quotientrint
, rintf
—round to integerround
, roundf
—round to integer, to nearestscalbn
, scalbnf
, scalbln
, scalblnf
—scale by power of FLT_RADIX (=2)signbit
—Does floating-point number have negative sign?sin
, sinf
, cos
, cosf
—sine or cosinesinh
, sinhf
—hyperbolic sinesqrt
, sqrtf
—positive square roottan
, tanf
—tangenttanh
, tanhf
—hyperbolic tangenttrunc
, truncf
—round to integer, towards zero