Detailed Description

#include <math.h>

This header file declares basic mathematics constants and functions.

Notes:

  • In order to access the functions declared herein, it is usually also required to additionally link against the library libm.a. See also the related FAQ entry.

  • Math functions do not raise exceptions and do not change the errno variable. Therefore the majority of them are declared with const attribute, for better optimization by GCC.

Macro Definition Documentation

#define acosf \fBacos\fP

The alias for acos().

#define asinf \fBasin\fP

The alias for asin().

#define atan2f \fBatan2\fP

The alias for atan2().

#define atanf \fBatan\fP

The alias for atan().

#define cbrtf \fBcbrt\fP

The alias for cbrt().

#define ceilf \fBceil\fP

The alias for ceil().

#define copysignf \fBcopysign\fP

The alias for copysign().

#define cosf \fBcos\fP

The alias for cos().

#define coshf \fBcosh\fP

The alias for cosh().

#define expf \fBexp\fP

The alias for exp().

#define fabsf \fBfabs\fP

The alias for fabs().

#define fdimf \fBfdim\fP

The alias for fdim().

#define floorf \fBfloor\fP

The alias for floor().

#define fmaf \fBfma\fP

The alias for fma().

#define fmaxf \fBfmax\fP

The alias for fmax().

#define fminf \fBfmin\fP

The alias for fmin().

#define fmodf \fBfmod\fP

The alias for fmod().

#define frexpf \fBfrexp\fP

The alias for frexp().

#define hypotf \fBhypot\fP

The alias for hypot().

#define INFINITY __builtin_inf()

INFINITY constant.

#define isfinitef \fBisfinite\fP

The alias for isfinite().

#define isinff \fBisinf\fP

The alias for isinf().

#define isnanf \fBisnan\fP

The alias for isnan().

#define ldexpf \fBldexp\fP

The alias for ldexp().

#define log10f \fBlog10\fP

The alias for log10().

#define logf \fBlog\fP

The alias for log().

#define lrintf \fBlrint\fP

The alias for lrint().

#define lroundf \fBlround\fP

The alias for lround().

#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/\fBsqrt\fP(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/\fBsqrt\fP(2) */

The constant 1/sqrt(2).

#define M_SQRT2 1.41421356237309504880 /* \fBsqrt\fP(2) */

The square root of 2.

#define NAN __builtin_nan('')

NAN constant.

#define powf \fBpow\fP

The alias for pow().

#define roundf \fBround\fP

The alias for round().

#define signbitf \fBsignbit\fP

The alias for signbit().

#define sinf \fBsin\fP

The alias for sin().

#define sinhf \fBsinh\fP

The alias for sinh().

#define sqrtf \fBsqrt\fP

The alias for sqrt().

#define squaref \fBsquare\fP

The alias for square().

#define tanf \fBtan\fP

The alias for tan().

#define tanhf \fBtanh\fP

The alias for tanh().

#define truncf \fBtrunc\fP

The alias for trunc().

Function Documentation

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 cbrt (double__x)

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

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)\fC [static]\fP

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.

Note:

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

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)\fC [static]\fP

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.

Note:

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

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)

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.

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.

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

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

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.

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.

float modff (float__x, float *__iptr)

The alias for modf().

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.

Returns:

The rounded value. If __x is an integral or infinite, __x itself is returned. If __x is 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.

Note:

This function does not belong to the C standard definition.

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.

Author

Generated automatically by Doxygen for avr-libc from the source code.