Skip to content

math: members

31 implemented, 0 reserved. Entries are sorted by name.

abs(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Absolute value.

echo(Math.abs(-3)); // 3

Specification: standard-library.md§3.1.

acos(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Arccosine in radians; outside -1 to 1 gives 0.

echo(Math.acos(1)); // 0

Specification: standard-library.md§3.1.

asin(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Arcsine in radians; outside -1 to 1 gives 0.

echo(Math.asin(1)); // 1.570796326

Specification: standard-library.md§3.1.

atan(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Arctangent in radians.

echo(Math.atan(1)); // 0.785398163

Specification: standard-library.md§3.1.

atan2(y: number, x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Angle in radians of the point (x, y) seen from the origin.

echo(Math.atan2(1, 1)); // 0.785398163

Specification: standard-library.md§3.1.

ceil(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Rounds up to the nearest whole number.

echo(Math.ceil(2.1)); // 3

Specification: standard-library.md§3.1.

cos(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Cosine of an angle in radians.

echo(Math.cos(0)); // 1

Specification: standard-library.md§3.1.

degtorad(degrees: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Converts degrees to radians.

echo(Math.degtorad(180)); // 3.141592653

Specification: standard-library.md§3.1.

math.e: number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: no. read-only.

Constant 2.718281828459045 (e); read as Math.e, without a call.

echo(Math.e);

Specification: standard-library.md§3.1.

exp(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Returns e raised to the power x.

echo(Math.exp(1)); // 2.718281828

Specification: standard-library.md§3.1.

floor(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Rounds down to the nearest whole number.

echo(Math.floor(2.9)); // 2

Specification: standard-library.md§3.1.

hypot(a: number, b: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Length of the vector (a, b).

echo(Math.hypot(3, 4)); // 5

Specification: standard-library.md§3.1.

math.ln10: number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: no. read-only.

Constant 2.302585092994046 (ln 10); read as Math.ln10, without a call.

echo(Math.ln10);

Specification: standard-library.md§3.1.

math.ln2: number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: no. read-only.

Constant 0.6931471805599453 (ln 2); read as Math.ln2, without a call.

echo(Math.ln2);

Specification: standard-library.md§3.1.

log(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Natural logarithm; zero gives the negative limit, a negative number gives 0.

echo(Math.log(1)); // 0

Specification: standard-library.md§3.1.

log10(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Base 10 logarithm.

echo(Math.log10(1000)); // 3

Specification: standard-library.md§3.1.

log2(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Base 2 logarithm.

echo(Math.log2(8)); // 3

Specification: standard-library.md§3.1.

max(a: number, b: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Largest of the given numbers.

echo(Math.max(3, 1)); // 3

Specification: standard-library.md§3.1.

min(a: number, b: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Smallest of the given numbers.

echo(Math.min(5, 2, 9)); // 2

Specification: standard-library.md§3.1.

math.pi: number

Runs on: server and client. Origin: compatibility. Since: M1. Playground: no. read-only.

Constant 3.141592653589793 (pi); read as Math.pi, without a call.

echo(Math.pi);

Specification: standard-library.md§3.1.

pow(base: number, exponent: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Raises the base to the exponent, like the ^ operator.

echo(Math.pow(2, 10)); // 1024

Specification: standard-library.md§3.1.

radtodeg(radians: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Converts radians to degrees.

echo(Math.radtodeg(1)); // 57.295779513

Specification: standard-library.md§3.1.

random() -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

A random float from 0 up to, but not including, 1.

temp.r = Math.random();

Specification: standard-library.md§3.1.

round(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Rounds to the nearest whole number; halves round toward positive infinity.

echo(Math.round(2.5)); // 3

Specification: standard-library.md§3.1.

sign(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Returns -1, 0, or 1 for the sign of the number.

echo(Math.sign(-5)); // -1

Specification: standard-library.md§3.1.

sin(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Sine of an angle in radians.

echo(Math.sin(0)); // 0

Specification: standard-library.md§3.1.

sqrt(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Square root; a negative number gives 0.

echo(Math.sqrt(16)); // 4

Specification: standard-library.md§3.1.

math.sqrt1_2: number

Runs on: server and client. Origin: compatibility. Since: M1. Playground: no. read-only.

Constant 0.7071067811865476 (square root of 1/2); read as Math.sqrt1_2, without a call.

echo(Math.sqrt1_2);

Specification: standard-library.md§3.1.

math.sqrt2: number

Runs on: server and client. Origin: compatibility. Since: M1. Playground: no. read-only.

Constant 1.4142135623730951 (square root of 2); read as Math.sqrt2, without a call.

echo(Math.sqrt2);

Specification: standard-library.md§3.1.

tan(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Tangent of an angle in radians.

echo(Math.tan(0)); // 0

Specification: standard-library.md§3.1.

trunc(x: number) -> number

Runs on: server and client. Origin: engine extension. Since: M1. Playground: yes.

Removes the fractional part, rounding toward zero.

echo(Math.trunc(-2.7)); // -2

Specification: standard-library.md§3.1.

Engine version 0.1.0. Built 2026-11-18.