Math

Summary
Math
Variables
piThe mathematical constant pi.
eThe mathematical constant e, also known as Euler’s number.
Functions
degToRadConverts a degree value to radians
radToDegConverts 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.
mapRangeLinearly maps a value x from range [a1,a2] to [b1,b2]
clampClamps a numerical value to fall in the interval [min,max]
signReturns the sign of the given numerial value.

Variables

pi

The mathematical constant pi.

Type

double

e

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

Type

double

Functions

degToRad

Converts a degree value to radians

Type

(double) -> double

Parameters

degrees : doubleThe angle in degrees

Returns

The angle in radians

radToDeg

Converts a radian value to degrees

Type

(double) -> double

Parameters

radians : doubleThe angle in radians

Returns

The angle in degrees

acos_

Takes the inverse cosine of the given number

Type Signature

(double) -> double

Parameters

x : doubleThe 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 : doubleThe 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 : doubleThe 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 : doubleThe y component
x : doubleThe 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 : doubleThe 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 : doubleThe 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 : doubleThe 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 : doubleThe 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 : doubleThe 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 : doubleThe 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 : doubleThe 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 : doubleThe 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 : doubleThe number to be multiplied by
exponent : int16The exponent

Returns

The value x multiplied by 2^x

log_

The natural (base e) logarithm function.

Type Signature

(double) -> double

Parameters

x : doubleThe 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 : doubleThe 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 : doubleThe number

Returns

(fractionComponent, integerComponent) as a tuple value.

pow_

Returns x raised to the y power.

Type Signature

(double, double) -> double

Parameters

x : doubleThe base
y : doubleThe 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 : doublethe number to take the ceiling of

Returns

The ceiling of x

fabs_

The absolute value function.

Type Signature

(double) -> double

Parameters

x : doubleThe 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 : doubleThe 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 : doubleThe dividend
y : doubleThe divisor

Returns

The remainder of x divided by y.

round_

Rounds to the nearest integer value.

Type Signature

(double) -> double

Parameters

x : doubleThe 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 : doubleThe first number
y : doubleThe second number

Returns

The smaller of x and y

max_

Returns the larger of the two numbers.

Type Signature

(double, double) -> double

Parameters

x : doubleThe first number
y : doubleThe 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 : doubleThe value in range [a1,a2]
a1 : doubleThe lower value of the range containing x
a2 : doubleThe higher value of the range containing x
b1 : doubleThe lower value of the target range
b2 : doubleThe 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 : ‘aThe value to clamp
min : ‘aThe minimum value
max : ‘aThe 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 : ‘aThe number to find the sign of

Returns

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

Close