AVR Libc Home Page |  | AVR Libc Development Pages
Main Page | FAQ | Library Reference | Additional Documentation | Example Projects

# <math.h>: Mathematics

## Detailed Description

     #include <math.h>

This header file declares basic mathematics constants and functions.

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

## Defines

#define | M_PI 3.141592653589793238462643
#define | M_SQRT2 1.4142135623730950488016887

## Functions

double | cos (double __x) __ATTR_CONST__
double | fabs (double __x) __ATTR_CONST__
double | fmod (double __x, double __y) __ATTR_CONST__
double | modf (double __value, double *__iptr)
double | sin (double __x) __ATTR_CONST__
double | sqrt (double __x) __ATTR_CONST__
double | tan (double __x) __ATTR_CONST__
double | floor (double __x) __ATTR_CONST__
double | ceil (double __x) __ATTR_CONST__
double | frexp (double __value, int *__exp)
double | ldexp (double __x, int __exp) __ATTR_CONST__
double | exp (double __x) __ATTR_CONST__
double | cosh (double __x) __ATTR_CONST__
double | sinh (double __x) __ATTR_CONST__
double | tanh (double __x) __ATTR_CONST__
double | acos (double __x) __ATTR_CONST__
double | asin (double __x) __ATTR_CONST__
double | atan (double __x) __ATTR_CONST__
double | atan2 (double __y, double __x) __ATTR_CONST__
double | log (double __x) __ATTR_CONST__
double | log10 (double __x) __ATTR_CONST__
double | pow (double __x, double __y) __ATTR_CONST__
int | isnan (double __x) __ATTR_CONST__
int | isinf (double __x) __ATTR_CONST__
double | square (double __x) __ATTR_CONST__

## Define Documentation

#define M_PI 3.141592653589793238462643

| The constant `pi`.

#define M_SQRT2 1.4142135623730950488016887

| The square root of 2.

## 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 [0, pi] 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 [0, pi] radians. A domain error occurs for arguments not in the range [-1, +1].

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. If both `x` and `y` are zero, the global variable `errno` is set to `EDOM`.

double ceil | ( | double | __x | ) |

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

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 floor | ( | double | __x | ) |

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

double fmod | ( | double | __x,
|  | double | __y
| ) |

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

double frexp | ( | double | __value,
|  | int * | __exp
| ) |

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 `exp`.

The frexp() function returns the value `x`, such that `x` is a double with magnitude in the interval [1/2, 1) or zero, and `value` equals `x` times 2 raised to the power `*exp`. If value is zero, both parts of the result are zero.

int isinf | ( | double | __x | ) |

| The function isinf() returns 1 if the argument `x` is either positive or negative infinity, otherwise 0.

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. The ldexp() function returns the value of `x` times 2 raised to the power `exp`. If the resultant value would cause an overflow, the global variable errno is set to ERANGE, and the value NaN is returned.

double log | ( | double | __x | ) |

| The log() function returns the natural logarithm of argument `x`. If the argument is less than or equal 0, a domain error will occur.

double log10 | ( | double | __x | ) |

| The log10() function returns the logarithm of argument `x` to base 10. If the argument is less than or equal 0, a domain error will occur.

double modf | ( | double | __value,
|  | double * | __iptr
| ) |

| The modf() function breaks the argument `value` 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 `value`.

double pow | ( | double | __x,
|  | double | __y
| ) |

| The function pow() returns the value of `x` to the exponent `y`.

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

Automatically generated by Doxygen 1.4.6 on 18 Mar 2006.