Math
tyrus:math provides mathematical constants and functions. All constants are f64 values available at compile time with zero runtime cost.
Imports
Imports
import { PI, E, TAU } from "tyrus:math";Exported Items
| Item | Type | Purpose |
|---|---|---|
Constants | f64 constants | Fundamental mathematical constants |
Functions | native functions | Basic, trigonometric, hyperbolic, exponential, logarithmic, and selection helpers |
Quick Start
A minimal example using mathematical constants:
tyrus
import { PI, TAU } from "tyrus:math";
const circumference: f64 = TAU * 3.0;
const area: f64 = PI * (2.0 * 2.0);Zero-cost constants
These constants are emitted as initialized globals in the generated binary. Importing them does not add runtime overhead beyond reading a global value.
