GRID CARTOGRAPHER 4
Shortcuts

Math Functions

2019-04-12

A collection of standard mathematical functions.

abs

Math.abs( value: int|float ): int

Returns the absolute value of a number as an integer.

acos

Math.acos( value: float ): float

Returns the arc cosine of value (in radians).

asin

Math.asin( value: float ): float

Returns the arc sine of value (in radians).

atan

Math.atan( value: float ): float

Returns the arc tangent of value (in radians).

atan2

Math.atan2( x: float, y: float ): float

Returns the arc tangent of x,y (in radians).

ceil

Math.ceil( value: float ): float

Returns value rounded up to the next integer value. If value is already a whole number then it is returned unmodified.

clampi

Math.clampi( min: int, max: int ): int

Returns the value clamped within the range specified by min and max.

cos

Math.cos( value: float ): float

Returns the cosine of value (given in radians).

exp

Math.exp( value: float ): float

Returns e raised to the power of value.

fabs

Math.fabs( value: int|float ): float

Returns the absolute value of a floating-point number. i.e. a positive value with equal magnitude to value (which may already have been positive.)

floor

Math.floor( value: float ): float

Returns value rounded down to the nearest integer value (truncating the fractional part). If value is already a whole number then it is returned unmodified.

log

Math.log( value: float ): float

Returns the natural logarithm of value.

log10

Math.log10( value: float ): float

Returns the base10 logarithm of value.

mod

Math.mod( a: int, m: int ): int

Returns a mod m, a value between 0 and m - 1 using modular arithmetic. Unlike the % operator this function also handles negative values properly.

pow

Math.pow( a: float, b: float ): float

Returns a raised to the power of b.

rand

Math.rand( limit: int ): int

Returns a pseudo-random number from 0 to limit - 1.

sin

Math.sin( value: float ): float

Returns the sine of value (given in radians).

sqrt

Math.sqrt( value: float ): float

Returns the square root of value.

srand

Math.srand( seed: int ): void

Seed the random number generator with a new value.

tan

Math.tan( value: float ): float

Returns the tangent of value (given in radians).