Math Module
import sqrt, sin, cos, PI, clamp, lerp from math
Common functions: sqrt, sin, cos, tan, clamp, lerp, hypot, deg_to_rad, rad_to_deg
Transcendental: pow, exp, log, asin, acos, atan, atan2, sinh, cosh, tanh, log10, log2, cbrt
Note:
abs,min,max,floor,ceil,round,sign,truncare global builtins — no import needed.
Number theory: gcd, lcm, mod (Euclidean modulo, always non-negative), rem (same as %)
Bitwise: bitwise_and, bitwise_or, bitwise_xor, bitwise_not, left_shift, right_shift, bitwise_count
import bitwise_and, left_shift, bitwise_count from math
flags = bitwise_or(left_shift(1, 3), 1) // 9
set_bits = bitwise_count(255) // 8
Operate on 32-bit signed integers. Operands are truncated toward zero and saturate to the i32 range ([-2^31, 2^31-1]; NaN → 0). Shift counts are taken mod 32 (n & 31). right_shift is arithmetic (sign-preserving); for example right_shift(-8, 1) is -4. bitwise_count is the population count (number of set bits). Hex literals (0xFF) are accepted.
Constants: PI, E, TAU, INF, NAN
INF is positive infinity and NAN is IEEE 754 "not a number". These are useful for initializing accumulators (min_val = INF) and representing undefined results. Use the built-in is_nan(x) to test for NaN, since NAN != NAN is always true by IEEE 754 rules.