math.h
Description:
Provides common math functions.
You can use the functions provided in this file to perform mathematical operations during development. The functions include trigonometric, inverse trigonometric, hyperbolic, inverse hyperbolic, rounding, exponential, logarithmic, and Bessel functions. When using these functions, pay attention to the value range of their input parameters.
Since:
1.0
Version:
1.0
acosf (float x) |
|
acosh (double x) |
Calculates the inverse hyperbolic cosine of the double value x. |
acoshl (long double x) |
Calculates the inverse hyperbolic cosine of the long double value x. |
asinf (float x) |
|
asinh (double x) |
Calculates the inverse hyperbolic sine of the double value x. |
Calculates the inverse hyperbolic sine of the float value x. |
|
asinhl (long double x) |
Calculates the inverse hyperbolic sine of the long double value x. |
atanf (float x) |
|
atan2 (double y, double x) |
|
atan2l (long double y, long double x) |
Calculates the arc tangent of two long double values x and y. |
Calculates the inverse hyperbolic tangent of the double value x. |
|
atanhf (float x) |
Calculates the inverse hyperbolic tangent of the float value x. |
Calculates the inverse hyperbolic tangent of the long double value x. |
|
cbrt (double x) |
|
cbrtl (long double x) |
|
Calculates the minimum integer greater than or equal to the double value x. |
|
ceilf (float x) |
Calculates the minimum integer greater than or equal to the float value x. |
Calculates the minimum integer greater than or equal to the long double value x. |
|
copysign (double x, double y) |
Generates a value by combining the magnitude of the double value x and the sign of the double value y. |
Generates a value by combining the magnitude of the float value x and the sign of the float value y. |
|
copysignl (long double x, long double y) |
Generates a value by combining the magnitude of the long double value x and the sign of the long double value y. |
cosf (float x) |
|
cosh (double x) |
|
coshl (long double x) |
Calculates the hyperbolic cosine of the long double value x. |
erff (float x) |
|
erfc (double x) |
Calculates the complementary error function of the double value x. |
Calculates the complementary error function of the float value x. |
|
erfcl (long double x) |
Calculates the complementary error function of the long double value x. |
Calculates the base-e exponential function of the double value x. |
|
expf (float x) |
Calculates the base-e exponential function of the float value x. |
Calculates the base-e exponential function of the long double value x. |
|
exp2 (double x) |
|
Calculates the base-2 exponential function of the float value x. |
|
exp2l (long double x) |
Calculates the base-2 exponential function of the long double value x. |
Calculates e raised to the power of the double value x minus one, that is, (e^x)-1. |
|
expm1f (float x) |
Calculates e raised to the power of the float value x minus one. |
Calculates e raised to the power of the long double value x minus one. |
|
fabs (double x) |
|
fabsl (long double x) |
|
Calculates the positive difference between the double value x and y. |
|
fdimf (float x, float y) |
Calculates the positive difference between the float value x and y. |
Calculates the positive difference between the long double value x and y. |
|
floor (double x) |
Obtains the largest integer less than or equal to the double value x. |
Obtains the largest integer less than or equal to the float value x. |
|
floorl (long double x) |
Obtains the largest integer less than or equal to the long double value x. |
fmaf (float x, float y, float z) |
|
fmax (double x, double y) |
|
fmaxl (long double x, long double y) |
|
fminf (float x, float y) |
|
Obtains the smaller value of two long double values x and y. |
|
fmod (double x, double y) |
Calculates the remainder of the double value x divided by the double value y. |
Calculates the remainder of the float value x divided by the float value y. |
|
fmodl (long double x, long double y) |
Calculates the remainder of the long double value x divided by the long double value y. |
(double x, int exp) |
Decomposes the double value x into a significand and an integral exponent for 2. |
(float x, int exp) |
Decomposes float value x into a binary significand and an integral exponent for 2. |
(long double x, int exp) |
Decomposes long double value x into a binary significand and an integral exponent for 2. |
Calculates the hypotenuse of a right triangle whose legs are x and y. |
|
hypotf (float x, float y) |
Calculates the hypotenuse of a right triangle whose legs are x and y. |
Calculates the hypotenuse of a right triangle whose legs are x and y. |
|
ilogb (double x) |
Obtains the integral part of the logarithm of double value x. |
Obtains the integral part of the logarithm of float value x. |
|
ilogbl (long double x) |
Obtains the integral part of the logarithm of the long double value x. |
(double x, int exp) |
Multiplies the double value x by 2 raised to the power of exp. |
(float x, int exp) |
Multiplies the float value x by 2 raised to the power of exp. |
(long double x, int exp) |
Multiplies the long double value x by 2 raised to the power of exp. |
Calculates the natural logarithm of the absolute value of the gamma function of the double value x. |
|
lgammaf (float x) |
Calculates the natural logarithm of the absolute value of the gamma function of the float value x. |
Calculates the natural logarithm of the absolute value of the gamma function of the long double value x. |
|
llrint (double x) |
|
llrintl (long double x) |
|
Rounds double value x to the nearest integer, rounding away from 0. |
|
llroundf (float x) |
Rounds float value x to the nearest integer, rounding away from 0. |
Rounds long double value x to the nearest integer, rounding away from 0. |
|
log (double x) |
|
logl (long double x) |
Calculates the natural logarithm of the long double value x. |
Calculates the common logarithm (logarithm with base 10) of the double value x. |
|
log10f (float x) |
Calculates the common logarithm (logarithm with base 10) of the float value x. |
Calculates the common logarithm (logarithm with base 10) of the long double value x. |
|
log1p (double x) |
Calculates the natural logarithm of one plus the double value x. |
Calculates the natural logarithm of one plus the float value x. |
|
log1pl (long double x) |
Calculates the natural logarithm of one plus the long double value x. |
Calculates the binary logarithm (logarithm with base 2) of the double value x. |
|
log2f (float x) |
Calculates the binary logarithm (logarithm with base 2) of the float value x. |
Calculates the binary logarithm (logarithm with base 2) of the long double value x. |
|
logb (double x) |
Calculates the logarithm of the absolute value of the double value x. |
Calculates the logarithm of the absolute value of the float value x. |
|
logbl (long double x) |
Calculates the logarithm of the absolute value of the long double value x. |
lrintf (float x) |
|
lround (double x) |
Rounds double value x to the nearest integer, rounding away from 0. |
Rounds the float value x to the nearest integer, rounding away from 0. |
|
lroundl (long double x) |
Rounds the long double value x to the nearest integer, rounding away from 0. |
Breaks the double value x into a signed integral and a fractional part. |
|
modff (float x, float iptr) |
Breaks the float value x into a signed integral and a fractional part. |
Breaks the long double value x into a signed integral and a fractional part. |
|
nan (const char tagp) |
|
nanl (const char tagp) |
|
Rounds the double value x to an integer in floating-point format. |
|
nearbyintf (float x) |
Rounds the float value x to an integer in floating-point format. |
Rounds the long double value x to an integer in floating-point format. |
|
Obtains the next representable value following the double value x in the direction of the double value y. |
|
nextafterf (float x, float y) |
Obtains the next representable value following the float value x in the direction of the float value y. |
Obtains the next representable value following the long double value x in the direction of the long double value y. |
|
nexttoward (double x, long double y) |
Obtains the next representable value following the double value x in the direction of the long double value y. |
Obtains the next representable value following the float value x in the direction of the long double value y. |
|
nexttowardl (long double x, long double y) |
Obtains the next representable value following the long double value x in the direction of the long double value y. |
Obtains the double value x raised to the power of the double value y. |
|
powf (float x, float y) |
Obtains the float value x raised to the power of the float value y. |
powl (long double x, long double y) |
Obtains the long double value x raised to the power of the long double value y. |
remainder (double x, double y) |
Calculates the remainder of the double value x divided by the double value y. |
Calculates the remainder of the float value x divided by the float value y. |
|
remainderl (long double x, long double y) |
Calculates the remainder of the long double value x divided by the long double value y. |
Calculates the quotient and remainder of the double value x divided by the double value y. |
|
remquof (float x, float y, int quo) |
Calculates the quotient and remainder of the float value x divided by the float value y. |
Calculates the quotient and remainder of the long double value x divided by the long double value y. |
|
rint (double x) |
|
rintl (long double x) |
|
Rounds the double value x to the nearest integer, rounding away from 0. |
|
roundf (float x) |
Rounds the float value x to the nearest integer, rounding away from 0. |
Rounds the long double value x to the nearest integer, rounding away from 0. |
|
scalbln (double x, long int ) |
Multiplies the double value x by FLT_RADIX raised to the power of the long int value exp, that is, x(FLT_RADIX)^exp. |
scalblnf (float x, long int ) |
Multiplies the float value x by FLT_RADIX raised to the power of the long int value exp, that is, x(FLT_RADIX)^exp. |
scalblnl (long double x, long int ) |
Multiplies the long double value x by FLT_RADIX raised to the power of the long int value exp, that is, x(FLT_RADIX)^exp. |
scalbn (double x, int ) |
Multiplies the double value x by FLT_RADIX raised to the power of the int value exp, that is, x(FLT_RADIX)^exp. |
scalbnf (float x, int ) |
Multiplies the float value x by FLT_RADIX raised to the power of the int value exp, that is, x(FLT_RADIX)^exp. |
scalbnl (long double x, int ) |
Multiplies the long double value x by FLT_RADIX raised to the power of the int value exp, that is, x(FLT_RADIX)^exp. |
sin (double x) |
|
sinl (long double x) |
|
sinhf (float x) |
|
sqrt (double x) |
|
sqrtl (long double x) |
|
tanf (float x) |
|
tanh (double x) |
|
tanhl (long double x) |
Calculates the hyperbolic tangent of the long double value x. |
tgammaf (float x) |
|
trunc (double x) |
Obtains the nearest integer whose absolute value is less than or equal to the absolute value of the double value x. |
Obtains the nearest integer whose absolute value is less than or equal to the absolute value of the float value x. |
|
truncl (long double x) |
Obtains the nearest integer whose absolute value is less than or equal to the absolute value of the long double value x. |
Calculates the Bessel function of the first kind of order 0 for the double value x. |
|
j1 (double x) |
Calculates the Bessel function of the first kind of order 1 for the double value x. |
Calculates the Bessel function of the first kind of order n for the double value x. |
|
y0 (double x) |
Calculates the Bessel function of the second kind of order 0 for the double value x. |
Calculates the Bessel function of the second kind of order 1 for the double value x. |
|
yn (int n, double x) |
Calculates the Bessel function of the second kind of order n for the double value x. |
Checks whether the double value x is an infinity or a NaN value. |
|
finitef (float x) |
Checks whether the float value x is an infinity or a NaN value. |
(double x, double exp) |
Multiplies the double value x by FLT_RADIX raised to the power of the double value exp, that is, xFLT_RADIX^exp. |
(float x, float exp) |
Multiplies the float value x by FLT_RADIX raised to the power of the float value exp, that is, xFLT_RADIX^exp. |
Obtains the significand of the double value x scaled to the range [1,2). |
|
significandf (float x) |
Obtains the significand of the float value x scaled to the range [1,2). |
Calculates the Bessel function of the first kind of order 0 for the float value x. |
|
j1f (float x) |
Calculates the Bessel function of the first kind of order 1 for the float value x. |
Calculates the Bessel function of the first kind of order n for the float value x. |
|
y0f (float x) |
Calculates the Bessel function of the second kind of order 0 for the float value x. |
Calculates the Bessel function of the second kind of order 1 for the float value x. |
|
ynf (int n, float x) |
Calculates the Bessel function of the second kind of order n for the float value x. |
Calculates the natural logarithm of the absolute value of the gamma function of the double value x. |
|
(float x, float sin, float ) |
|
Calculates the base-10 exponential function of the double value x. |
|
exp10f (float x) |
Calculates the base-10 exponential function of the float value x. |
Calculates the base-10 exponential function of the long double value x. |
|
pow10 (double x) |
Calculates the value of 10 raised to the power x, which is a double value. |
Calculates the value of 10 raised to the power x, which is a float value. |
|
pow10l (long double x) |
Calculates the value of 10 raised to the power x, which is a long double value. |