Extension

rmath.constants

Mathematical and machine-precision constants as module-level attributes.

example.py
import rmath.constants as rc

circumference = 2 * rc.PI * radius
print(rc.E)       # 2.718281828459045
print(rc.PHI)     # 1.618033988749895

Mathematical Constants

NameValueDescription
PI3.14159…π — ratio of circumference to diameter
TAU6.28318…τ = 2π — full circle constant
E2.71828…Euler's number — base of natural logarithm
PHI1.61803…Golden ratio (1 + √5) / 2
SQRT_21.41421…√2
SQRT_31.73205…√3
SQRT_52.23606…√5
SQRT_1_20.70710…1/√2 = √2/2
LN_20.69314…ln(2)
LN_102.30258…ln(10)
LOG2_E1.44269…log₂(e)
LOG10_E0.43429…log₁₀(e)

Machine Precision

NameDescription
EPSILON_F32Machine epsilon for 32-bit float (~1.19×10⁻⁷)
EPSILON_F64Machine epsilon for 64-bit float (~2.22×10⁻¹⁶)
MAX_F32Maximum representable f32
MAX_F64Maximum representable f64
MIN_POSITIVE_F64Smallest positive f64
INFPositive infinity
NEG_INFNegative infinity
NANNot-a-Number