math.h

    MATH

    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

    Function Name

    Description

    (double x)

    double 

    Calculates the arc cosine of the double value x.

    acosf (float x)

    float 

    Calculates the arc cosine of the float value x.

    (long double x)

    long double 

    Calculates the arc cosine of the long double value x.

    acosh (double x)

    double 

    Calculates the inverse hyperbolic cosine of the double value x.

    (float x)

    float 

    Calculates the inverse hyperbolic cosine of float value x.

    acoshl (long double x)

    long double 

    Calculates the inverse hyperbolic cosine of the long double value x.

    (double x)

    double 

    Calculates the arc sine of the double value x.

    asinf (float x)

    float 

    Calculates the arc sine of the float value x.

    (long double x)

    long double 

    Calculates the arc sine of the long double value x.

    asinh (double x)

    double 

    Calculates the inverse hyperbolic sine of the double value x.

    (float x)

    float 

    Calculates the inverse hyperbolic sine of the float value x.

    asinhl (long double x)

    long double 

    Calculates the inverse hyperbolic sine of the long double value x.

    (double x)

    double 

    Calculates the arc tangent of the double value x.

    atanf (float x)

    float 

    Calculates the arc tangent of the float value x.

    (long double x)

    long double 

    Calculates the arc tangent of the long double value x.

    atan2 (double y, double x)

    double 

    Calculates the arc tangent of two double values x and y.

    (float y, float x)

    float 

    Calculates the arc tangent of two float values x and y.

    atan2l (long double y, long double x)

    long double 

    Calculates the arc tangent of two long double values x and y.

    (double x)

    double 

    Calculates the inverse hyperbolic tangent of the double value x.

    atanhf (float x)

    float 

    Calculates the inverse hyperbolic tangent of the float value x.

    (long double x)

    long double 

    Calculates the inverse hyperbolic tangent of the long double value x.

    cbrt (double x)

    double 

    Calculates the cube root of the double value x.

    (float x)

    float 

    Calculates the cube root of the float value x.

    cbrtl (long double x)

    long double 

    Calculates the cube root of the long double value x.

    (double x)

    double 

    Calculates the minimum integer greater than or equal to the double value x.

    ceilf (float x)

    float 

    Calculates the minimum integer greater than or equal to the float value x.

    (long double x)

    long double 

    Calculates the minimum integer greater than or equal to the long double value x.

    copysign (double x, double y)

    double 

    Generates a value by combining the magnitude of the double value x and the sign of the double value y.

    (float x, float y)

    float 

    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)

    long double 

    Generates a value by combining the magnitude of the long double value x and the sign of the long double value y.

    (double x)

    double 

    Calculates the cosine of the double value x.

    cosf (float x)

    float 

    Calculates the cosine of the float value x.

    (long double x)

    long double 

    Calculates the cosine of the long double value x.

    cosh (double x)

    double 

    Calculates the hyperbolic cosine of the double value x.

    (float x)

    float 

    Calculates the hyperbolic cosine of the float value x.

    coshl (long double x)

    long double 

    Calculates the hyperbolic cosine of the long double value x.

    (double x)

    double 

    Calculates the error function of the double value x.

    erff (float x)

    float 

    Calculates the error function of the float value x.

    (long double x)

    long double 

    Calculates the error function of the long double value x.

    erfc (double x)

    double 

    Calculates the complementary error function of the double value x.

    (float x)

    float 

    Calculates the complementary error function of the float value x.

    erfcl (long double x)

    long double 

    Calculates the complementary error function of the long double value x.

    (double x)

    double 

    Calculates the base-e exponential function of the double value x.

    expf (float x)

    float 

    Calculates the base-e exponential function of the float value x.

    (long double x)

    long double 

    Calculates the base-e exponential function of the long double value x.

    exp2 (double x)

    double 

    (float x)

    float 

    Calculates the base-2 exponential function of the float value x.

    exp2l (long double x)

    long double 

    Calculates the base-2 exponential function of the long double value x.

    (double x)

    double 

    Calculates e raised to the power of the double value x minus one, that is, (e^x)-1.

    expm1f (float x)

    float 

    Calculates e raised to the power of the float value x minus one.

    (long double x)

    long double 

    Calculates e raised to the power of the long double value x minus one.

    fabs (double x)

    double 

    Calculates the absolute value of the double value x.

    (float x)

    float 

    Calculates the absolute value of the float value x.

    fabsl (long double x)

    long double 

    Calculates the absolute value of the long double value x.

    (double x, double y)

    double 

    Calculates the positive difference between the double value x and y.

    fdimf (float x, float y)

    float 

    Calculates the positive difference between the float value x and y.

    (long double x, long double y)

    long double 

    Calculates the positive difference between the long double value x and y.

    floor (double x)

    double 

    Obtains the largest integer less than or equal to the double value x.

    (float x)

    float 

    Obtains the largest integer less than or equal to the float value x.

    floorl (long double x)

    long double 

    Obtains the largest integer less than or equal to the long double value x.

    (double x, double y, double z)

    double 

    Calculates the value of xy+z and rounds the result up.

    fmaf (float x, float y, float z)

    float 

    Calculates the value of xy+z and rounds the result up.

    (long double x, long double y, long double z)

    long double 

    Calculates the value of xy+z and rounds the result up.

    fmax (double x, double y)

    double 

    Obtains the larger value of two double values x and y.

    (float x, float y)

    float 

    Obtains the larger value of two float values x and y.

    fmaxl (long double x, long double y)

    long double 

    Obtains the larger value of two long double values x and y.

    (double x, double y)

    double 

    Obtains the smaller value of two double values x and y.

    fminf (float x, float y)

    float 

    Obtains the smaller value of two float values x and y.

    (long double x, long double y)

    long double 

    Obtains the smaller value of two long double values x and y.

    fmod (double x, double y)

    double 

    Calculates the remainder of the double value x divided by the double value y.

    (float x, float y)

    float 

    Calculates the remainder of the float value x divided by the float value y.

    fmodl (long double x, long double y)

    long double 

    Calculates the remainder of the long double value x divided by the long double value y.

    (double x, int exp)

    double 

    Decomposes the double value x into a significand and an integral exponent for 2.

    (float x, int exp)

    float 

    Decomposes float value x into a binary significand and an integral exponent for 2.

    (long double x, int exp)

    long double 

    Decomposes long double value x into a binary significand and an integral exponent for 2.

    (double x, double y)

    double 

    Calculates the hypotenuse of a right triangle whose legs are x and y.

    hypotf (float x, float y)

    float 

    Calculates the hypotenuse of a right triangle whose legs are x and y.

    (long double x, long double y)

    long double 

    Calculates the hypotenuse of a right triangle whose legs are x and y.

    ilogb (double x)

    int 

    Obtains the integral part of the logarithm of double value x.

    (float x)

    int 

    Obtains the integral part of the logarithm of float value x.

    ilogbl (long double x)

    int 

    Obtains the integral part of the logarithm of the long double value x.

    (double x, int exp)

    double 

    Multiplies the double value x by 2 raised to the power of exp.

    (float x, int exp)

    float 

    Multiplies the float value x by 2 raised to the power of exp.

    (long double x, int exp)

    long double 

    Multiplies the long double value x by 2 raised to the power of exp.

    (double x)

    double 

    Calculates the natural logarithm of the absolute value of the gamma function of the double value x.

    lgammaf (float x)

    float 

    Calculates the natural logarithm of the absolute value of the gamma function of the float value x.

    (long double x)

    long double 

    Calculates the natural logarithm of the absolute value of the gamma function of the long double value x.

    llrint (double x)

    long long int 

    Rounds double value x to the nearest integer.

    (float x)

    long long int 

    Rounds float value x to the nearest integer.

    llrintl (long double x)

    long long int 

    Rounds long double value x to the nearest integer.

    (double x)

    long long int 

    Rounds double value x to the nearest integer, rounding away from 0.

    llroundf (float x)

    long long int 

    Rounds float value x to the nearest integer, rounding away from 0.

    (long double x)

    long long int 

    Rounds long double value x to the nearest integer, rounding away from 0.

    log (double x)

    double 

    Calculates the natural logarithm of the double value x.

    (float x)

    float 

    Calculates the natural logarithm of the float value x.

    logl (long double x)

    long double 

    Calculates the natural logarithm of the long double value x.

    (double x)

    double 

    Calculates the common logarithm (logarithm with base 10) of the double value x.

    log10f (float x)

    float 

    Calculates the common logarithm (logarithm with base 10) of the float value x.

    (long double x)

    long double 

    Calculates the common logarithm (logarithm with base 10) of the long double value x.

    log1p (double x)

    double 

    Calculates the natural logarithm of one plus the double value x.

    (float x)

    float 

    Calculates the natural logarithm of one plus the float value x.

    log1pl (long double x)

    long double 

    Calculates the natural logarithm of one plus the long double value x.

    (double x)

    double 

    Calculates the binary logarithm (logarithm with base 2) of the double value x.

    log2f (float x)

    float 

    Calculates the binary logarithm (logarithm with base 2) of the float value x.

    (long double x)

    long double 

    Calculates the binary logarithm (logarithm with base 2) of the long double value x.

    logb (double x)

    double 

    Calculates the logarithm of the absolute value of the double value x.

    (float x)

    float 

    Calculates the logarithm of the absolute value of the float value x.

    logbl (long double x)

    long double 

    Calculates the logarithm of the absolute value of the long double value x.

    (double x)

    long int 

    Rounds the double value x to the nearest integer.

    lrintf (float x)

    long int 

    Rounds the float value x to the nearest integer.

    (long double x)

    long int 

    Rounds the long double value x to the nearest integer.

    lround (double x)

    long int 

    Rounds double value x to the nearest integer, rounding away from 0.

    (float x)

    long int 

    Rounds the float value x to the nearest integer, rounding away from 0.

    lroundl (long double x)

    long int 

    Rounds the long double value x to the nearest integer, rounding away from 0.

    (double x, double iptr)

    double 

    Breaks the double value x into a signed integral and a fractional part.

    modff (float x, float iptr)

    float 

    Breaks the float value x into a signed integral and a fractional part.

    (long double x, long double iptr)

    long double 

    Breaks the long double value x into a signed integral and a fractional part.

    nan (const char tagp)

    double 

    Obtains a quiet NaN value of the double type.

    (const char tagp)

    float 

    Obtains a quiet NaN value of the float type.

    nanl (const char tagp)

    long double 

    Obtains a quiet NaN value of the long double type.

    (double x)

    double 

    Rounds the double value x to an integer in floating-point format.

    nearbyintf (float x)

    float 

    Rounds the float value x to an integer in floating-point format.

    (long double x)

    long double 

    Rounds the long double value x to an integer in floating-point format.

    double 

    Obtains the next representable value following the double value x in the direction of the double value y.

    nextafterf (float x, float y)

    float 

    Obtains the next representable value following the float value x in the direction of the float value y.

    (long double x, long double y)

    long double 

    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)

    double 

    Obtains the next representable value following the double value x in the direction of the long double value y.

    (float x, long double y)

    float 

    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)

    long double 

    Obtains the next representable value following the long double value x in the direction of the long double value y.

    (double x, double y)

    double 

    Obtains the double value x raised to the power of the double value y.

    powf (float x, float y)

    float 

    Obtains the float value x raised to the power of the float value y.

    (float x)

    float 

    Calculates the xth power of 10.

    powl (long double x, long double y)

    long double 

    Obtains the long double value x raised to the power of the long double value y.

    (long double x)

    long double 

    Calculates the xth power of 10.

    remainder (double x, double y)

    double 

    Calculates the remainder of the double value x divided by the double value y.

    (float x, float y)

    float 

    Calculates the remainder of the float value x divided by the float value y.

    remainderl (long double x, long double y)

    long double 

    Calculates the remainder of the long double value x divided by the long double value y.

    (double x, double y, int quo)

    double 

    Calculates the quotient and remainder of the double value x divided by the double value y.

    remquof (float x, float y, int quo)

    float 

    Calculates the quotient and remainder of the float value x divided by the float value y.

    (long double x, long double y, int quo)

    long double 

    Calculates the quotient and remainder of the long double value x divided by the long double value y.

    rint (double x)

    double 

    Rounds the double value x to the nearest integer.

    (float x)

    float 

    Rounds the float value x to the nearest integer.

    rintl (long double x)

    long double 

    Rounds the long double value x to the nearest integer.

    (double x)

    double 

    Rounds the double value x to the nearest integer, rounding away from 0.

    roundf (float x)

    float 

    Rounds the float value x to the nearest integer, rounding away from 0.

    (long double x)

    long double 

    Rounds the long double value x to the nearest integer, rounding away from 0.

    scalbln (double x, long int )

    double 

    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 )

    float 

    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 )

    long double 

    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 )

    double 

    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 )

    float 

    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 )

    long double 

    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)

    double 

    Calculates the sine of the double value x.

    (float x)

    float 

    Calculates the sine of the float value x.

    sinl (long double x)

    long double 

    Calculates the sine of the long double value x.

    (double x)

    double 

    Calculates the hyperbolic sine of the double value x.

    sinhf (float x)

    float 

    Calculates the hyperbolic sine of the float value x.

    (long double x)

    long double 

    Calculates the hyperbolic sine of the long double value x.

    sqrt (double x)

    double 

    Calculates the square root of double value x.

    (float x)

    float 

    Calculates the square root of the float value x.

    sqrtl (long double x)

    long double 

    Calculates the square root of the long double value x.

    (double x)

    double 

    Calculates the tangent of the double value x.

    tanf (float x)

    float 

    Calculates the tangent of the float value x.

    (long double x)

    long double 

    Calculates the tangent of the long double value x.

    tanh (double x)

    double 

    Calculates the hyperbolic tangent of the double value x.

    (float x)

    float 

    Calculates the hyperbolic tangent of the float value x.

    tanhl (long double x)

    long double 

    Calculates the hyperbolic tangent of the long double value x.

    (double x)

    double 

    Calculates the gamma function of the double value x.

    tgammaf (float x)

    float 

    Calculates the gamma function of the float value x.

    (long double x)

    long double 

    Calculates the gamma function of the long double value x.

    trunc (double x)

    double 

    Obtains the nearest integer whose absolute value is less than or equal to the absolute value of the double value x.

    (float x)

    float 

    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)

    long double 

    Obtains the nearest integer whose absolute value is less than or equal to the absolute value of the long double value x.

    (double x)

    double 

    Calculates the Bessel function of the first kind of order 0 for the double value x.

    j1 (double x)

    double 

    Calculates the Bessel function of the first kind of order 1 for the double value x.

    (int n, double x)

    double 

    Calculates the Bessel function of the first kind of order n for the double value x.

    y0 (double x)

    double 

    Calculates the Bessel function of the second kind of order 0 for the double value x.

    (double x)

    double 

    Calculates the Bessel function of the second kind of order 1 for the double value x.

    yn (int n, double x)

    double 

    Calculates the Bessel function of the second kind of order n for the double value x.

    (double x)

    int 

    Checks whether the double value x is an infinity or a NaN value.

    finitef (float x)

    int 

    Checks whether the float value x is an infinity or a NaN value.

    (double x, double exp)

    double 

    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)

    float 

    Multiplies the float value x by FLT_RADIX raised to the power of the float value exp, that is, xFLT_RADIX^exp.

    (double x)

    double 

    Obtains the significand of the double value x scaled to the range [1,2).

    significandf (float x)

    float 

    Obtains the significand of the float value x scaled to the range [1,2).

    (float x)

    float 

    Calculates the Bessel function of the first kind of order 0 for the float value x.

    j1f (float x)

    float 

    Calculates the Bessel function of the first kind of order 1 for the float value x.

    (int n, float x)

    float 

    Calculates the Bessel function of the first kind of order n for the float value x.

    y0f (float x)

    float 

    Calculates the Bessel function of the second kind of order 0 for the float value x.

    (float x)

    float 

    Calculates the Bessel function of the second kind of order 1 for the float value x.

    ynf (int n, float x)

    float 

    Calculates the Bessel function of the second kind of order n for the float value x.

    (long double x, int signp)

    long double 

    Calculates the natural logarithm of the absolute value of the gamma function of the double value x.

    sincos (double x, double , double cos)

    void 

    Calculates the sine and cosine of the double value x.

    (float x, float sin, float )

    void 

    Calculates the sine and cosine of the float value x.

    sincosl (long double x, long double , long double cos)

    void 

    Calculates the sine and cosine of the long double value x.

    (double x)

    double 

    Calculates the base-10 exponential function of the double value x.

    exp10f (float x)

    float 

    Calculates the base-10 exponential function of the float value x.

    (long double x)

    long double 

    Calculates the base-10 exponential function of the long double value x.

    pow10 (double x)

    double 

    Calculates the value of 10 raised to the power x, which is a double value.

    (float x)

    float 

    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.