Skip to content

Math

Math.random

Returns a random value within 0 and 1.

Signature
-> : Number
Example
value := Math.random();

# prints 0.3245124
print(value);

Math.pi

Returns the value of PI.

Signature
-> : Number
Example
pi := Math.pi();

# prints 3.1415926535897932
print(pi);

Math.sin

Returns sine of the value.

Signature
-> Number value : Number
Example
value := Math.sin(1);

# prints 0.8414709848078965
print(value);

Math.cos

Returns cosine of the value.

Signature
-> Number value : Number
Example
value := Math.cos(1);

# prints 0.5403023058681398
print(value);

Math.tan

Returns tangent of the value.

Signature
-> Number value : Number
Example
value := Math.tan(1);

# prints 1.5574077246549023
print(value);

Math.asin

Returns arc sine of the value.

Signature
-> Number value : Number
Example
value := Math.asin(1);

# prints 1.5707963267948966
print(value);

Math.acos

Returns arc cosine of the value.

Signature
-> Number value : Number
Example
value := Math.acos(1);

# prints 0
print(value);

Math.atan

Returns arc tangent of the value.

Signature
-> Number value : Number
Example
value := Math.atan(1);

# prints 0.7853981633974483
print(value);

Math.atan2

A variant of Math.atan.

Signature
-> Number a, Number b : Number
Example
value := Math.atan2(1, 2);

# prints 0.4636476090008061
print(value);

Math.exp

Returns natural exponent of the value.

Signature
-> Number value : Number
Example
value := Math.exp(1);

# prints 2.718281828459045
print(value);

Math.log

Returns natural logarithm of the value.

Signature
-> Number value : Number
Example
value := Math.log(2);

# prints 0.6931471805599453
print(value);

Math.min

Returns minimum value in a and b.

Signature
-> Number a, Number b : Number
Example
value := Math.min(-1, 1);

# prints -1
print(value);

Math.max

Returns maximum value in a and b.

Signature
-> Number a, Number b : Number
Example
value := Math.max(-1, 1);

# prints 1
print(value);