Skip to content

Constants ​

All tyrus:math constants are f64 values resolved at compile time.

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

const circumference: f64 = TAU * 3.0;
const natural: f64 = E;
ConstantValueDescription
PI3.141592653589793Ratio of circumference to diameter
E2.718281828459045Base of natural logarithms
LN20.6931471805599453Natural logarithm of 2
LN102.302585092994046Natural logarithm of 10
LOG2E1.4426950408889634Base-2 logarithm of E
LOG10E0.4342944819032518Base-10 logarithm of E
SQRT21.4142135623730951Square root of 2
EPSILON2.220446049250313e-16Gap from 1 to the next f64
TAU6.283185307179586Two times PI
PHI1.618033988749895Golden ratio

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.