AVR Libc Home Page | AVR Libc Development Pages | ||||
Main Page | User Manual | Library Reference | FAQ | Alphabetical Index | Example Projects |
Defines | |
#define | M_PI 3.141592653589793238462643 |
#define | M_SQRT2 1.4142135623730950488016887 |
#define | NAN __builtin_nan("") |
#define | INFINITY __builtin_inf() |
Functions | |
double | cos (double __x) |
double | fabs (double __x) |
double | fmod (double __x, double __y) |
double | modf (double __x, double *__iptr) |
double | sin (double __x) |
double | sqrt (double __x) |
double | tan (double __x) |
double | floor (double __x) |
double | ceil (double __x) |
double | frexp (double __x, int *__pexp) |
double | ldexp (double __x, int __exp) |
double | exp (double __x) |
double | cosh (double __x) |
double | sinh (double __x) |
double | tanh (double __x) |
double | acos (double __x) |
double | asin (double __x) |
double | atan (double __x) |
double | atan2 (double __y, double __x) |
double | log (double __x) |
double | log10 (double __x) |
double | pow (double __x, double __y) |
int | isnan (double __x) |
int | isinf (double __x) |
double | square (double __x) |
static double | copysign (double __x, double __y) |
double | fdim (double __x, double __y) |
double | fma (double __x, double __y, double __z) |
double | fmax (double __x, double __y) |
double | fmin (double __x, double __y) |
int | signbit (double __x) |
double | trunc (double __x) |
static int | isfinite (double __x) |
double | hypot (double __x, double __y) |
double | round (double __x) |
long | lround (double __x) |
long | lrint (double __x) |
#include <math.h>
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_PI 3.141592653589793238462643 |
The constant pi
.
#define M_SQRT2 1.4142135623730950488016887 |
The square root of 2.
#define NAN __builtin_nan("") |
NAN constant.
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, pi] radians. A domain error occurs for arguments not in the range [-1, +1].
double asin | ( | double | __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].
double atan | ( | double | __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.
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 [-pi, +pi] radians.
double ceil | ( | double | __x | ) |
The ceil() function returns the smallest integral value greater than or equal to __x, expressed as a floating-point number.
static double copysign | ( | double | __x, | |
double | __y | |||
) | [static] |
The copysign() 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 cos() function returns the cosine of __x, measured in radians.
double cosh | ( | double | __x | ) |
The cosh() function returns the hyperbolic cosine of __x.
double exp | ( | double | __x | ) |
The exp() function returns the exponential value of __x.
double fabs | ( | double | __x | ) |
The fabs() function computes the absolute value of a floating-point number __x.
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.
double floor | ( | double | __x | ) |
The floor() 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 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.
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.
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.
double fmod | ( | double | __x, | |
double | __y | |||
) |
The function fmod() returns the floating-point remainder of __x / __y.
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.
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.
static int isfinite | ( | double | __x | ) | [static] |
The isfinite() function returns a nonzero value if __x is finite: not plus or minus infinity, and not NaN.
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.
int isnan | ( | double | __x | ) |
The function isnan() returns 1 if the argument __x represents a "not-a-number" (NaN) object, otherwise 0.
double ldexp | ( | double | __x, | |
int | __exp | |||
) |
double log | ( | double | __x | ) |
The log() function returns the natural logarithm of argument __x.
double log10 | ( | double | __x | ) |
The log10() function returns the logarithm of argument __x to base 10.
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.
LONG_MIN
value (0x80000000). 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.
LONG_MIN
value (0x80000000). 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.
double pow | ( | double | __x, | |
double | __y | |||
) |
The function pow() returns the value of __x to the exponent __y.
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.
NaN
, then NaN
is returned. 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.
double sin | ( | double | __x | ) |
The sin() function returns the sine of __x, measured in radians.
double sinh | ( | double | __x | ) |
The sinh() function returns the hyperbolic sine of __x.
double sqrt | ( | double | __x | ) |
The sqrt() function returns the non-negative square root of __x.
double square | ( | double | __x | ) |
The function square() returns __x * __x.
double tan | ( | double | __x | ) |
The tan() function returns the tangent of __x, measured in radians.
double tanh | ( | double | __x | ) |
The tanh() function returns the hyperbolic tangent of __x.
double trunc | ( | double | __x | ) |
The trunc() function rounds __x to the nearest integer not larger in absolute value.