avr-libc
2.1.0
Standard C library for AVR-GCC
|
AVR Libc Home Page |
AVR Libc Development Pages |
||||
Main Page |
User Manual |
Library Reference |
FAQ |
Example Projects |
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() |
#define | __ASM_ALIAS(x) __asm(#x) |
Functions | |
float | cosf (float __x) |
double | cos (double __x) __ASM_ALIAS(cosf) |
float | sinf (float __x) |
double | sin (double __x) __ASM_ALIAS(sinf) |
float | tanf (float __x) |
double | tan (double __x) __ASM_ALIAS(tanf) |
static float | fabsf (float __x) |
static double | fabs (double __x) |
float | fmodf (float __x, float __y) |
double | fmod (double __x, double __y) __ASM_ALIAS(fmodf) |
float | modff (float __x, float *__iptr) |
double | modf (double __x, double *__iptr) __ASM_ALIAS(modff) |
float | sqrtf (float __x) |
double | sqrt (double __x) __ASM_ALIAS(sqrtf) |
float | cbrtf (float __x) |
double | cbrt (double __x) __ASM_ALIAS(cbrtf) |
float | hypotf (float __x, float __y) |
double | hypot (double __x, double __y) __ASM_ALIAS(hypotf) |
float | squaref (float __x) |
double | square (double __x) __ASM_ALIAS(squaref) |
float | floorf (float __x) |
double | floor (double __x) __ASM_ALIAS(floorf) |
float | ceilf (float __x) |
double | ceil (double __x) __ASM_ALIAS(ceilf) |
float | frexpf (float __x, int *__pexp) |
double | frexp (double __x, int *__pexp) __ASM_ALIAS(frexpf) |
float | ldexpf (float __x, int __exp) |
double | ldexp (double __x, int __exp) __ASM_ALIAS(ldexpf) |
float | expf (float __x) |
double | exp (double __x) __ASM_ALIAS(expf) |
float | coshf (float __x) |
double | cosh (double __x) __ASM_ALIAS(coshf) |
float | sinhf (float __x) |
double | sinh (double __x) __ASM_ALIAS(sinhf) |
float | tanhf (float __x) |
double | tanh (double __x) __ASM_ALIAS(tanhf) |
float | acosf (float __x) |
double | acos (double __x) __ASM_ALIAS(acosf) |
float | asinf (float __x) |
double | asin (double __x) __ASM_ALIAS(asinf) |
float | atanf (float __x) |
double | atan (double __x) __ASM_ALIAS(atanf) |
float | atan2f (float __y, float __x) |
double | atan2 (double __y, double __x) __ASM_ALIAS(atan2f) |
float | logf (float __x) |
double | log (double __x) __ASM_ALIAS(logf) |
float | log10f (float __x) |
double | log10 (double __x) __ASM_ALIAS(log10f) |
float | powf (float __x, float __y) |
double | pow (double __x, double __y) __ASM_ALIAS(powf) |
int | isnanf (float __x) |
int | isnan (double __x) __ASM_ALIAS(isnanf) |
int | isinff (float __x) |
int | isinf (double __x) __ASM_ALIAS(isinff) |
static int | isfinitef (float __x) |
static int | isfinite (double __x) |
static float | copysignf (float __x, float __y) |
static double | copysign (double __x, double __y) |
int | signbitf (float __x) |
int | signbit (double __x) __ASM_ALIAS(signbitf) |
float | fdimf (float __x, float __y) |
double | fdim (double __x, double __y) __ASM_ALIAS(fdimf) |
float | fmaf (float __x, float __y, float __z) |
double | fma (double __x, double __y, double __z) __ASM_ALIAS(fmaf) |
float | fmaxf (float __x, float __y) |
double | fmax (double __x, double __y) __ASM_ALIAS(fmaxf) |
float | fminf (float __x, float __y) |
double | fmin (double __x, double __y) __ASM_ALIAS(fminf) |
float | truncf (float __x) |
double | trunc (double __x) __ASM_ALIAS(truncf) |
float | roundf (float __x) |
double | round (double __x) __ASM_ALIAS(roundf) |
long | lroundf (float __x) |
long | lround (double __x) __ASM_ALIAS(lroundf) |
long | lrintf (float __x) |
long | lrint (double __x) __ASM_ALIAS(lrintf) |
This header file declares basic mathematics constants and functions.
libm.a
. See also the related FAQ entry.errno
variable. Therefore the majority of them are declared with const attribute, for better optimization by GCC. #define INFINITY __builtin_inf() |
INFINITY constant.
#define M_1_PI 0.31830988618379067154 /* 1/pi */ |
The constant 1/pi.
#define M_2_PI 0.63661977236758134308 /* 2/pi */ |
The constant 2/pi.
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ |
The constant 2/sqrt(pi).
#define M_E 2.7182818284590452354 |
The constant e.
#define M_LN10 2.30258509299404568402 /* log_e 10 */ |
The natural logarithm of the 10.
#define M_LN2 0.69314718055994530942 /* log_e 2 */ |
The natural logarithm of the 2.
#define M_LOG10E 0.43429448190325182765 /* log_10 e */ |
The logarithm of the e to base 10.
#define M_LOG2E 1.4426950408889634074 /* log_2 e */ |
The logarithm of the e to base 2.
#define M_PI 3.14159265358979323846 /* pi */ |
The constant pi.
#define M_PI_2 1.57079632679489661923 /* pi/2 */ |
The constant pi/2.
#define M_PI_4 0.78539816339744830962 /* pi/4 */ |
The constant pi/4.
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ |
The constant 1/sqrt(2).
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ |
The square root of 2.
#define NAN __builtin_nan("") |
NAN constant.
double acos | ( | double | __x | ) |
The alias for 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, pi] radians. A domain error occurs for arguments not in the range [-1, +1].
double asin | ( | double | __x | ) |
The alias for 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 [-pi/2, pi/2] radians. A domain error occurs for arguments not in the range [-1, +1].
double atan | ( | double | __x | ) |
The alias for atanf().
double atan2 | ( | double | __y, |
double | __x | ||
) |
The alias for 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 [-pi, +pi] radians.
float atanf | ( | float | __x | ) |
The atanf() function computes the principal value of the arc tangent of __x. The returned value is in the range [-pi/2, pi/2] radians.
double cbrt | ( | double | __x | ) |
The alias for cbrtf().
float cbrtf | ( | float | __x | ) |
The cbrt() function returns the cube root of __x.
double ceil | ( | double | __x | ) |
The alias for 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.
|
static |
The copysignf() function returns __x but with the sign of __y. They work even if __x or __y are NaN or zero.
double cos | ( | double | __x | ) |
The alias for cosf().
float cosf | ( | float | __x | ) |
The cosf() function returns the cosine of __x, measured in radians.
double cosh | ( | double | __x | ) |
The alias for coshf().
float coshf | ( | float | __x | ) |
The coshf() function returns the hyperbolic cosine of __x.
double exp | ( | double | __x | ) |
The alias for expf().
float expf | ( | float | __x | ) |
The expf() function returns the exponential value of __x.
|
static |
The fabsf() function computes the absolute value of a floating-point number __x.
double fdim | ( | double | __x, |
double | __y | ||
) |
The alias for fdimf().
float fdimf | ( | float | __x, |
float | __y | ||
) |
The fdimf() function returns maxf(__x - __y, 0). If __x or __y or both are NaN, NaN is returned.
double floor | ( | double | __x | ) |
The alias for 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.
double fma | ( | double | __x, |
double | __y, | ||
double | __z | ||
) |
The alias for 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.
double fmax | ( | double | __x, |
double | __y | ||
) |
The alias for 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.
double fmin | ( | double | __x, |
double | __y | ||
) |
The alias for 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.
double fmod | ( | double | __x, |
double | __y | ||
) |
The alias for fmodf().
float fmodf | ( | float | __x, |
float | __y | ||
) |
The function fmodf() returns the floating-point remainder of __x / __y.
double frexp | ( | double | __x, |
int * | __pexp | ||
) |
The alias for 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.
double hypot | ( | double | __x, |
double | __y | ||
) |
The alias for 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.
|
static |
__x | The alias for isfinitef(). |
|
static |
The isfinitef() function returns a nonzero value if __x is finite: not plus or minus infinity, and not NaN.
int isinf | ( | double | __x | ) |
The alias for 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.
int isnan | ( | double | __x | ) |
The alias for isnanf().
int isnanf | ( | float | __x | ) |
The function isnanf() returns 1 if the argument __x represents a "not-a-number" (NaN) object, otherwise 0.
double ldexp | ( | double | __x, |
int | __exp | ||
) |
The alias for ldexpf().
float ldexpf | ( | float | __x, |
int | __exp | ||
) |
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 __exp.
double log | ( | double | __x | ) |
The alias for logf().
double log10 | ( | double | __x | ) |
The alias for log10f().
float log10f | ( | float | __x | ) |
The log10f() function returns the logarithm of argument __x to base 10.
float logf | ( | float | __x | ) |
The logf() function returns the natural logarithm of argument __x.
long lrint | ( | double | __x | ) |
The alias for 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.
LONG_MIN
value (0x80000000). long lround | ( | double | __x | ) |
The alias for 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 roundf() function, but it differs in type of return value and in that an overflow is possible.
LONG_MIN
value (0x80000000). double modf | ( | double | __x, |
double * | __iptr | ||
) |
An alias for 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 double in the object pointed to by __iptr.
The modff() function returns the signed fractional part of __x.
double pow | ( | double | __x, |
double | __y | ||
) |
The alias for powf().
float powf | ( | float | __x, |
float | __y | ||
) |
The function powf() returns the value of __x to the exponent __y.
double round | ( | double | __x | ) |
The alias for 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.
NaN
, then NaN
is returned. int signbit | ( | double | __x | ) |
The alias for 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.
double sin | ( | double | __x | ) |
The alias for sinf().
float sinf | ( | float | __x | ) |
The sinf() function returns the sine of __x, measured in radians.
double sinh | ( | double | __x | ) |
The alias for sinhf().
float sinhf | ( | float | __x | ) |
The sinhf() function returns the hyperbolic sine of __x.
double sqrt | ( | double | __x | ) |
An alias for sqrtf().
float sqrtf | ( | float | __x | ) |
The sqrtf() function returns the non-negative square root of __x.
double square | ( | double | __x | ) |
The alias for squaref().
float squaref | ( | float | __x | ) |
The function squaref() returns __x * __x.
double tan | ( | double | __x | ) |
The alias for tanf().
float tanf | ( | float | __x | ) |
The tanf() function returns the tangent of __x, measured in radians.
double tanh | ( | double | __x | ) |
The alias for tanhf().
float tanhf | ( | float | __x | ) |
The tanhf() function returns the hyperbolic tangent of __x.
double trunc | ( | double | __x | ) |
The alias for truncf().
float truncf | ( | float | __x | ) |
The truncf() function rounds __x to the nearest integer not larger in absolute value.