Skip to main content

Math

Static fields

Pi

Equals to math constant pi.

Tau

Equals to two pi.

Static methods

abs(x)

Returns x value without the sign (absolute value).

sin(x)

Returns the value of math function sin for the given argument x.

cos(x)

Returns the value of math function cos for the given argument x.

tan(x)

Returns the value of math function tan for the given argument x.

asin(x)

Returns the value of math function asin for the given argument x.

acos(x)

Returns the value of math function acos for the given argument x.

atan(x)

Returns the value of math function atan for the given argument x.

atan2(x, y)

Returns the value of math function atan2 for the given arguments x and y. Useful for calculating angle of a vector.

floor(x)

Returns the integer value of x, rounding closer to 0.

ceil(x)

Returns the integer value of x, rounding closer to infinity.

round(x)

Returns the integer value of x, rounding to the closest integer.

min(a, b)

Returns the smallest number between a and b.

max(a, b)

Returns the biggest number between a and b.

mid(a, b, c)

Returns the number remaining number between the smallest and biggest in the arguments.

toRadians(x)

Converts x (in degrees) to radians.

toDegrees(x)

Converts x (in radians) to degrees.

sqrt(x)

Returns the square root of x.

log(x)

Returns the logarithm of x.

exp(x)

Returns the exponent of x.