AVR-LibC  2.3.0
Standard C library for AVR-GCC
 

AVR-LibC Manual

AVR-LibC Sources

Main Page

User Manual

Lib­rary Refe­rence

FAQ

Exam­ple Pro­jects

Index

Loading...
Searching...
No Matches
Macros | Functions
<math.h>: Mathematics

Macros

#define M_E   2.7182818284590452354
 
#define M_LOG2E   1.4426950408889634074
 
#define M_LOG10E   0.43429448190325182765
 
#define M_LN2   0.69314718055994530942
 
#define M_LN10   2.30258509299404568402
 
#define M_PI   3.14159265358979323846
 
#define M_PI_2   1.57079632679489661923
 
#define M_PI_4   0.78539816339744830962
 
#define M_1_PI   0.31830988618379067154
 
#define M_2_PI   0.63661977236758134308
 
#define M_2_SQRTPI   1.12837916709551257390
 
#define M_SQRT2   1.41421356237309504880
 
#define M_SQRT1_2   0.70710678118654752440
 
#define NAN   __builtin_nan("")
 
#define nanf(__tag)   __builtin_nanf(__tag)
 
#define nan(__tag)   __builtin_nan(__tag)
 
#define nanl(__tag)   __builtin_nanl(__tag)
 
#define INFINITY   __builtin_inff()
 
#define HUGE_VALF   __builtin_huge_valf()
 
#define HUGE_VAL   __builtin_huge_val()
 
#define HUGE_VALL   __builtin_huge_vall()
 

Functions

float cosf (float x)
 
double cos (double x)
 
long double cosl (long double x)
 
float sinf (float x)
 
double sin (double x)
 
long double sinl (long double x)
 
void sincosf (float x, float *psin, float *pcos)
 
void sincos (double x, double *psin, double *pcos)
 
void sincosl (long double x, long double *psin, long double *pcos)
 
float tanf (float x)
 
double tan (double x)
 
long double tanl (long double x)
 
float fabsf (float __x)
 
double fabs (double __x)
 
long double fabsl (long double __x)
 
float fmodf (float x, float y)
 
double fmod (double x, double y)
 
long double fmodl (long double x, long double y)
 
float modff (float x, float *iptr)
 
double modf (double x, double *iptr)
 
long double modfl (long double x, long double *iptr)
 
float sqrtf (float x)
 
double sqrt (double x)
 
long double sqrtl (long double x)
 
float cbrtf (float x)
 
double cbrt (double x)
 
long double cbrtl (long double x)
 
float hypotf (float x, float y)
 
double hypot (double x, double y)
 
long double hypotl (long double x, long double y)
 
float floorf (float x)
 
double floor (double x)
 
long double floorl (long double x)
 
float ceilf (float x)
 
double ceil (double x)
 
long double ceill (long double x)
 
float frexpf (float x, int *pexp)
 
double frexp (double x, int *pexp)
 
long double frexpl (long double x, int *pexp)
 
float ldexpf (float x, int iexp)
 
double ldexp (double x, int iexp)
 
long double ldexpl (long double x, int iexp)
 
float expf (float x)
 
double exp (double x)
 
long double expl (long double x)
 
float coshf (float x)
 
double cosh (double x)
 
long double coshl (long double x)
 
float sinhf (float x)
 
double sinh (double x)
 
long double sinhl (long double x)
 
float tanhf (float x)
 
double tanh (double x)
 
long double tanhl (long double x)
 
float acosf (float x)
 
double acos (double x)
 
long double acosl (long double x)
 
float asinf (float x)
 
double asin (double x)
 
long double asinl (long double x)
 
float atanf (float x)
 
double atan (double x)
 
long double atanl (long double x)
 
float atan2f (float y, float x)
 
double atan2 (double y, double x)
 
long double atan2l (long double y, long double x)
 
float logf (float x)
 
double log (double x)
 
long double logl (long double x)
 
float log10f (float x)
 
double log10 (double x)
 
long double log10l (long double x)
 
float log2f (float x)
 
double log2 (double x)
 
long double log2l (long double x)
 
float powf (float x, float y)
 
double pow (double x, double y)
 
long double powl (long double x, long double y)
 
int isnanf (float x)
 
int isnan (double x)
 
int isnanl (long double x)
 
int isinff (float x)
 
int isinf (double x)
 
int isinfl (long double x)
 
static int isfinitef (float __x)
 
static int isfinite (double __x)
 
static int isfinitel (long double __x)
 
static float copysignf (float __x, float __y)
 
static double copysign (double __x, double __y)
 
static long double copysignl (long double __x, long double __y)
 
int signbitf (float x)
 
int signbit (double x)
 
int signbitl (long double x)
 
float fdimf (float x, float y)
 
double fdim (double x, double y)
 
long double fdiml (long double x, long double y)
 
float fmaf (float x, float y, float z)
 
double fma (double x, double y, double z)
 
long double fmal (long double x, long double y, long double z)
 
float fmaxf (float x, float y)
 
double fmax (double x, double y)
 
long double fmaxl (long double x, long double y)
 
float fminf (float x, float y)
 
double fmin (double x, double y)
 
long double fminl (long double x, long double y)
 
float truncf (float x)
 
double trunc (double x)
 
long double truncl (long double x)
 
float roundf (float x)
 
double round (double x)
 
long double roundl (long double x)
 
long lroundf (float x)
 
long lround (double x)
 
long lroundl (long double x)
 
long lrintf (float x)
 
long lrint (double x)
 
long lrintl (long double x)
 

Non-Standard Math Functions

float squaref (float x)
 
double square (double x)
 
long double squarel (long double x)
 

Detailed Description

#include <math.h>

This header file declares basic mathematics constants and functions.

Notes:

See also some benchmarks for IEEE single and IEEE double.

Macro Definition Documentation

◆ HUGE_VAL

#define HUGE_VAL   __builtin_huge_val()

double infinity constant.

◆ HUGE_VALF

#define HUGE_VALF   __builtin_huge_valf()

float infinity constant.

◆ HUGE_VALL

#define HUGE_VALL   __builtin_huge_vall()

long double infinity constant.

◆ INFINITY

#define INFINITY   __builtin_inff()

float infinity constant.

◆ M_1_PI

#define M_1_PI   0.31830988618379067154

The constant 1/π.

◆ M_2_PI

#define M_2_PI   0.63661977236758134308

The constant 2/π.

◆ M_2_SQRTPI

#define M_2_SQRTPI   1.12837916709551257390

The constant 2/sqrt(π).

◆ M_E

#define M_E   2.7182818284590452354

The constant Euler's number e.

◆ M_LN10

#define M_LN10   2.30258509299404568402

The constant natural logarithm of 10.

◆ M_LN2

#define M_LN2   0.69314718055994530942

The constant natural logarithm of 2.

◆ M_LOG10E

#define M_LOG10E   0.43429448190325182765

The constant logarithm of Euler's number e to base 10.

◆ M_LOG2E

#define M_LOG2E   1.4426950408889634074

The constant logarithm of Euler's number e to base 2.

◆ M_PI

#define M_PI   3.14159265358979323846

The constant π.

◆ M_PI_2

#define M_PI_2   1.57079632679489661923

The constant π/2.

◆ M_PI_4

#define M_PI_4   0.78539816339744830962

The constant π/4.

◆ M_SQRT1_2

#define M_SQRT1_2   0.70710678118654752440

The constant 1/sqrt(2).

◆ M_SQRT2

#define M_SQRT2   1.41421356237309504880

The square root of 2.

◆ NAN

#define NAN   __builtin_nan("")

The double representation of a constant quiet NaN.

◆ nan

#define nan (   __tag)    __builtin_nan(__tag)

The double representation of a constant quiet NaN. __tag is a string constant like "" or "123".

◆ nanf

#define nanf (   __tag)    __builtin_nanf(__tag)

The float representation of a constant quiet NaN. __tag is a string constant like "" or "123".

◆ nanl

#define nanl (   __tag)    __builtin_nanl(__tag)

The long double representation of a constant quiet NaN. __tag is a string constant like "" or "123".

Function Documentation

◆ acos()

double acos ( double  x)

The acos() function computes the principal value of the arc cosine of x. The returned value is in the range [0, π] radians or NaN.

◆ acosf()

float acosf ( float  x)

The acosf() function computes the principal value of the arc cosine of x. The returned value is in the range [0, π] radians. A domain error occurs for arguments not in the range [−1, +1]. The relative error is bounded by 1.9·10−7.

◆ acosl()

long double acosl ( long double  x)

The acosl() function computes the principal value of the arc cosine of x. The returned value is in the range [0, π] radians or NaN.

Since
AVR-LibC v2.2

◆ asin()

double asin ( double  x)

The asin() function computes the principal value of the arc sine of x. The returned value is in the range [−π/2, π/2] radians or NaN.

◆ asinf()

float asinf ( float  x)

The asinf() function computes the principal value of the arc sine of x. The returned value is in the range [−π/2, π/2] radians. A domain error occurs for arguments not in the range [−1, +1]. The relative error is bounded by 3.3·10−7.

◆ asinl()

long double asinl ( long double  x)

The asinl() function computes the principal value of the arc sine of x. The returned value is in the range [−π/2, π/2] radians or NaN.

Since
AVR-LibC v2.2

◆ atan()

double atan ( double  x)

The atan() function computes the principal value of the arc tangent of x. The returned value is in the range [−π/2, π/2] radians.

◆ atan2()

double atan2 ( double  y,
double  x 
)

The atan2() function computes the principal value of the arc tangent of y / x, using the signs of both arguments to determine the quadrant of the return value. The returned value is in the range [−π, +π] radians.

◆ atan2f()

float atan2f ( float  y,
float  x 
)

The atan2f() function computes the principal value of the arc tangent of y / x, using the signs of both arguments to determine the quadrant of the return value. The returned value is in the range [−π, +π] radians.

◆ atan2l()

long double atan2l ( long double  y,
long double  x 
)

The atan2l() function computes the principal value of the arc tangent of y / x, using the signs of both arguments to determine the quadrant of the return value. The returned value is in the range [−π, +π] radians.

Since
AVR-LibC v2.2

◆ atanf()

float atanf ( float  x)

The atanf() function computes the principal value of the arc tangent of x. The returned value is in the range [−π/2, π/2] radians. The relative error is bounded by 1.3·10−7.

◆ atanl()

long double atanl ( long double  x)

The atanl() function computes the principal value of the arc tangent of x. The returned value is in the range [−π/2, π/2] radians.

Since
AVR-LibC v2.2

◆ cbrt()

double cbrt ( double  x)

The cbrt() function returns the cube root of x.

◆ cbrtf()

float cbrtf ( float  x)

The cbrtf() function returns the cube root of x.

◆ cbrtl()

long double cbrtl ( long double  x)

The cbrtl() function returns the cube root of x.

Since
AVR-LibC v2.2

◆ ceil()

double ceil ( double  x)

The ceil() function returns the smallest integral value greater than or equal to x, expressed as a floating-point number.

◆ ceilf()

float ceilf ( float  x)

The ceilf() function returns the smallest integral value greater than or equal to x, expressed as a floating-point number.

◆ ceill()

long double ceill ( long double  x)

The ceill() function returns the smallest integral value greater than or equal to x, expressed as a floating-point number.

Since
AVR-LibC v2.2

◆ copysign()

static double copysign ( double  __x,
double  __y 
)
inlinestatic

The copysign() function returns __x but with the sign of __y. They work even if __x or __y are NaN or zero.

◆ copysignf()

static float copysignf ( float  __x,
float  __y 
)
inlinestatic

The copysignf() function returns __x but with the sign of __y. They work even if __x or __y are NaN or zero.

◆ copysignl()

static long double copysignl ( long double  __x,
long double  __y 
)
inlinestatic

The copysignl() function returns __x but with the sign of __y. They work even if __x or __y are NaN or zero.

Since
AVR-LibC v2.2

◆ cos()

double cos ( double  x)

The cos() function returns the cosine of x, measured in radians.

◆ cosf()

float cosf ( float  x)

The cosf() function returns the cosine of x, measured in radians.

◆ cosh()

double cosh ( double  x)

The cosh() function returns the hyperbolic cosine of x.

◆ coshf()

float coshf ( float  x)

The coshf() function returns the hyperbolic cosine of x.

◆ coshl()

long double coshl ( long double  x)

The coshl() function returns the hyperbolic cosine of x.

Since
AVR-LibC v2.2

◆ cosl()

long double cosl ( long double  x)

The cosl() function returns the cosine of x, measured in radians.

Since
AVR-LibC v2.2

◆ exp()

double exp ( double  x)

The exp() function returns the exponential value of x.

◆ expf()

float expf ( float  x)

The expf() function returns the exponential value of x.

◆ expl()

long double expl ( long double  x)

The expl() function returns the exponential value of x.

Since
AVR-LibC v2.2

◆ fabs()

double fabs ( double  __x)
inline

The fabs() function computes the absolute value of a floating-point number x.

◆ fabsf()

float fabsf ( float  __x)
inline

The fabsf() function computes the absolute value of a floating-point number x.

◆ fabsl()

long double fabsl ( long double  __x)
inline

The fabsl() function computes the absolute value of a floating-point number x.

Since
AVR-LibC v2.2

◆ fdim()

double fdim ( double  x,
double  y 
)

The fdim() function returns max(x − y, 0). If x or y or both are NaN, NaN is returned.

◆ fdimf()

float fdimf ( float  x,
float  y 
)

The fdimf() function returns max(x − y, 0). If x or y or both are NaN, NaN is returned.

◆ fdiml()

long double fdiml ( long double  x,
long double  y 
)

The fdiml() function returns max(x − y, 0). If x or y or both are NaN, NaN is returned.

Since
AVR-LibC v2.2, GCC v15.2

◆ floor()

double floor ( double  x)

The floor() function returns the largest integral value less than or equal to x, expressed as a floating-point number.

◆ floorf()

float floorf ( float  x)

The floorf() function returns the largest integral value less than or equal to x, expressed as a floating-point number.

◆ floorl()

long double floorl ( long double  x)

The floorl() function returns the largest integral value less than or equal to x, expressed as a floating-point number.

Since
AVR-LibC v2.2

◆ fma()

double fma ( double  x,
double  y,
double  z 
)

The fma() function performs floating-point multiply-add. This is the operation (x * y) + z, but the intermediate result is not rounded to the destination type. This can sometimes improve the precision of a calculation.

◆ fmaf()

float fmaf ( float  x,
float  y,
float  z 
)

The fmaf() function performs floating-point multiply-add. This is the operation (x * y) + z, but the intermediate result is not rounded to the destination type. This can sometimes improve the precision of a calculation.

◆ fmal()

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

The fmal() function performs floating-point multiply-add. This is the operation (x * y) + z, but the intermediate result is not rounded to the destination type. This can sometimes improve the precision of a calculation.

Since
AVR-LibC v2.2

◆ fmax()

double fmax ( double  x,
double  y 
)

The fmax() function returns the greater of the two values x and y. If an argument is NaN, the other argument is returned. If both arguments are NaN, NaN is returned.

◆ fmaxf()

float fmaxf ( float  x,
float  y 
)

The fmaxf() function returns the greater of the two values x and y. If an argument is NaN, the other argument is returned. If both arguments are NaN, NaN is returned.

◆ fmaxl()

long double fmaxl ( long double  x,
long double  y 
)

The fmaxl() function returns the greater of the two values x and y. If an argument is NaN, the other argument is returned. If both arguments are NaN, NaN is returned.

Since
AVR-LibC v2.2

◆ fmin()

double fmin ( double  x,
double  y 
)

The fmin() function returns the lesser of the two values x and y. If an argument is NaN, the other argument is returned. If both arguments are NaN, NaN is returned.

◆ fminf()

float fminf ( float  x,
float  y 
)

The fminf() function returns the lesser of the two values x and y. If an argument is NaN, the other argument is returned. If both arguments are NaN, NaN is returned.

◆ fminl()

long double fminl ( long double  x,
long double  y 
)

The fminl() function returns the lesser of the two values x and y. If an argument is NaN, the other argument is returned. If both arguments are NaN, NaN is returned.

Since
AVR-LibC v2.2

◆ fmod()

double fmod ( double  x,
double  y 
)

The function fmod() returns the floating-point remainder of x / y.

◆ fmodf()

float fmodf ( float  x,
float  y 
)

The function fmodf() returns the floating-point remainder of x / y.

◆ fmodl()

long double fmodl ( long double  x,
long double  y 
)

The function fmodl() returns the floating-point remainder of x / y.

Since
AVR-LibC v2.2

◆ frexp()

double frexp ( double  x,
int *  pexp 
)

The frexp() function breaks a floating-point number into a normalized fraction and an integral power of 2. It stores the integer in the int object pointed to by pexp.

If x is a normal float point number, the frexp() function returns the value v, such that v has a magnitude in the interval [1/2, 1) or zero, and x equals v times 2 raised to the power pexp. If x is zero, both parts of the result are zero. If x is not a finite number, the frexp() returns x as is and stores 0 by pexp.

◆ frexpf()

float frexpf ( float  x,
int *  pexp 
)

The frexpf() function breaks a floating-point number into a normalized fraction and an integral power of 2. It stores the integer in the int object pointed to by pexp.

If x is a normal float point number, the frexpf() function returns the value v, such that v has a magnitude in the interval [1/2, 1) or zero, and x equals v times 2 raised to the power pexp. If x is zero, both parts of the result are zero. If x is not a finite number, the frexpf() returns x as is and stores 0 by pexp.

Note
This implementation permits a zero pointer as a directive to skip a storing the exponent.

◆ frexpl()

long double frexpl ( long double  x,
int *  pexp 
)

The frexpl() function breaks a floating-point number into a normalized fraction and an integral power of 2. It stores the integer in the int object pointed to by pexp.

If x is a normal float point number, the frexpl() function returns the value v, such that v has a magnitude in the interval [1/2, 1) or zero, and x equals v times 2 raised to the power pexp. If x is zero, both parts of the result are zero. If x is not a finite number, the frexpl() returns x as is and stores 0 by pexp.

Since
AVR-LibC v2.2

◆ hypot()

double hypot ( double  x,
double  y 
)

The hypot() function returns sqrt(x*x + y*y). This is the length of the hypotenuse of a right triangle with sides of length x and y, or the distance of the point (x, y) from the origin. Using this function instead of the direct formula is wise, since the error is much smaller. No underflow with small x and y. No overflow if result is in range.

◆ hypotf()

float hypotf ( float  x,
float  y 
)

The hypotf() function returns sqrtf(x*x + y*y). This is the length of the hypotenuse of a right triangle with sides of length x and y, or the distance of the point (x, y) from the origin. Using this function instead of the direct formula is wise, since the error is much smaller. No underflow with small x and y. No overflow if result is in range.

◆ hypotl()

long double hypotl ( long double  x,
long double  y 
)

The hypotl() function returns sqrtl(x*x + y*y). This is the length of the hypotenuse of a right triangle with sides of length x and y, or the distance of the point (x, y) from the origin. Using this function instead of the direct formula is wise, since the error is much smaller. No underflow with small x and y. No overflow if result is in range.

Since
AVR-LibC v2.2

◆ isfinite()

static int isfinite ( double  __x)
inlinestatic

The isfinite() function returns a nonzero value if __x is finite: not plus or minus infinity, and not NaN.

◆ isfinitef()

static int isfinitef ( float  __x)
inlinestatic

The isfinitef() function returns a nonzero value if __x is finite: not plus or minus infinity, and not NaN.

◆ isfinitel()

static int isfinitel ( long double  __x)
inlinestatic

The isfinitel() function returns a nonzero value if __x is finite: not plus or minus infinity, and not NaN.

Since
AVR-LibC v2.2

◆ isinf()

int isinf ( double  x)

The function isinf() returns 1 if the argument x is positive infinity, −1 if x is negative infinity, and 0 otherwise.

◆ isinff()

int isinff ( float  x)

The function isinff() returns 1 if the argument x is positive infinity, −1 if x is negative infinity, and 0 otherwise.

◆ isinfl()

int isinfl ( long double  x)

The function isinfl() returns 1 if the argument x is positive infinity, −1 if x is negative infinity, and 0 otherwise.

Since
AVR-LibC v2.2

◆ isnan()

int isnan ( double  x)

The function isnan() returns 1 if the argument x represents a "not-a-number" (NaN) object, otherwise 0.

◆ isnanf()

int isnanf ( float  x)

The function isnanf() returns 1 if the argument x represents a "not-a-number" (NaN) object, otherwise 0.

◆ isnanl()

int isnanl ( long double  x)

The function isnanl() returns 1 if the argument x represents a "not-a-number" (NaN) object, otherwise 0.

Since
AVR-LibC v2.2

◆ ldexp()

double ldexp ( double  x,
int  iexp 
)

The ldexp() function multiplies a floating-point number by an integral power of 2. It returns the value of x times 2 raised to the power iexp.

◆ ldexpf()

float ldexpf ( float  x,
int  iexp 
)

The ldexpf() function multiplies a floating-point number by an integral power of 2. It returns the value of x times 2 raised to the power iexp.

◆ ldexpl()

long double ldexpl ( long double  x,
int  iexp 
)

The ldexpl() function multiplies a floating-point number by an integral power of 2. It returns the value of x times 2 raised to the power iexp.

Since
AVR-LibC v2.2

◆ log()

double log ( double  x)

The log() function returns the natural logarithm of argument x.

◆ log10()

double log10 ( double  x)

The log10() function returns the logarithm of argument x to base 10.

◆ log10f()

float log10f ( float  x)

The log10f() function returns the logarithm of argument x to base 10. The relative error is bounded by 2.8·10−7.

◆ log10l()

long double log10l ( long double  x)

The log10l() function returns the logarithm of argument x to base 10.

Since
AVR-LibC v2.2

◆ log2()

double log2 ( double  x)

The log2() function returns the logarithm of argument x to base 2.

Since
AVR-LibC v2.3

◆ log2f()

float log2f ( float  x)

The log2f() function returns the logarithm of argument x to base 2. The relative error is bounded by 1.8·10−7.

Since
AVR-LibC v2.3

◆ log2l()

long double log2l ( long double  x)

The log2l() function returns the logarithm of argument x to base 2.

Since
AVR-LibC v2.3

◆ logf()

float logf ( float  x)

The logf() function returns the natural logarithm of argument x. The relative error is bounded by 2.3·10−7.

◆ logl()

long double logl ( long double  x)

The logl() function returns the natural logarithm of argument x.

Since
AVR-LibC v2.2

◆ lrint()

long lrint ( double  x)

The lrint() function rounds x to the nearest integer, rounding the halfway cases to the even integer direction. (That is both 1.5 and 2.5 values are rounded to 2). This function is similar to rint() function, but it differs in type of return value and in that an overflow is possible.

Returns
The rounded long integer value. If x is not a finite number or an overflow was, this realization returns the LONG_MIN value (0x80000000).

◆ lrintf()

long lrintf ( float  x)

The lrintf() function rounds x to the nearest integer, rounding the halfway cases to the even integer direction. (That is both 1.5 and 2.5 values are rounded to 2). This function is similar to rintf() function, but it differs in type of return value and in that an overflow is possible.

Returns
The rounded long integer value. If x is not a finite number or an overflow was, this realization returns the LONG_MIN value (0x80000000).

◆ lrintl()

long lrintl ( long double  x)

The lrintl() function rounds x to the nearest integer, rounding the halfway cases to the even integer direction. (That is both 1.5 and 2.5 values are rounded to 2). This function is similar to rintl() function, but it differs in type of return value and in that an overflow is possible.

Returns
The rounded long integer value. If x is not a finite number or an overflow was, this realization returns the LONG_MIN value (0x80000000).
Since
AVR-LibC v2.2

◆ lround()

long lround ( double  x)

The lround() function rounds x to the nearest integer, but rounds halfway cases away from zero (instead of to the nearest even integer). This function is similar to round() function, but it differs in type of return value and in that an overflow is possible.

Returns
The rounded long integer value. If x is not a finite number or an overflow was, this realization returns the LONG_MIN value (0x80000000).

◆ lroundf()

long lroundf ( float  x)

The lroundf() function rounds x to the nearest integer, but rounds halfway cases away from zero (instead of to the nearest even integer). This function is similar to round() function, but it differs in type of return value and in that an overflow is possible.

Returns
The rounded long integer value. If x is not a finite number or an overflow was, this realization returns the LONG_MIN value (0x80000000).

◆ lroundl()

long lroundl ( long double  x)

The lroundl() function rounds x to the nearest integer, but rounds halfway cases away from zero (instead of to the nearest even integer). This function is similar to round() function, but it differs in type of return value and in that an overflow is possible.

Returns
The rounded long integer value. If x is not a finite number or an overflow was, this realization returns the LONG_MIN value (0x80000000).
Since
AVR-LibC v2.2

◆ modf()

double modf ( double  x,
double *  iptr 
)

The modf() function breaks the argument x into integral and fractional parts, each of which has the same sign as the argument. It stores the integral part as a double in the object pointed to by iptr.

The modf() function returns the signed fractional part of x.

◆ modff()

float modff ( float  x,
float *  iptr 
)

The modff() function breaks the argument x into integral and fractional parts, each of which has the same sign as the argument. It stores the integral part as a float in the object pointed to by iptr.

The modff() function returns the signed fractional part of x.

Note
This implementation skips writing by zero pointer. However, the GCC 4.3 can replace this function with inline code that does not permit to use NULL address for the avoiding of storing.

◆ modfl()

long double modfl ( long double  x,
long double *  iptr 
)

The modfl() function breaks the argument x into integral and fractional parts, each of which has the same sign as the argument. It stores the integral part as a long double in the object pointed to by iptr.

The modf() function returns the signed fractional part of x.

Since
AVR-LibC v2.2

◆ pow()

double pow ( double  x,
double  y 
)

The function pow() returns the value of x to the exponent y.
Notice that for integer exponents, there is the more efficient double __builtin_powi(double x, int y).

◆ powf()

float powf ( float  x,
float  y 
)

The function powf() returns the value of x to the exponent y.
Notice that for integer exponents, there is the more efficient float __builtin_powif(float x, int y).

◆ powl()

long double powl ( long double  x,
long double  y 
)

The function powl() returns the value of x to the exponent y.
Notice that for integer exponents, there is the more efficient long double __builtin_powil(long double x, int y).

Since
AVR-LibC v2.2

◆ round()

double round ( double  x)

The round() function rounds x to the nearest integer, but rounds halfway cases away from zero (instead of to the nearest even integer). Overflow is impossible.

Returns
The rounded value. If x is an integral or infinite, x itself is returned. If x is NaN, then NaN is returned.

◆ roundf()

float roundf ( float  x)

The roundf() function rounds x to the nearest integer, but rounds halfway cases away from zero (instead of to the nearest even integer). Overflow is impossible.

Returns
The rounded value. If x is an integral or infinite, x itself is returned. If x is NaN, then NaN is returned.

◆ roundl()

long double roundl ( long double  x)

The roundl() function rounds x to the nearest integer, but rounds halfway cases away from zero (instead of to the nearest even integer). Overflow is impossible.

Returns
The rounded value. If x is an integral or infinite, x itself is returned. If x is NaN, then NaN is returned.
Since
AVR-LibC v2.2

◆ signbit()

int signbit ( double  x)

The signbit() function returns a nonzero value if the value of x has its sign bit set. This is not the same as `x < 0.0', because IEEE 754 floating point allows zero to be signed. The comparison '−0.0 < 0.0' is false, but `signbit (−0.0)' will return a nonzero value.

◆ signbitf()

int signbitf ( float  x)

The signbitf() function returns a nonzero value if the value of x has its sign bit set. This is not the same as `x < 0.0', because IEEE 754 floating point allows zero to be signed. The comparison '−0.0 < 0.0' is false, but `signbit (−0.0)' will return a nonzero value.

◆ signbitl()

int signbitl ( long double  x)

The signbitl() function returns a nonzero value if the value of x has its sign bit set. This is not the same as `x < 0.0', because IEEE 754 floating point allows zero to be signed. The comparison '−0.0 < 0.0' is false, but `signbit (−0.0)' will return a nonzero value.

Since
AVR-LibC v2.2

◆ sin()

double sin ( double  x)

The sin() function returns the sine of x, measured in radians.

◆ sincos()

void sincos ( double  x,
double *  psin,
double *  pcos 
)

The sincos() function returns the sine of x in *psin, and the cosine of x in *pcos. The angle x is measured in radians. As an example, the performance gain of the IEEE double version of sincos() compared to a sin() plus a cos() call is around 5000 cycles for x = 2.0.

Since
GCC v15.3 (IEEE double), AVR-LibC v2.3

◆ sincosf()

void sincosf ( float  x,
float *  psin,
float *  pcos 
)

The sincosf() function returns the sine of x in *psin, and the cosine of x in *pcos. The angle x is measured in radians. A sincosf() call is a bit faster than calling sinf() and cosf() individually, but it consumes a bit more program memory.

Since
AVR-LibC v2.3

◆ sincosl()

void sincosl ( long double  x,
long double *  psin,
long double *  pcos 
)

The sincosl() function returns the sine of x in *psin, and the cosine of x in *pcos. The angle x is measured in radians. As an example, the performance gain of the IEEE double version of sincosl() compared to a sinl() plus a cosl() call is around 5000 cycles for x = 2.0.

Since
GCC v15.3 (IEEE double), AVR-LibC v2.3

◆ sinf()

float sinf ( float  x)

The sinf() function returns the sine of x, measured in radians.

◆ sinh()

double sinh ( double  x)

The sinh() function returns the hyperbolic sine of x.

◆ sinhf()

float sinhf ( float  x)

The sinhf() function returns the hyperbolic sine of x.

◆ sinhl()

long double sinhl ( long double  x)

The sinhl() function returns the hyperbolic sine of x.

◆ sinl()

long double sinl ( long double  x)

The sinl() function returns the sine of x, measured in radians.

Since
AVR-LibC v2.2

◆ sqrt()

double sqrt ( double  x)

The sqrt() function returns the non-negative square root of x.

◆ sqrtf()

float sqrtf ( float  x)

The sqrtf() function returns the non-negative square root of x.

◆ sqrtl()

long double sqrtl ( long double  x)

The sqrtl() function returns the non-negative square root of x.

Since
AVR-LibC v2.2

◆ square()

double square ( double  x)

The function square() returns x * x.

Note
This function does not belong to the C standard definition.

◆ squaref()

float squaref ( float  x)

The function squaref() returns x * x.

Note
This function does not belong to the C standard definition.

◆ squarel()

long double squarel ( long double  x)

The function squarel() returns x * x.

Note
This function does not belong to the C standard definition.
Since
AVR-LibC v2.2

◆ tan()

double tan ( double  x)

The tan() function returns the tangent of x, measured in radians.

◆ tanf()

float tanf ( float  x)

The tanf() function returns the tangent of x, measured in radians.

◆ tanh()

double tanh ( double  x)

The tanh() function returns the hyperbolic tangent of x.

◆ tanhf()

float tanhf ( float  x)

The tanhf() function returns the hyperbolic tangent of x.

◆ tanhl()

long double tanhl ( long double  x)

The tanhl() function returns the hyperbolic tangent of x.

Since
AVR-LibC v2.2

◆ tanl()

long double tanl ( long double  x)

The tanl() function returns the tangent of x, measured in radians.

Since
AVR-LibC v2.2

◆ trunc()

double trunc ( double  x)

The trunc() function rounds x to the nearest integer not larger in absolute value.

◆ truncf()

float truncf ( float  x)

The truncf() function rounds x to the nearest integer not larger in absolute value.

◆ truncl()

long double truncl ( long double  x)

The truncl() function rounds x to the nearest integer not larger in absolute value.

Since
AVR-LibC v2.2