# Math

Summary
 Math Variables pi The mathematical constant pi. e The mathematical constant e, also known as Euler’s number. Functions degToRad Converts a degree value to radians radToDeg Converts a radian value to degrees acos_ Takes the inverse cosine of the given number asin_ Takes the inverse sine of the given number atan_ Takes the inverse tangent of the given number atan2_ Returns the arc tangent in radians of y/x based on the signs of both values to determine the correct quadrant. cos_ Returns the cosine of the given value. cosh_ Returns the hyperbolic cosine of the given value. sin_ Returns the sine of the given value. sinh_ Returns the hyperbolic sine of the given value. tan_ Returns the tangent of the given value. tanh_ Returns the hyperbolic tangent of the given value. exp_ Returns the value of e raised to the xth power. frexp_ The returned value is the mantissa and the exponent such x = mantissa * 2 ^ exponent. ldexp_ Returns x multiplied by 2 raised to the power of exponent. log_ The natural (base e) logarithm function. log10_ The base 10 logarithm function. modf_ The returned value is the fraction component (part after the decimal) and the integer component of the given number. pow_ Returns x raised to the y power. sqrt_ Returns the square root of x. ceil_ Returns the smallest integer value greater than or equal to x. fabs_ The absolute value function. floor_ Returns the largest integer value less than or equal to x. fmod_ Returns the remainder of x divided by y. round_ Rounds to the nearest integer value. min_ Returns the smaller of the two numbers. max_ Returns the larger of the two numbers. mapRange Linearly maps a value x from range [a1,a2] to [b1,b2] clamp Clamps a numerical value to fall in the interval [min,max] sign Returns the sign of the given numerial value.

### pi

The mathematical constant pi.

`double`

### e

The mathematical constant e, also known as Euler’s number.

`double`

### Functions

Converts a degree value to radians

#### Type

`(double) -> double`

#### Parameters

 degrees : double The angle in degrees

#### Returns

Converts a radian value to degrees

#### Type

`(double) -> double`

#### Returns

The angle in degrees

### acos_

Takes the inverse cosine of the given number

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The value to take the acos of

#### Returns

The inverse cosine value in radians

### asin_

Takes the inverse sine of the given number

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The value to take the asin of

#### Returns

The inverse sine value in radians.

### atan_

Takes the inverse tangent of the given number

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The value to take the atan of

#### Returns

The atan value, ranging in value from -pi/2 to pi/2.

### atan2_

Returns the arc tangent in radians of y/x based on the signs of both values to determine the correct quadrant.

#### Type Signature

`(double, double) -> double`

#### Parameters

 y : double The y component x : double The x component

#### Returns

The atan value, ranging in value from -pi to pi.

### cos_

Returns the cosine of the given value.

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The value to take the cosine of in radians.

#### Returns

The cosine value.

### cosh_

Returns the hyperbolic cosine of the given value.

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The value to take the cosh of

#### Returns

The hyperbolic cosine value.

### sin_

Returns the sine of the given value.

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The value to take the sine of in radians

The sine value.

### sinh_

Returns the hyperbolic sine of the given value.

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The value to take the sinh of

#### Returns

The hyperbolic sine value.

### tan_

Returns the tangent of the given value.

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The value to take the tan of in radians

#### Returns

The tangent value

### tanh_

Returns the hyperbolic tangent of the given value.

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The value to take the tanh of

The tanh value

### exp_

Returns the value of e raised to the xth power.

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The power to raise e to

#### Returns

e raised to the xth power

### frexp_

The returned value is the mantissa and the exponent such x = mantissa * 2 ^ exponent.

#### Type Signature

`(double) -> (double * int16)`

#### Parameters

 x : double The number

#### Returns

(mantissa, exponent) as a tuple

### ldexp_

Returns x multiplied by 2 raised to the power of exponent.

#### Type Signature

`(double, int16) -> double`

#### Parameters

 x : double The number to be multiplied by exponent : int16 The exponent

#### Returns

The value x multiplied by 2^x

### log_

The natural (base e) logarithm function.

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The value to take the logarithm of

#### Returns

Returns the base e log of x.

### log10_

The base 10 logarithm function.

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The value to take the logarithm of

#### Returns

Returns the base 10 log of x.

### modf_

The returned value is the fraction component (part after the decimal) and the integer component of the given number.

#### Type Signature

`(double) -> (double * double)`

#### Parameters

 x : double The number

#### Returns

(fractionComponent, integerComponent) as a tuple value.

### pow_

Returns x raised to the y power.

#### Type Signature

`(double, double) -> double`

#### Parameters

 x : double The base y : double The exponent

#### Returns

x raised to the y power

### sqrt_

Returns the square root of x.

#### Type Signature

`(double) -> double`

#### Returns

The square root of x

### ceil_

Returns the smallest integer value greater than or equal to x.

#### Type Signature

`(double) -> double`

#### Parameters

 x : double the number to take the ceiling of

The ceiling of x

### fabs_

The absolute value function.

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The number to take the absolute value of

#### Returns

The absoulute value of x

### floor_

Returns the largest integer value less than or equal to x.

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The number to take the floor of

The floor of x

### fmod_

Returns the remainder of x divided by y.

#### Type Signature

`(double, double) -> double`

#### Parameters

 x : double The dividend y : double The divisor

#### Returns

The remainder of x divided by y.

### round_

Rounds to the nearest integer value.

#### Type Signature

`(double) -> double`

#### Parameters

 x : double The number to round

#### Returns

The rounded integer value, computed using floor(x+0.5)

### min_

Returns the smaller of the two numbers.

#### Type Signature

`(double, double) -> double`

#### Parameters

 x : double The first number y : double The second number

#### Returns

The smaller of x and y

### max_

Returns the larger of the two numbers.

#### Type Signature

`(double, double) -> double`

#### Parameters

 x : double The first number y : double The second number

#### Returns

The larger of x and y

### mapRange

Linearly maps a value x from range [a1,a2] to [b1,b2]

#### Type Signature

`(double, double, double, double, double) -> double`

#### Parameters

 x : double The value in range [a1,a2] a1 : double The lower value of the range containing x a2 : double The higher value of the range containing x b1 : double The lower value of the target range b2 : double The higher value of the target range

#### Returns

x mapped from range [a1,a2] to [b1,b2]

### clamp

Clamps a numerical value to fall in the interval [min,max]

#### Type Signature

`<'a>('a, 'a, 'a) -> 'a`

#### Parameters

 x : ‘a The value to clamp min : ‘a The minimum value max : ‘a The maximum value

#### Returns

min if x is smaller than min, max if x is larger than max otherwise returns x.

### sign

Returns the sign of the given numerial value.

#### Type Signature

`<'a>('a) -> int8`

#### Parameters

 n : ‘a The number to find the sign of

#### Returns

0 if n is zero, 1 if n is greater than zero, otherwise -1