avr-libc  2.2.0git
Standard C library for AVR-GCC

AVR Libc Home Page

AVRs

AVR Libc Development Pages

Main Page

User Manual

Library Reference

FAQ

Example Projects

Macros | Functions
math.h File Reference

Go to the source code of this file.

Macros

#define M_E   2.7182818284590452354
 
#define M_LOG2E   1.4426950408889634074 /* log_2 e */
 
#define M_LOG10E   0.43429448190325182765 /* log_10 e */
 
#define M_LN2   0.69314718055994530942 /* log_e 2 */
 
#define M_LN10   2.30258509299404568402 /* log_e 10 */
 
#define M_PI   3.14159265358979323846 /* pi */
 
#define M_PI_2   1.57079632679489661923 /* pi/2 */
 
#define M_PI_4   0.78539816339744830962 /* pi/4 */
 
#define M_1_PI   0.31830988618379067154 /* 1/pi */
 
#define M_2_PI   0.63661977236758134308 /* 2/pi */
 
#define M_2_SQRTPI   1.12837916709551257390 /* 2/sqrt(pi) */
 
#define M_SQRT2   1.41421356237309504880 /* sqrt(2) */
 
#define M_SQRT1_2   0.70710678118654752440 /* 1/sqrt(2) */
 
#define NAN   __builtin_nan("")
 
#define INFINITY   __builtin_inf()
 

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)
 
float tanf (float __x)
 
double tan (double __x)
 
long double tanl (long double __x)
 
static float fabsf (float __x)
 
static double fabs (double __x)
 
static 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 squaref (float __x)
 
double square (double __x)
 
long double squarel (long double __x)
 
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 __exp)
 
double ldexp (double __x, int __exp)
 
long double ldexpl (long double __x, int __exp)
 
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 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)
 

Macro Definition Documentation

◆ INFINITY

#define INFINITY   __builtin_inf()

INFINITY constant.

◆ M_1_PI

#define M_1_PI   0.31830988618379067154 /* 1/pi */

The constant 1/pi.

◆ M_2_PI

#define M_2_PI   0.63661977236758134308 /* 2/pi */

The constant 2/pi.

◆ M_2_SQRTPI

#define M_2_SQRTPI   1.12837916709551257390 /* 2/sqrt(pi) */

The constant 2/sqrt(pi).

◆ M_LN10

#define M_LN10   2.30258509299404568402 /* log_e 10 */

The natural logarithm of the 10.

◆ M_LN2

#define M_LN2   0.69314718055994530942 /* log_e 2 */

The natural logarithm of the 2.

◆ M_LOG10E

#define M_LOG10E   0.43429448190325182765 /* log_10 e */

The logarithm of the e to base 10.

◆ M_LOG2E

#define M_LOG2E   1.4426950408889634074 /* log_2 e */

The logarithm of the e to base 2.

◆ M_PI

#define M_PI   3.14159265358979323846 /* pi */

The constant pi.

◆ M_PI_2

#define M_PI_2   1.57079632679489661923 /* pi/2 */

The constant pi/2.

◆ M_PI_4

#define M_PI_4   0.78539816339744830962 /* pi/4 */

The constant pi/4.

◆ M_SQRT1_2

#define M_SQRT1_2   0.70710678118654752440 /* 1/sqrt(2) */

The constant 1/sqrt(2).

◆ M_SQRT2

#define M_SQRT2   1.41421356237309504880 /* sqrt(2) */

The square root of 2.

◆ NAN

#define NAN   __builtin_nan("")

NAN constant.

Function Documentation

◆ acosf()

float acosf ( float  __x)

The acos() function computes the principal value of the arc cosine of __x. The returned value is in the range [0, pi] radians. A domain error occurs for arguments not in the range [-1, +1].

◆ asinf()

float asinf ( float  __x)

The asin() function computes the principal value of the arc sine of __x. The returned value is in the range [-pi/2, pi/2] radians. A domain error occurs for arguments not in the range [-1, +1].

◆ atan2f()

float atan2f ( float  __y,
float  __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 [-pi, +pi] radians.

◆ atanf()

float atanf ( float  __x)

The atan() function computes the principal value of the arc tangent of __x. The returned value is in the range [-pi/2, pi/2] radians.

◆ cbrtf()

float cbrtf ( float  __x)

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

◆ ceilf()

float ceilf ( float  __x)

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

◆ copysignf()

static float copysignf ( float  __x,
float  __y 
)
static

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

◆ cosf()

float cosf ( float  __x)

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

◆ coshf()

float coshf ( float  __x)

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

◆ expf()

float expf ( float  __x)

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

◆ fabsf()

static float fabsf ( float  __x)
static

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

◆ fdimf()

float fdimf ( float  __x,
float  __y 
)

The fdim() function returns max(__x - __y, 0). If __x or __y or both are NaN, NaN is returned.

◆ floorf()

float floorf ( float  __x)

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

◆ fmaf()

float fmaf ( float  __x,
float  __y,
float  __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.

◆ fmaxf()

float fmaxf ( float  __x,
float  __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.

◆ fminf()

float fminf ( float  __x,
float  __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.

◆ fmodf()

float fmodf ( float  __x,
float  __y 
)

The function fmod() returns the floating-point remainder of __x / __y.

◆ frexpf()

float frexpf ( float  __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.

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

◆ hypotf()

float hypotf ( float  __x,
float  __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.

◆ isfinitef()

static int isfinitef ( float  __x)
static

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

◆ isinff()

int isinff ( float  __x)

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

Note
The GCC 4.3 can replace this function with inline code that returns the 1 value for both infinities (gcc bug #35509).

◆ isnanf()

int isnanf ( float  __x)

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

◆ ldexpf()

float ldexpf ( float  __x,
int  __exp 
)

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 __exp.

◆ log10f()

float log10f ( float  __x)

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

◆ logf()

float logf ( float  __x)

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

◆ lrintf()

long lrintf ( float  __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).

◆ lroundf()

long lroundf ( float  __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).

◆ modff()

float modff ( float  __x,
float *  __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.

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.

◆ powf()

float powf ( float  __x,
float  __y 
)

The function pow() returns the value of __x to the exponent __y.

◆ roundf()

float roundf ( float  __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.

◆ signbitf()

int signbitf ( float  __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.

◆ sinf()

float sinf ( float  __x)

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

◆ sinhf()

float sinhf ( float  __x)

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

◆ sqrtf()

float sqrtf ( float  __x)

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

◆ squaref()

float squaref ( float  __x)

The function square() returns __x * __x.

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

◆ tanf()

float tanf ( float  __x)

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

◆ tanhf()

float tanhf ( float  __x)

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

◆ truncf()

float truncf ( float  __x)

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