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
| Name | Value | Description |
|---|---|---|
PI | 3.14159… | π — ratio of circumference to diameter |
TAU | 6.28318… | τ = 2π — full circle constant |
E | 2.71828… | Euler's number — base of natural logarithm |
PHI | 1.61803… | Golden ratio (1 + √5) / 2 |
SQRT_2 | 1.41421… | √2 |
SQRT_3 | 1.73205… | √3 |
SQRT_5 | 2.23606… | √5 |
SQRT_1_2 | 0.70710… | 1/√2 = √2/2 |
LN_2 | 0.69314… | ln(2) |
LN_10 | 2.30258… | ln(10) |
LOG2_E | 1.44269… | log₂(e) |
LOG10_E | 0.43429… | log₁₀(e) |
Machine Precision
| Name | Description |
|---|---|
EPSILON_F32 | Machine epsilon for 32-bit float (~1.19×10⁻⁷) |
EPSILON_F64 | Machine epsilon for 64-bit float (~2.22×10⁻¹⁶) |
MAX_F32 | Maximum representable f32 |
MAX_F64 | Maximum representable f64 |
MIN_POSITIVE_F64 | Smallest positive f64 |
INF | Positive infinity |
NEG_INF | Negative infinity |
NAN | Not-a-Number |