Reference

Arithmetic

Absolute

Input One number.
Output The absolute value of the number.

Signature

num_abs(a: Number): Number

Example

num_abs(-5) // returns 5

Negative

Input One number.
Output The negative of the absolute value of the number. Always returns a non-positive number.

Signature

num_negative(a: Number): Number

Example

num_negative(3) // returns -3

Increment

Input One number.
Output The number incremented by one.

Signature

num_inc(a: Number): Number

Example

num_inc(4) // returns 5

Decrement

Input One number.
Output The number decremented by one.

Signature

num_dec(a: Number): Number

Example

num_dec(4) // returns 3

Sign of a number

Input A number.
Output 1 if the number is positive. -1 if the number is negative. 0 if the number is zero.

Signature

num_sign(a: Number): Number

Example

num_sign(-7) // returns -1

Fractional part

Input A number.
Output The fractional part of the number.

Signature

num_fraction(a: Number): Number

Example

num_fraction(3.75) // returns 0.75

Infinity

Output Positive infinity.

Signature

num_infinity(): Number

Example

num_infinity() // returns infinity

Add

Input Two numbers.
Output The sum of the numbers.

Signature

num_add(a: Number, b: Number): Number

Example

num_add(3, 4) // returns 7

Sum

Input Two numbers.
Output The sum of the numbers.

Signature

num_sum(a: Number, b: Number): Number

Example

num_sum(3, 4) // returns 7

Subtract

Input Two numbers.
Output The difference of the numbers.

Signature

num_sub(a: Number, b: Number): Number

Example

num_sub(10, 3) // returns 7

Multiply

Input Two numbers.
Output The product of the numbers.

Signature

num_mul(a: Number, b: Number): Number

Example

num_mul(3, 4) // returns 12

Divide

Input Two numbers.
Output The division of the numbers.

Signature

num_div(a: Number, b: Number): Number

Example

num_div(10, 2) // returns 5

Modulo

Input Two numbers.
Output The remainder of the division of the numbers.

Signature

num_mod(a: Number, b: Number): Number

Example

num_mod(10, 3) // returns 1

Power

Input Two numbers.
Output The first number raised to the power of the second number.

Signature

num_pow(a: Number, b: Number): Number

Example

num_pow(2, 3) // returns 8

Square root

Input One number.
Output The square root of the number.

Signature

num_sqrt(a: Number): Number

Example

num_sqrt(9) // returns 3

Round

Input One number.
Output The number rounded to the nearest integer.

Signature

num_round(a: Number): Number

Example

num_round(3.6) // returns 4

Floor

Input One number.
Output The largest integer less than or equal to the number.

Signature

num_floor(a: Number): Number

Example

num_floor(3.9) // returns 3

Ceiling

Input One number.
Output The smallest integer greater than or equal to the number.

Signature

num_ceil(a: Number): Number

Example

num_ceil(3.1) // returns 4

Truncate

Input A number.
Output The integer part of the number, discarding any fractional part.

Signature

num_truncate(a: Number): Number

Example

num_truncate(3.7) // returns 3

Round To

Input A number and the number of decimal places.
Output The number rounded to the specified decimal places.

Signature

num_roundTo(a: Number, b: Number): Number

Example

num_roundTo(3.14159, 2) // returns 3.14

Minimum

Input Two numbers.
Output The smallest of the numbers.

Signature

num_min(a: Number, b: Number): Number

Example

num_min(3, 7) // returns 3

Maximum

Input Two numbers.
Output The largest of the numbers.

Signature

num_max(a: Number, b: Number): Number

Example

num_max(3, 7) // returns 7

Clamp

Input Three numbers.
Output The first number clamped to be in the range of the second and third number.

Signature

num_clamp(a: Number, b: Number, c: Number): Number

Example

num_clamp(15, 0, 10) // returns 10

Sine

Input A number (in radians).
Output The sine of the number.

Signature

num_sin(a: Number): Number

Example

num_sin(0) // returns 0

Cosine

Input A number (in radians).
Output The cosine of the number.

Signature

num_cos(a: Number): Number

Example

num_cos(0) // returns 1

Tangent

Input A number (in radians).
Output The tangent of the number.

Signature

num_tan(a: Number): Number

Example

num_tan(0) // returns 0

Logarithm

Input A number.
Output The natural logarithm of the number.

Signature

num_log(a: Number): Number

Example

num_log(1) // returns 0

Log Base

Input Two numbers (value and base).
Output The logarithm of the value with the specified base.

Signature

num_logBase(a: Number, b: Number): Number

Example

num_logBase(8, 2) // returns 3

As radians

Input An angle in degrees.
Output The angle converted to radians.

Signature

num_asRadians(a: Number): Number

Example

num_asRadians(180) // returns 3.14159...

As degrees

Input An angle in radians.
Output The angle converted to degrees.

Signature

num_asDegrees(a: Number): Number

Example

num_asDegrees(3.14159) // returns 180

Is negative

Input A number.
Output True if the number is negative. False otherwise.

Signature

num_isNegative(a: Number): Boolean

Example

num_isNegative(-3) // returns true

Is positive

Input A number.
Output True if the number is positive. False otherwise.

Signature

num_isPositive(a: Number): Boolean

Example

num_isPositive(5) // returns true

Is zero

Input A number.
Output True if the number is zero. False otherwise.

Signature

num_isZero(a: Number): Boolean

Example

num_isZero(0) // returns true

Is even

Input A number.
Output True if the number is even. False otherwise.

Signature

num_isEven(a: Number): Boolean

Example

num_isEven(4) // returns true

Is odd

Input A number.
Output True if the number is odd. False otherwise.

Signature

num_isOdd(a: Number): Boolean

Example

num_isOdd(3) // returns true

Random integer

Input Two numbers.
Output A random integer between the two numbers (inclusive).

Signature

num_integerRandom(a: Number, b: Number): Number

Example

num_integerRandom(1, 10) // returns a random integer from 1 to 10

Random decimal

Output A random decimal number between 0 and 1.

Signature

num_decimalRandom(): Number

Example

num_decimalRandom() // returns a random decimal

Compare

Input Two numbers.
Output 1 if the first number is bigger than the second. -1 if it is the smaller. 0 if they are equal.

Signature

num_compare(a: Number, b: Number): Number

Example

num_compare(5, 3) // returns 1