Expand description
This module contains constants.
The constants have the maximum precision possible for a fixed-point number, and are rounded down at that precision.
§Examples
use substrate_fixed::{consts, types::I4F28};
let tau = I4F28::from_num(consts::TAU);
println!("τ = 2π with eight binary places is {:.8b}", tau);
assert_eq!(format!("{:.8b}", tau), "110.01001000");
println!("τ = 2π with six decimal places is {:.8}", tau);
assert_eq!(format!("{:.8}", tau), "6.28318531");Constants§
- E
- e = 2.71828…
- FRAC_
1_ PI - 1/π = 0.318309…
- FRAC_
1_ SQRT_ 2 - 1/√2 = 0.707106…
- FRAC_
1_ TAU - 1/τ = 0.159154…
- FRAC_
2_ PI - 2/π = 0.636619…
- FRAC_
2_ SQRT_ PI - 2/√π = 1.12837…
- FRAC_
2_ TAU - 2/τ = 0.318309…
- FRAC_
4_ TAU - 4/τ = 0.636619…
- FRAC_
PI_ 2 - π/2 = 1.57079…
- FRAC_
PI_ 3 - π/3 = 1.04719…
- FRAC_
PI_ 4 - π/4 = 0.785398…
- FRAC_
PI_ 6 - π/6 = 0.523598…
- FRAC_
PI_ 8 - π/8 = 0.392699…
- FRAC_
TAU_ 2 - τ/2 = 3.14159…
- FRAC_
TAU_ 3 - τ/3 = 2.09439…
- FRAC_
TAU_ 4 - τ/4 = 1.57079…
- FRAC_
TAU_ 6 - τ/6 = 1.04719…
- FRAC_
TAU_ 8 - τ/8 = 0.785398…
- FRAC_
TAU_ 12 - τ/12 = 0.523598…
- LN_2
- ln 2 = 0.693147…
- LN_10
- ln 10 = 2.30258…
- LOG2_10
- log2 10 = 3.32192…
- LOG2_E
- log2 e = 1.44269…
- LOG10_2
- log10 2 = 0.301029…
- LOG10_E
- log10 e = 0.434294…
- PI
- π = 3.14159…
- SQRT_2
- √2 = 1.41421…
- TAU
- τ = 6.28318…