# math

Mathematical functions for real numbers.

Summary
 math Mathematical functions for real numbers. Constants Pi The value of Pi to 34 significant digits. Functions abs Absolute value. acos Inverse cosine (arc cos). acosh Inverse hyperbolic cosine (arc cosh). asin Inverse sine (arc sin). asinh Inverse hyperbolic sine (arc sinh). atan Inverse tangent (arc tan). atanh Inverse hyperbolic tangent (arc tanh). atan2 Inverse tangent (arc tan) of y/x. cbrt Cube root. ceil Ceiling function. cos Cosine. cosh Hyperbolic cosine. erf Error function. erfc Complementary error function. exp Exponentiation. exp2 Exponentiation (base 2). expm1 Calculates exp(x)-1.0. floor Floor function. frexp Decomposes a floating point number into a normalised fraction and an integral power of 10. hypot Hypotenuse. intdiv Integer division with rounding toward zero. ldexp Multiplies a floating point value x by the number 10 raised to the exp power. lgamma Log gamma function. log Logarithm. log10 Logarithm (base 10). log1p Computes the natural (base e) logarithm of 1+arg. log2 Logarithm (base 2). max Return the greater of two numbers. min Return the lesser of two numbers. nearbyint Returns an integer close to x by rounding. odd Return TRUE if the given number is odd. powmod Calculate modular exponentiation. round Round a number to a specified number of decimal places. sign Returns -1 if x is negative, 0 if x is 0, or 1 if x is positive. sin Sine. sinh Hyperbolic sine. sqrt Square root. tan Tangent. tanh Hyperbolic tangent. tgamma Gamma function. trunc Truncate to integer (effectively, round toward zero).

### Pi

The value of Pi to 34 significant digits.

### abs

 DECLARE NATIVE FUNCTION abs( x: Number ): Number

Absolute value.

#### Reference

http://mathworld.wolfram.com/AbsoluteValue.html

#### Example

`ASSERT math.abs(-5) = 5`

### acos

 DECLARE NATIVE FUNCTION acos( x: Number ): Number

Inverse cosine (arc cos).

#### Reference

http://mathworld.wolfram.com/InverseCosine.html

### acosh

 DECLARE NATIVE FUNCTION acosh( x: Number ): Number

Inverse hyperbolic cosine (arc cosh).

#### Reference

http://mathworld.wolfram.com/InverseHyperbolicCosine.html

### asin

 DECLARE NATIVE FUNCTION asin( x: Number ): Number

Inverse sine (arc sin).

#### Reference

http://mathworld.wolfram.com/InverseSine.html

### asinh

 DECLARE NATIVE FUNCTION asinh( x: Number ): Number

Inverse hyperbolic sine (arc sinh).

#### Reference

http://mathworld.wolfram.com/InverseHyperbolicSine.html

### atan

 DECLARE NATIVE FUNCTION atan( x: Number ): Number

Inverse tangent (arc tan).

#### Reference

http://mathworld.wolfram.com/InverseTangent.html

### atanh

 DECLARE NATIVE FUNCTION atanh( x: Number ): Number

Inverse hyperbolic tangent (arc tanh).

#### Reference

http://mathworld.wolfram.com/InverseHyperbolicTangent.html

### atan2

 DECLARE NATIVE FUNCTION atan2( y, x: Number ): Number

Inverse tangent (arc tan) of y/x.  This two-argument form avoids problems where x is near 0.

#### Reference

http://mathworld.wolfram.com/InverseTangent.html

### cbrt

 DECLARE NATIVE FUNCTION cbrt( x: Number ): Number

Cube root.

#### Refrence

http://mathworld.wolfram.com/CubeRoot.html

### ceil

 DECLARE NATIVE FUNCTION ceil( x: Number ): Number

Ceiling function.

#### Reference

http://mathworld.wolfram.com/CeilingFunction.html

### cos

 DECLARE NATIVE FUNCTION cos( x: Number ): Number

Cosine.

#### Reference

http://mathworld.wolfram.com/Cosine.html

### cosh

 DECLARE NATIVE FUNCTION cosh( x: Number ): Number

Hyperbolic cosine.

#### Reference

http://mathworld.wolfram.com/HyperbolicCosine.html

### erf

 DECLARE NATIVE FUNCTION erf( x: Number ): Number

Error function.

#### Reference

http://mathworld.wolfram.com/Erf.html

### erfc

 DECLARE NATIVE FUNCTION erfc( x: Number ): Number

Complementary error function.

#### Reference

http://mathworld.wolfram.com/Erfc.html

### exp

 DECLARE NATIVE FUNCTION exp( x: Number ): Number

Exponentiation.

#### Reference

http://mathworld.wolfram.com/Exponentiation.html

### exp2

 DECLARE NATIVE FUNCTION exp2( x: Number ): Number

Exponentiation (base 2).

#### Reference

http://mathworld.wolfram.com/Exponentiation.html

### expm1

 DECLARE NATIVE FUNCTION expm1( x: Number ): Number

Calculates exp(x)-1.0.  This function avoids numeric accuracy problems where x is close to zero.

#### Reference

http://mathworld.wolfram.com/Exponentiation.html

### floor

 DECLARE NATIVE FUNCTION floor( x: Number ): Number

Floor function.

#### Reference

http://mathworld.wolfram.com/FloorFunction.html

### frexp

 DECLARE NATIVE FUNCTION frexp( x: Number, OUT exp: Number ): Number

Decomposes a floating point number into a normalised fraction and an integral power of 10.

### hypot

 DECLARE NATIVE FUNCTION hypot( x: Number, y: Number ): Number

Hypotenuse.  Calcuates sqrt(x^2 + y^2).

### intdiv

 DECLARE NATIVE FUNCTION intdiv( x: Number, y: Number ): Number

Integer division with rounding toward zero.

### ldexp

 DECLARE NATIVE FUNCTION ldexp( x: Number, exp: Number ): Number

Multiplies a floating point value x by the number 10 raised to the exp power.

### lgamma

 DECLARE NATIVE FUNCTION lgamma( x: Number ): Number

Log gamma function.

#### Reference

http://mathworld.wolfram.com/LogGammaFunction.html

### log

 DECLARE NATIVE FUNCTION log( x: Number ): Number

Logarithm.

#### Reference

http://mathworld.wolfram.com/Logarithm.html

### log10

 DECLARE NATIVE FUNCTION log10( x: Number ): Number

Logarithm (base 10).

#### Reference

http://mathworld.wolfram.com/Logarithm.html

### log1p

 DECLARE NATIVE FUNCTION log1p( x: Number ): Number

Computes the natural (base e) logarithm of 1+arg.  This function is more precise than the expression log(1+arg) if arg is close to zero.

#### Reference

http://mathworld.wolfram.com/Logarithm.html

### log2

 DECLARE NATIVE FUNCTION log2( x: Number ): Number

Logarithm (base 2).

#### Reference

http://mathworld.wolfram.com/Logarithm.html

### max

 DECLARE NATIVE FUNCTION max( a: Number, b: Number ): Number

Return the greater of two numbers.

#### Reference

http://mathworld.wolfram.com/Maximum.html

### min

 DECLARE NATIVE FUNCTION min( a: Number, b: Number ): Number

Return the lesser of two numbers.

#### Reference

http://mathworld.wolfram.com/Minimum.html

### nearbyint

 DECLARE NATIVE FUNCTION nearbyint( x: Number ): Number

Returns an integer close to x by rounding.

### odd

 DECLARE NATIVE FUNCTION odd( x: Number ): Boolean

Return TRUE if the given number is odd.

#### Reference

http://mathworld.wolfram.com/OddNumber.html

### powmod

 DECLARE NATIVE FUNCTION powmod( b, e, m: Number ): Number

Calculate modular exponentiation.

### round

 DECLARE NATIVE FUNCTION round( places: Number, value: Number ): Number

Round a number to a specified number of decimal places.

### sign

 DECLARE NATIVE FUNCTION sign( x: Number ): Number

Returns -1 if x is negative, 0 if x is 0, or 1 if x is positive.

#### Reference

http://mathworld.wolfram.com/Sign.html

### sin

 DECLARE NATIVE FUNCTION sin( x: Number ): Number

Sine.

#### Reference

http://mathworld.wolfram.com/Sine.html

### sinh

 DECLARE NATIVE FUNCTION sinh( x: Number ): Number

Hyperbolic sine.

#### Reference

http://mathworld.wolfram.com/HyperbolicSine.html

### sqrt

 DECLARE NATIVE FUNCTION sqrt( x: Number ): Number

Square root.

#### Reference

http://mathworld.wolfram.com/SquareRoot.html

### tan

 DECLARE NATIVE FUNCTION tan( x: Number ): Number

Tangent.

#### Reference

http://mathworld.wolfram.com/Tangent.html

### tanh

 DECLARE NATIVE FUNCTION tanh( x: Number ): Number

Hyperbolic tangent.

#### Reference

http://mathworld.wolfram.com/HyperbolicTangent.html

### tgamma

 DECLARE NATIVE FUNCTION tgamma( x: Number ): Number

Gamma function.

#### Reference

http://mathworld.wolfram.com/GammaFunction.html

### trunc

 DECLARE NATIVE FUNCTION trunc( x: Number ): Number

Truncate to integer (effectively, round toward zero).

#### Reference

http://mathworld.wolfram.com/Truncate.html

 DECLARE NATIVE FUNCTION abs( x: Number ): Number
Absolute value.
 DECLARE NATIVE FUNCTION acos( x: Number ): Number
Inverse cosine (arc cos).
 DECLARE NATIVE FUNCTION acosh( x: Number ): Number
Inverse hyperbolic cosine (arc cosh).
 DECLARE NATIVE FUNCTION asin( x: Number ): Number
Inverse sine (arc sin).
 DECLARE NATIVE FUNCTION asinh( x: Number ): Number
Inverse hyperbolic sine (arc sinh).
 DECLARE NATIVE FUNCTION atan( x: Number ): Number
Inverse tangent (arc tan).
 DECLARE NATIVE FUNCTION atanh( x: Number ): Number
Inverse hyperbolic tangent (arc tanh).
 DECLARE NATIVE FUNCTION atan2( y, x: Number ): Number
Inverse tangent (arc tan) of y/x.
 DECLARE NATIVE FUNCTION cbrt( x: Number ): Number
Cube root.
 DECLARE NATIVE FUNCTION ceil( x: Number ): Number
Ceiling function.
 DECLARE NATIVE FUNCTION cos( x: Number ): Number
Cosine.
 DECLARE NATIVE FUNCTION cosh( x: Number ): Number
Hyperbolic cosine.
 DECLARE NATIVE FUNCTION erf( x: Number ): Number
Error function.
 DECLARE NATIVE FUNCTION erfc( x: Number ): Number
Complementary error function.
 DECLARE NATIVE FUNCTION exp( x: Number ): Number
Exponentiation.
 DECLARE NATIVE FUNCTION exp2( x: Number ): Number
Exponentiation (base 2).
 DECLARE NATIVE FUNCTION expm1( x: Number ): Number
Calculates exp(x)-1.0.
 DECLARE NATIVE FUNCTION floor( x: Number ): Number
Floor function.
 DECLARE NATIVE FUNCTION frexp( x: Number, OUT exp: Number ): Number
Decomposes a floating point number into a normalised fraction and an integral power of 10.
 DECLARE NATIVE FUNCTION hypot( x: Number, y: Number ): Number
Hypotenuse.
 DECLARE NATIVE FUNCTION intdiv( x: Number, y: Number ): Number
Integer division with rounding toward zero.
 DECLARE NATIVE FUNCTION ldexp( x: Number, exp: Number ): Number
Multiplies a floating point value x by the number 10 raised to the exp power.
 DECLARE NATIVE FUNCTION lgamma( x: Number ): Number
Log gamma function.
 DECLARE NATIVE FUNCTION log( x: Number ): Number
Logarithm.
 DECLARE NATIVE FUNCTION log10( x: Number ): Number
Logarithm (base 10).
 DECLARE NATIVE FUNCTION log1p( x: Number ): Number
Computes the natural (base e) logarithm of 1+arg.
 DECLARE NATIVE FUNCTION log2( x: Number ): Number
Logarithm (base 2).
 DECLARE NATIVE FUNCTION max( a: Number, b: Number ): Number
Return the greater of two numbers.
 DECLARE NATIVE FUNCTION min( a: Number, b: Number ): Number
Return the lesser of two numbers.
 DECLARE NATIVE FUNCTION nearbyint( x: Number ): Number
Returns an integer close to x by rounding.
 DECLARE NATIVE FUNCTION odd( x: Number ): Boolean
Return TRUE if the given number is odd.
 DECLARE NATIVE FUNCTION powmod( b, e, m: Number ): Number
Calculate modular exponentiation.
 DECLARE NATIVE FUNCTION round( places: Number, value: Number ): Number
Round a number to a specified number of decimal places.
 DECLARE NATIVE FUNCTION sign( x: Number ): Number
Returns -1 if x is negative, 0 if x is 0, or 1 if x is positive.
 DECLARE NATIVE FUNCTION sin( x: Number ): Number
Sine.
 DECLARE NATIVE FUNCTION sinh( x: Number ): Number
Hyperbolic sine.
 DECLARE NATIVE FUNCTION sqrt( x: Number ): Number
Square root.
 DECLARE NATIVE FUNCTION tan( x: Number ): Number
Tangent.
 DECLARE NATIVE FUNCTION tanh( x: Number ): Number
Hyperbolic tangent.
 DECLARE NATIVE FUNCTION tgamma( x: Number ): Number
Gamma function.
 DECLARE NATIVE FUNCTION trunc( x: Number ): Number
Truncate to integer (effectively, round toward zero).