Atom

math module

Calculate angles, powers, roots, rounding, and numeric limits.

Import it with 'use math'.

Atom
use math
print(math.abs(-3))
Output
3

Numbers accept signed, unsigned and floating representations. Transcendental functions use binary64 and angles are in radians. The read-only f64 constants are pi (π), tau (2π), e (Euler's number), inf (positive infinity) and nan (quiet NaN). Use -math.inf for negative infinity and math.isnan to detect NaN.

Atom
use math
assert(math.tau == 2 * math.pi and math.abs(math.e - math.exp(1)) < 0.000001)
assert(math.isinf(math.inf) and math.isnan(math.nan))

Constants

pi, tau, e, inf, nan. See the constant index for details.

Functions