Skip to content

Math ​

tyrus:math provides mathematical constants and functions. All constants are f64 values available at compile time with zero runtime cost.

Imports ​

Importsimport { PI, E, TAU } from "tyrus:math";

Exported Items ​

ItemTypePurpose
Constantsf64 constantsFundamental mathematical constants
Functionsnative functionsBasic, 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.