Math
Variables
pi

The mathematical constant pi.

Type
double
e

The mathematical constant e, also known as Eulers number.

Type
double
Functions
degToRad

Converts a degree value to radians

Type
(double) -> double
Parameters
degrees : double

The angle in degrees

Returns

The angle in radians

radToDeg

Converts a radian value to degrees

Type
(double) -> double
Parameters
radians : double

The angle in radians

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

Returns

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

Returns

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, int32)
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

Returns

The ceiling of x

fabs_

The absolute value function, using the C fabs function.

Type Signature
(double) -> double
Parameters
x : double

The number to take the absolute value of

Returns

The absoulute value of x

abs_
Type Signature
(t) -> t where t : num
Parameters
x : t

The number to take the absolute value of

Returns

The absolute 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

Returns

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
(a, a) -> a where a : num
Parameters
x : a

The first number

y : a

The second number

Returns

The smaller of x and y

max_

Returns the larger of the two numbers.

Type Signature
(a, a) -> a where a : num
Parameters
x : a

The first number

y : a

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
(t, t, t, t, t) -> t where t : real
Parameters
x : t

The value in range [a1,a2]

a1 : t

The lower value of the range containing x

a2 : t

The higher value of the range containing x

b1 : t

The lower value of the target range

b2 : t

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 where a : num
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) -> int8 where a : num
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