Standard library / Math · on the one-page reference

Math

Stable — thin wrappers over one of the oldest, least-churned corners of the runtime.

APIType
Math.abs(n)number → number
Math.max(a, b, …) · Math.min(a, b, …) · Math.max(...arr) · Math.min(...arr)(number, number, …) → number (two or more, same type; or a spread of one numeric array)
Math.sign(n)number → int
Math.clamp(n, lo, hi)(number, number, number) → number
Math.sqrt(n)number → number
Math.floor(n) · Math.ceil(n) · Math.round(n) · Math.trunc(n)number → int
Math.pow(base, exp)(number, number) → number
Math.imul(a, b)(int, int) → int (32-bit wrapping multiply)
Math.clz32(x)int → int (count leading zero bits in 32-bit)
Math.fround(x)number → number (round to nearest 32-bit float)
Math.log(n) · Math.log2(n) · Math.log10(n) · Math.log1p(n) · Math.exp(n) · Math.exp2(n) · Math.expm1(n)number → number
Math.sin(n) · Math.cos(n) · Math.tan(n)number → number
Math.asin(n) · Math.acos(n) · Math.atan(n) · Math.cbrt(n)number → number
Math.atan2(y, x) · Math.hypot(x, y, …)(number, number) → number (hypot is variadic, two or more)
Math.sinh(n) · Math.cosh(n) · Math.tanh(n) · Math.asinh(n) · Math.acosh(n) · Math.atanh(n)number → number
Math.PI · Math.E · Math.LN2 · Math.LN10 · Math.LOG2E · Math.LOG10E · Math.SQRT2 · Math.SQRT1_2number (property; the Math.PI() call form also still works)
n.toFixed(digits) · n.toExponential(digits?) · n.toString(radix?)number → string (fixed-point; exponential; base-10 / integer in radix 2–36)
Number.parseInt(s, radix?) · Number.parseFloat(s) · parseInt(...) · parseFloat(...)string → int | null · f64 | null (globals alias the Number.* forms)
Number.isInteger(x) · Number.isSafeInteger(x) · Number.isFinite(x) · Number.isNaN(x) · isNaN(x) · isFinite(x)number → bool (bare isNaN/isFinite are globals)
Number.EPSILON · Number.MAX_VALUE · Number.MIN_VALUE · Number.POSITIVE_INFINITY · Number.NEGATIVE_INFINITY · Number.MAX_SAFE_INTEGER · Number.MIN_SAFE_INTEGER · Number.NaNnumber (property; the Number.EPSILON() call form also still works)
Infinity · NaN · Number.NaN()number (global float constants)