Math

Contains common math operations.

Functions

All the current functions of the math module.

abs(number: number)

Returns the absolute value of the given number argument.


Math.abs(-1); //1
                    

floor(number: number)

Rounds the given number down to the nearest integer.


Math.floor(2.5); //2
                    

round(number: number)

Returns a 'rounded' number from the given specified number argument.


Math.round(2.75); //3
                    

ceil(number: number)

Returns a ceiling value of the given number.


Math.ceil(1.5); //2
                    

log(number: number)

Returns the natural logarithm of the given number.


Math.log(1); //0
                    

exp(number: number)

Returns the exponential of the given number.


//22026.4657948067
Math.exp(10);
                    

sqrt(number: number)

Returns the square root of the given number.


Math.sqrt(25); // 5
                    

clamp(minimum: number, prefered: number, maximum: number)

Similarly to the CSS clamp function it returns a value between an upper and lower bound.


Math.clamp(1, 3.5, 2); //2
Math.clamp(1, 1.5, 2); //1.5
                    

Trigonometric Functions

sin(number: number)

Returns the sine of the given number.


    Math.sin(45); //0.850903524534118
                        

cos(number: number)

Returns the cosine of the given number.


    Math.cos(45); //0.52532198881773
                        

tan(number: number)

Returns the tangent of the given number


    Math.tan(45); //1.61977519054386
                        

asin(number: number)

Returns the arc sine of the given number. Otherwise a math domain error if failed.


    Math.asin(0.5); //0.523598775598299
                        

acos(number: number)

Returns the arc cosine of the given number. Otherwise a math domain error if failed.


    Math.acos(0.5) //1.0471975511965979
                        

atan(number: number)

Returns the arc tangent of the given number


    Math.atan(3); //1.24904577239825
                        


min(numbers: list)

Returns the smallest number in the given list.


Math.min([1,2,6,4]); //1
                    

max(numbers: list)

Returns the biggest number in the given list.


Math.max([0,22,9,4]); //22
                    

gcd(number1: number, number2: number)

Returns the greatest common divisor of the first number argument and the second.


Math.gcd(1200, 320); //80
                    

pow(number1: number, number2: number)

Returns the power of the given number arguments


Math.pow(5, 2); //25
                    

Properties

All the current properties of the math module.

Eular's number

Represents the Eular's number.


Math.e //2.71828182845905
                    

Value of PI

Represents the value of pi.


Math.pi //3.14159265358979