math — Math utilities
This module provides small math utilities and constants built on top of
Python's math module.
Exports
- Constants:
E,PI,TAU - Functions:
sqrt(x: float) -> floatadd(a, b)sub(a, b)mul(a, b)div(a, b)sin(x: float) -> floatcos(x: float) -> floattan(x: float) -> floatlog(x: float, base: float = math.e) -> floatfactorial(n: int) -> intexp(x: float) -> floatpow(base: float, exp: float) -> floatfloor(x: float) -> intceil(x: float) -> inthypot(x: float, y: float) -> floatradians(degrees: float) -> floatdegrees(radians: float) -> float
Examples
function example() returns null {
print(math.PI);
print(math.sqrt(2));
print(math.radians(180)); # pi
}
Notes
- This module is intentionally small and mirrors Python's math API for predictable behavior.
factorial()validatesnis non-negative and raises a PythonValueErrorfor invalid input.