Module substrate_fixed::consts

source ·
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