Module math

The math package provides access to some useful math functions and constants.

Functions

define abs(x: Integer): Integer

Calculates the absolute value of an integer.

define acos(x: Double): Double

Calculates the arc cosine of a double in radians.

define asin(x: Double): Double

Calculates the arc sine of a double in radians.

define atan(x: Double): Double

Calculates the arc tangent of a double in radians.

define ceil(x: Double): Double

Round a double up to the nearest integer.

define cos(x: Double): Double

Calculate the cosine of a double in radians.

define cosh(x: Double): Double

Calculate the hyperbolic cosine of a double in radians.

define exp(x: Double): Double

Calculate e^x.

define fabs(x: Double): Double

Calculates the absolute value of a double.

define floor(x: Double): Double

Round a double down to the nearest integer.

define fmod(x: Double, y: Double): Double

Calculate the remainder of x/y.

define is_infinity(x: Double): Boolean

Check if a number is infinity

define is_nan(x: Double): Boolean

Check if a number is nan since if x = nan, then x == nan is false

define ldexp(x: Double, y: Integer): Double

Calculate x * 2^y.

define log(x: Double): Double

Calculate the log of a double with base e.

define log10(x: Double): Double

Calculate the log of a double with base 10.

define modf(x: Double): Tuple[Double, Double]

Split a double into an integer and a fractional part <[ipart, fpart]>.

define pow(x: Double, y: Double): Double

Calculate x^y.

define sin(x: Double): Double

Calculate the sine of a double in radians.

define sinh(x: Double): Double

Calculate the hyperbolic sine of a double in radians.

define sqrt(x: Double): Double

Calculate the square root of a double.

define tan(x: Double): Double

Calculate the tangent of a double in radians.

define tanh(x: Double): Double

Calculate the hyperbolic tangent of a double in radians.

define to_deg(x: Double): Double

Convert a double in radians to degrees.

define to_rad(x: Double): Double

Convert a double in degrees to radians.

Vars

var huge: Double

Value used as an error returned by math functions. +infinity on systems supporting IEEE Std 754-1985.

var infinity: Double

Value representing unsigned infinity

var nan: Double

Value representing not a number

var pi: Double

Value of pi