The <math.h> header defines several mathematic functions.
The <math.h> header shall define the following macro constants:
The <math.h> header shall define the following functions:
Trigonometric functions:
Hyperbolic functions:
Exponential and logarithmic functions:
Power functions:
Error and gamma functions:
Nearest integer floating-point operations:
Floating-point manipulation functions:
Basic operations:
Classification and comparison:
The <math.h> header shall define the following types:
Related topics:
<float.h> | <inttypes.h> | <iso646.h> | <limits.h> | <locale.h> | Standard Library in C
List of topics: C Programming
The <math.h> header shall define the following macro constants:
HUGE_VALF HUGE_VAL HUGE_VALL | indicates value too big to be representable (infinity) by float(C99), double and long double(C99) respectively |
INFINITY | evaluates to positive infinity or the value guaranteed to overflow a float (C99) |
NAN | Not a Number - evaluates to a quiet NaN of type float (C99) |
math_errhandling | defines the error handling mechanism used by the common mathematical functions. (C99) |
MATH_ERRNO MATH_ERREXCEPT | Bitmask value with the possible values math_errhandling can take. (C99) |
FP_FAST_FM FP_FAST_FMAF FP_FAST_FMAL | Each, if defined, identifies for which type fma is at least as efficient as x*y+z. (C99) |
FP_INFINITE FP_NAN FP_NORMAL FP_SUBNORMAL FP_ZERO | The possible values returned by fpclassify. (C99) |
FP_ILOGB0 FP_ILOGBNAN | Special values the ilogb function may return. (C99) |
The <math.h> header shall define the following functions:
Trigonometric functions:
sin sinf sinl | computes sine (sin(x)) . double, float (C99) and long double (C99) |
cos cosf cosl | computes cosine (cos(x)) . double, float (C99) and long double (C99) |
tan tanf tanl | computes tangent (tan(x)) . double, float (C99) and long double (C99) |
asin asinf asinl | computes arc sine (arcsin(x)) . double, float (C99) and long double (C99) |
acos acosf acosl | computes arc cosine (arccos(x)) . double, float (C99) and long double (C99) |
atan atanf atanl | computes arc tangent (arctan(x)) . double, float (C99) and long double (C99) |
atan2 atan2f atan2l | computes arc tangent, using signs to determine quadrants . double, float (C99) and long double (C99) |
Hyperbolic functions:
sinh sinhf sinhl | computes hyperbolic sine (sh(x)) . double, float (C99) and long double (C99) |
cosh coshf coshl | computes hyperbolic cosine (ch(x)) . double, float (C99) and long double (C99) |
tanh tanhf tanhl | computes hyperbolic tangent . double, float (C99) and long double (C99) |
asinh asinhf asinhl | computes inverse hyperbolic sine (arsinh(x)) (C99) |
acosh acoshf acoshl | computes inverse hyperbolic cosine (arcosh(x)) (C99) |
atanh atanhf atanhl | computes inverse hyperbolic tangent (artanh(x)) (C99) |
Exponential and logarithmic functions:
exp expf expl | computes e raised to the given power (ex) . double, float (C99) and long double (C99) |
exp2 exp2f exp2l | computes 2 raised to the given power (2x) . (C99) |
expml expm1f expm1l | computes e raised to the given power, minus one (ex-1) . (C99) |
log logf logl | computes natural (base-e) logarithm (ln(x)) . double, float (C99) and long double (C99) |
log10 log10f log10l | computes common (base-10) logarithm (log10(x)) . double, float (C99) and long double (C99) |
log2 log2f log2l | computes base-2 logarithm (log2(x)) . (C99) |
log1p log1pf log1pl | computes natural (base-e) logarithm of 1 plus the given number (ln(1+x)) . (C99) |
Power functions:
pow powf powl | computes a number raised to the given power (xy) . double, float (C99) and long double (C99) |
sqrt sqrtf sqrtl | computes square root (√x) . double, float (C99) and long double (C99) |
cbrt cbrtf cbrtl | computes cubic root (3√x) . (C99) |
hypot hypotf hypotl | computes square root of the sum of the squares of two given numbers (√x2+y2) . (C99) |
Error and gamma functions:
erf erff erfl | computes error function (C99) |
erfc erfcf erfcl | computes complementary error function (C99) |
tgamma tgammaf tgammal | computes gamma function (C99) |
lgamma lgammaf lgammal | computes natural (base-e) logarithm of the gamma function (C99) |
Nearest integer floating-point operations:
ceil ceilf ceill | computes smallest integer not less than the given value .double, float (C99) and long double (C99) |
floor floorf floorl | computes largest integer not greater than the given value .double, float (C99) and long double (C99) |
trunc truncf truncl | rounds to nearest integer not greater in magnitude than the given value (C99) |
round lround llround | rounds to nearest integer, rounding away from zero in halfway cases (C99) |
nearbyint nearbyintf nearbyintl | rounds to an integer using current rounding mode (C99) |
rint rintf rintl lrint lrintf lrintl llrint llrintf llrintl | rounds to an integer using current rounding mode with exception if the result differs (C99) |
Floating-point manipulation functions:
frexp frexpf frexpl | breaks a number into significand and a power of 2 .double, float (C99) and long double (C99) |
ldexp ldexpf ldexpl | multiplies a number by 2 raised to a power .double, float (C99) and long double (C99) |
modf modff modfl | breaks a number into integer and fractional parts .double, float (C99) and long double (C99) |
scalbn scalbnf scalbnl scalbln scalblnf scalblnl | computes efficiently a number times FLT_RADIX raised to a power (C99) |
ilogb ilogbf ilogbl | extracts exponent of the given number (C99) |
logb logbf logbl | extracts exponent of the given number (C99) |
nextafter nextafterf nextafterl nexttoward nexttowardf nexttowardl | determines next representable floating-point value towards the given value (C99) |
copysign copysignf copysignl | produces a value with the magnitude of a given value and the sign of another given value (C99) |
Basic operations:
fabs fabsf fabsl | computes absolute value of a floating-point value (|x|). double, float (C99) and long double (C99) |
fmod fmodf fmodl | computes remainder of the floating-point division operation . double, float (C99) and long double (C99) |
remainder remainderf remainderl | computes signed remainder of the floating-point division operation (C99) |
remquo remquof remquol | computes signed remainder as well as the three last bits of the division operation (C99) |
fma fmaf fmal | computes fused multiply-add operation (C99) |
fmax fmaxf fmaxl | determines larger of two floating-point values (C99) |
fmin fminf fminl | determines smaller of two floating-point values (C99) |
fdim fdimf fdiml | determines positive difference of two floating-point values (max(0, x-y)) (C99) |
nan nanf nanl | returns a NaN (not-a-number) (C99) |
Classification and comparison:
fpclassify | classifies the given floating-point value (C99) |
isfinite | checks if the given number has finite value (C99) |
isinf | checks if the given number is infinite (C99) |
isnan | checks if the given number is NaN (C99) |
isnormal | checks if the given number is normal (C99) |
signbit | checks if the given number is negative (C99) |
isgreater | checks if the first floating-point argument is greater than the second (C99) |
isgreaterequal | checks if the first floating-point argument is greater or equal than the second (C99) |
isless | checks if the first floating-point argument is less than the second (C99) |
islessequal | checks if the first floating-point argument is less or equal than the second (C99) |
islessgreater | checks if the first floating-point argument is less or greater than the second (C99) |
isunordered | checks if two floating-point values are unordered (C99) |
The <math.h> header shall define the following types:
float_t | most efficient floating-point type at least as wide as float (C99) |
double_t | most efficient floating-point type at least as wide as double (C99) |
Related topics:
<float.h> | <inttypes.h> | <iso646.h> | <limits.h> | <locale.h> | Standard Library in C
List of topics: C Programming
No comments:
Post a Comment