This page compares the list of functions in the C math.h
header across four versions: ISO (ANSI) pre-1999, ISO post-1999, POSIX, and Microsoft Visual Studio.
The smallest list is the ISO standard prior to 1999. All other lists completely contain the original ISO standard.
The latest POSIX and ISO standards are essentially identical. The only difference is that the POSIX standard requires Bessel functions of the first kind j0
, j1
, and jn
and Bessel functions of the second kind y0
, y1
, and yn
.
Microsoft supports the older ISO standard and supports the Bessel functions mentioned above. Microsoft supports some of the functions added to the ISO standard in 1999. The Microsoft names for these new functions are the ISO names with an underscore prefix. The only minor exception is that the Microsoft function corresponding to the ISO function fpclassify
is _fpclass
rather than _fpclassify
.
Details are given in the table below.
Function | POSIX | old ISO | ISO C99 | Microsoft | Notes |
---|---|---|---|---|---|
acos | Y | Y | Y | Y | |
acosh | Y | N | Y | N | 1 |
asin | Y | Y | Y | Y | |
asinh | Y | N | Y | N | 1 |
atan | Y | Y | Y | Y | |
atan2 | Y | Y | Y | Y | |
atanh | Y | N | Y | N | 1 |
cbrt | Y | N | Y | N | |
ceil | Y | Y | Y | Y | |
copysign | Y | N | Y | Y | _copysign |
cos | Y | Y | Y | Y | |
cosh | Y | Y | Y | Y | |
erf | Y | N | Y | N | 2 |
erfc | Y | N | Y | N | |
exp | Y | Y | Y | Y | |
exp2 | Y | N | Y | N | |
expm1 | Y | N | Y | N | 2 |
fabs | Y | Y | Y | Y | |
fdim | Y | N | Y | N | |
floor | Y | Y | Y | Y | |
fma | Y | N | Y | N | |
fmax | Y | N | Y | N | |
fmin | Y | N | Y | N | |
fmod | Y | Y | Y | Y | |
fpclassify | Y | N | Y | Y | _fpclass |
frexp | Y | Y | Y | Y | |
hypot | Y | N | Y | Y | _hypot |
ilogb | Y | N | Y | N | |
isfinite | Y | N | Y | N | 3 |
isgreater | Y | N | Y | N | |
isgreaterequal | Y | N | Y | N | |
isinf | Y | N | Y | N | |
isless | Y | N | Y | N | |
islessequal | Y | N | Y | N | |
islessgreater | Y | N | Y | N | |
isnan | Y | N | Y | Y | _isnan |
isnormal | Y | N | Y | N | |
isunordered | Y | N | Y | N | |
j0 | Y | N | N | Y | _j0 |
j1 | Y | N | N | Y | _j1 |
jn | Y | N | N | Y | _jn |
ldexp | Y | Y | Y | Y | |
lgamma | Y | N | Y | N | 2 |
llrint | Y | N | Y | N | |
llround | Y | N | Y | N | |
log | Y | Y | Y | Y | |
log10 | Y | Y | Y | Y | |
log1p | Y | N | Y | N | 2 |
log2 | Y | N | Y | N | |
logb | Y | N | Y | Y | _logb |
lrint | Y | N | Y | N | |
lround | Y | N | Y | N | |
modf | Y | Y | Y | Y | |
nan | Y | N | Y | N | |
nearbyint | Y | N | Y | N | |
nextafter | Y | N | Y | Y | _nextafter |
nexttoward | N | N | Y | N | |
pow | Y | Y | Y | Y | |
remainder | Y | N | Y | N | |
remquo | Y | N | Y | N | |
rint | Y | N | Y | N | |
round | Y | N | Y | N | |
scalbln | Y | N | Y | N | |
scalbn | N | N | Y | N | |
signbit | Y | N | Y | N | |
sin | Y | Y | Y | Y | |
sinh | Y | Y | Y | Y | |
sqrt | Y | Y | Y | Y | |
tan | Y | Y | Y | Y | |
tanh | Y | Y | Y | Y | |
tgamma | Y | N | Y | N | 2 |
trunc | Y | N | Y | N | |
y0 | Y | N | N | Y | _y0 |
y1 | Y | N | N | Y | _y1 |
yn | Y | N | N | Y | _yn |
[1] The inverse hyperbolic functions can be reduced to more familiar functions.
- asinh(x) = log(x + sqrt(x2 + 1))
- acosh(x) = log(x + sqrt(x2 − 1))
- atanh(x) = (log(1 + x) − log(1 − x))/2
[2] Here is stand-alone code for these functions: erf, expm1, log1p, lgamma, tgamma.
[3] You can test whether a number is a NaN by testing whether it equals itself. The expression (x == x)
returns true if and only if x
is not a NaN. (See floating point exceptions.)