Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Math

Named mathematical constants, matching Rust’s f64::consts surface.

Purely additive: the transcendental functions (sin, cos, exp, ln, sqrt, …) stay owned builtins routing through the vendored libm, and pi/e/tau stay Base-global. This module only names the derived constants, as exact Float literals pinned bit-for-bit, so importing it never shadows a Base name. Opt-in: not in Base.

Functions and Values

sqrt2

sqrt2 : Float

The square root of 2.

sqrt1_2

sqrt1_2 : Float

The reciprocal of the square root of 2 (1 / sqrt2).

ln2

ln2 : Float

The natural logarithm of 2.

ln10

ln10 : Float

The natural logarithm of 10.

log2e

log2e : Float

The base-2 logarithm of e.

log10e

log10e : Float

The base-10 logarithm of e.

phi

phi : Float

The golden ratio, (1 + sqrt(5)) / 2.

[sqrt2 > 1.4, phi > 1.6, inv_pi < 0.32]
[true, true, true]

half_pi

half_pi : Float

Half of pi (pi / 2).

quarter_pi

quarter_pi : Float

A quarter of pi (pi / 4).

inv_pi

inv_pi : Float

The reciprocal of pi (1 / pi).