Appearance

Personalize your experience

Mode
Accent Color
Direction
All Docs/QuaScript//
QuaScript logo

QuaScript Documentation

Language guide, engine API, 601 builtins and the preset library · v3.0.0-phase1

math

Generated from the engine catalog by tools/gen-docs.mjs; do not edit.

Constants

NameValueMeaning
math.e2.718281828459045Euler's number.
math.phi1.618033988749895Golden ratio.
math.pi3.141592653589793Pi.

math.abs

script.qs
math.abs(x) -> num

Absolute value.

ArgumentKindDefaultNotes
xnumrequired

math.acos

script.qs
math.acos(x) -> num

Arc cosine.

ArgumentKindDefaultNotes
xnumrequired

math.asin

script.qs
math.asin(x) -> num

Arc sine.

ArgumentKindDefaultNotes
xnumrequired

math.atan

script.qs
math.atan(x) -> num

Arc tangent.

ArgumentKindDefaultNotes
xnumrequired

math.atan2

script.qs
math.atan2(y, x) -> num

Angle of the point (x, y).

ArgumentKindDefaultNotes
ynumrequired
xnumrequired

math.avg_of

script.qs
math.avg_of(a, b) -> num

Mean of 2 .. 16 values.

ArgumentKindDefaultNotes
anumrequired
bnumrequired

math.ceil

script.qs
math.ceil(x) -> num

Smallest integer >= x.

ArgumentKindDefaultNotes
xnumrequired

math.clamp

script.qs
math.clamp(x, lo, hi) -> num

x limited to [lo, hi].

ArgumentKindDefaultNotes
xnumrequired
lonumrequired
hinumrequired

math.coalesce

script.qs
math.coalesce(x, fallback) -> any

x, or fallback when x is na.

ArgumentKindDefaultNotes
xanyrequired
fallbackanyrequired

math.cos

script.qs
math.cos(x) -> num

Cosine (radians).

ArgumentKindDefaultNotes
xnumrequired

math.equal

script.qs
math.equal(a, b, eps = 1e-9) -> bool
a - b<= eps.
ArgumentKindDefaultNotes
anumrequired
bnumrequired
epsnum1e-9

math.exp

script.qs
math.exp(x) -> num

e to the power x.

ArgumentKindDefaultNotes
xnumrequired

math.floor

script.qs
math.floor(x) -> num

Largest integer <= x.

ArgumentKindDefaultNotes
xnumrequired

math.hypot

script.qs
math.hypot(a, b) -> num

sqrt(a^2 + b^2).

ArgumentKindDefaultNotes
anumrequired
bnumrequired

math.is_na

script.qs
math.is_na(x) -> bool

True when x is na.

ArgumentKindDefaultNotes
xanyrequired

math.lerp

script.qs
math.lerp(a, b, t) -> num

a + t * (b - a).

ArgumentKindDefaultNotes
anumrequired
bnumrequired
tnumrequired

math.log

script.qs
math.log(x) -> num

Natural logarithm (na for x <= 0).

ArgumentKindDefaultNotes
xnumrequired

math.log10

script.qs
math.log10(x) -> num

Base-10 logarithm.

ArgumentKindDefaultNotes
xnumrequired

math.max

script.qs
math.max(a, b) -> num

Larger of a and b (na if either is na).

ArgumentKindDefaultNotes
anumrequired
bnumrequired

math.min

script.qs
math.min(a, b) -> num

Smaller of a and b (na if either is na).

ArgumentKindDefaultNotes
anumrequired
bnumrequired

math.normalize

script.qs
math.normalize(x, lo, hi) -> num

(x - lo) / (hi - lo).

ArgumentKindDefaultNotes
xnumrequired
lonumrequired
hinumrequired

math.pow

script.qs
math.pow(x, p) -> num

x to the power p.

ArgumentKindDefaultNotes
xnumrequired
pnumrequired

math.random

script.qs
math.random(seed = 0) -> num

Deterministic uniform random number in [0, 1), one stream per call site.

ArgumentKindDefaultNotes
seedint0

math.relu

script.qs
math.relu(x) -> num

max(x, 0).

ArgumentKindDefaultNotes
xnumrequired

math.round

script.qs
math.round(x, digits = 0) -> num

Round half away from zero to digits decimals.

ArgumentKindDefaultNotes
xnumrequired
digitsint0

math.round_to

script.qs
math.round_to(x, step = asset.tick_size) -> num

Round to the nearest multiple of step (default: the tick size).

ArgumentKindDefaultNotes
xnumrequired
stepnumasset.tick_size

math.sigmoid

script.qs
math.sigmoid(x) -> num

Logistic function 1 / (1 + e^-x).

ArgumentKindDefaultNotes
xnumrequired

math.sign

script.qs
math.sign(x) -> num

-1, 0 or 1.

ArgumentKindDefaultNotes
xnumrequired

math.sin

script.qs
math.sin(x) -> num

Sine (radians).

ArgumentKindDefaultNotes
xnumrequired

math.sqrt

script.qs
math.sqrt(x) -> num

Square root (na for x < 0).

ArgumentKindDefaultNotes
xnumrequired

math.sum_of

script.qs
math.sum_of(a, b) -> num

Sum of 2 .. 16 values.

ArgumentKindDefaultNotes
anumrequired
bnumrequired

math.tan

script.qs
math.tan(x) -> num

Tangent (radians).

ArgumentKindDefaultNotes
xnumrequired

math.tanh

script.qs
math.tanh(x) -> num

Hyperbolic tangent.

ArgumentKindDefaultNotes
xnumrequired

math.to_bool

script.qs
math.to_bool(x) -> bool

True for a non-zero number; na is false.

ArgumentKindDefaultNotes
xnumrequired

math.to_degrees

script.qs
math.to_degrees(x) -> num

Radians to degrees.

ArgumentKindDefaultNotes
xnumrequired

math.to_radians

script.qs
math.to_radians(x) -> num

Degrees to radians.

ArgumentKindDefaultNotes
xnumrequired

math.trunc

script.qs
math.trunc(x) -> num

Integer part (towards zero).

ArgumentKindDefaultNotes
xnumrequired

© 2026 Quatick Technologies. All rights reserved.