`ANSI C Math Library  mikroC PRO for PIC32 Libraries > Standard ANSI C Libraries > ` `  `

## ANSI C Math Library

The mikroC PRO for PIC32 provides a set of standard ANSI C library functions for floating point math handling.

Important :
• Not all of the standard functions have been included.
• The functions have been mostly implemented according to the ANSI C standard, but certain functions have been modified in order to facilitate PIC32 programming. Be sure to skim through the description before using standard C functions.

### acos

Prototype double acos(double x); Function returns the arc cosine of parameter `x`; that is, the value whose cosine is `x`. The input parameter `x` must be between -1 and 1 (inclusive). The return value is in radians, between 0 and Π (inclusive). `doub = acos(0.5); // doub = 1.047198`

### asin

Prototype double asin(double x); Function returns the arc sine of parameter `x`; that is, the value whose sine is `x`. The input parameter `x` must be between -1 and 1 (inclusive). The return value is in radians, between -Π/2 and Π/2 (inclusive). `doub = asin(0.5); // doub = 5.235987e-1`

### atan

Prototype double atan(double f); Function computes the arc tangent of parameter `f`; that is, the value whose tangent is `f`. The return value is in radians, between -Π/2 and Π/2 (inclusive). `doub = atan(1.0); // doub = 7.853982e-1`

### atan2

Prototype double atan2(double y, double x); This is the two-argument arc tangent function. It is similar to computing the arc tangent of `y/x`, except that the signs of both arguments are used to determine the quadrant of the result and `x` is permitted to be zero. The return value is in radians, between -Π and Π (inclusive). `doub = atan2(2., 1.); // doub = 4.636475e-1`

### ceil

Prototype double ceil(double x); Function returns value of parameter `x` rounded up to the next whole number. `doub = ceil(0.5); // doub = 1.000000`

### cos

Prototype double cos(double f); Function returns the cosine of `f` in radians. The return value is from -1 to 1. `doub = cos(PI/3.); // doub = 0.500008`

### cosh

Prototype double cosh(double x); Function returns the hyperbolic cosine of `x`, defined mathematically as `(ex+e-x)/2`. If the value of x is too large (if overflow occurs), the function fails. `doub = cosh(PI/3.); // doub = 1.600286`

### exp

Prototype double exp(double x); Function returns the value of e — the base of natural logarithms — raised to the power `x` (i.e. `ex`). `doub = exp(0.5); // doub = 1.648721`

### fabs

Prototype double fabs(double d); Function returns the absolute (i.e. positive) value of `d`. `doub = fabs(-1.3); // doub = 1.3`

### floor

Prototype double floor(double x); Function returns the value of parameter `x` rounded down to the nearest integer. `doub = floor(15.258); // doub = 15.000000`

### frexp

Prototype double frexp(double value, int *eptr); Function splits a floating-point value into a normalized fraction and an integral power of 2. The return value is the normalized fraction and the integer exponent is stored in the object pointed to by `eptr`.

### ldexp

Prototype double ldexp(double value, int newexp); Function returns the result of multiplying the floating-point number `num` by 2 raised to the power `n` (i.e. returns `x * 2n`). `doub = ldexp(2.5, 2); // doub = 10`

### log

Prototype double log(double x); Function returns the natural logarithm of `x` (i.e. `loge(x)`). `doub = log(10); // doub = 2.302585E`

### log10

Prototype double log10(double x); Function returns the base-10 logarithm of `x` (i.e. `log10(x)`). `doub = log10(100.); // doub = 2.000000`

### modf

Prototype double modf(double val, double *iptr); Function returns the signed fractional component of `val`, placing its whole number component into the variable pointed to by `iptr`. `doub = modf(6.25, &iptr); // doub = 0.25, iptr = 6.00 `

### pow

Prototype double pow(double x, double y); Function returns the value of `x` raised to the power `y` (i.e. `xy`). `doub = pow(10.,5.); // doub = 9.999984e+4`

### sin

Prototype double sin(double f); Function returns the sine of `f` in radians. The return value is from -1 to 1. `doub = sin(PI/2.); // doub = 1.000000`

### sinh

Prototype double sinh(double x); Function returns the hyperbolic sine of `x`, defined mathematically as `(ex-e-x)/2`. If the value of x is too large (if overflow occurs), the function fails. `doub = sinh(PI/2.); // doub = 2.301296`

### sqrt

Prototype double sqrt(double x); Function returns the non negative square root of `x`. `doub = sqrt(10000.); // doub = 100.0000`

### tan

Prototype double tan(double x); Function returns the tangent of `x` in radians. The return value spans the allowed range of floating point in the mikroC PRO for PIC32. `doub = tan(PI/4.); // doub = 0.999998`

### tanh

Prototype double tanh(double x); Function returns the hyperbolic tangent of `x`, defined mathematically as `sinh(x)/cosh(x)`. `doub = tanh(-PI/4.); // doub = -0.655793`