Mathematical constants.
High-precision constants frequently needed across scientific computing.
All values are IEEE-754 double precision (≈ 15-17 significant digits).
On the Erlang target these are plain const floats. The BEAM JIT inlines
them at call sites, so there is no runtime lookup cost. For tables that
must be shared across many processes consider :persistent_term directly
from the calling code.
Categories
- Circle:
pi, tau, half_pi, quarter_pi, inv_pi
- Roots:
sqrt_2, sqrt_3, sqrt_pi, sqrt_2pi, sqrt_tau
- Inverses:
inv_sqrt_2, inv_sqrt_pi, inv_sqrt_2pi
- Logarithms:
e, ln_2, ln_10, log2_e, log10_e
- Special:
phi (golden ratio), euler_gamma, catalan
- Numeric limits:
epsilon, max_float, min_positive
pub const deg_to_rad: Float
Degrees → radians multiplier (π / 180).
pub const euler_gamma: Float
Euler-Mascheroni constant γ.
pub const inv_phi: Float
1 / φ - reciprocal of golden ratio.
pub const inv_sqrt_2: Float
1 / √2 - useful for GELU exact form.
pub const inv_sqrt_2pi: Float
1 / √(2π) - Gaussian PDF coefficient.
pub const inv_sqrt_pi: Float
pub const ln_10: Float
ln(10) - natural log of 10.
pub const ln_2: Float
ln(2) - natural log of 2.
pub const max_float: Float
Maximum representable positive finite double.
pub const min_positive: Float
Minimum positive normal double.
pub const phi: Float
φ (golden ratio): (1 + √5) / 2
pub const pi: Float
π (ratio of circumference to diameter).
pub const quarter_pi: Float
pub const rad_to_deg: Float
Radians → degrees multiplier (180 / π).
pub const sqrt_2pi: Float
√(2π) - normalization constant for Gaussian PDF.
pub const sqrt_tau: Float
pub const tau: Float
τ = 2π (one full turn in radians).
pub const two_over_pi: Float