Docs

Math

The Math class is a collection of math functions that can be used in the scripting engine. It is a feature-complete clone of the "official" Javascript Math object .

Unless specified otherwise, the value type of the function is double .

Playground

Try out the Math functions in this interactive code editor:

var input = 1.0;
var result = Math.sin(input);
Console.print(result);


Class methods

abs

Returns the absolute (unsigned) value.

Math.abs(var value)



acos

Calculates the acosine value (radian based).

Math.acos(var value)



acosh

Calculates the acosh value (radian based).

Math.acosh(var value)



asin

Calculates the asine value (radian based).

Math.asin(var value)



asinh

Calculates the asinh value (radian based).

Math.asinh(var value)



atan

Calculates the atan value (radian based).

Math.atan(var value)



atanh

Calculates the atanh value (radian based).

Math.atanh(var value)



ceil

Rounds up the value.

Math.ceil(var value)



cos

Calculates the cosine value (radian based).

Math.cos(var value)



cosh

Calculates the cosh value (radian based).

Math.cosh(var value)



exp

Calculates the exp value.

Math.exp(var value)



floor

Rounds down the value.

Math.floor(var value)



log

Calculates the log value (with base E).

Math.log(var value)



log10

Calculates the log value (with base 10).

Math.log10(var value)



max

Returns the bigger number.

Math.max(var first, var second)



min

Returns the smaller number.

Math.min(var first, var second)



pow

Calculates the power of base and exponent.

Math.pow(var base, var exp)



randInt

Returns a random integer between the low and the high values.

Math.randInt(var low, var high)



random

Returns a random number between 0.0 and 1.0.

Math.random()



range

Limits the value to the given range.

Math.range(var value, var lowerLimit, var upperLimit)



round

Rounds the value to the next integer.

Math.round(var value)



sign

Returns the sign of the value.

Math.sign(var value)



sin

Calculates the sine value (radian based).

Math.sin(var value)



sinh

Calculates the sinh value (radian based).

Math.sinh(var value)



sqr

Calculates the square (xx) of the value.

Math.sqr(var value)



sqrt

Calculates the square root of the value.

Math.sqrt(var value)



tan

Calculates the tan value (radian based).

Math.tan(var value)



tanh

Calculates the tanh value (radian based).

Math.tanh(var value)



toDegrees

Converts radian (0...2PI) to degree (0...3600).

Math.toDegrees(var value)



toRadians

Converts degree (0...3600) to radian (0...2PI).

Math.toRadians(var value)