Module fixed::consts

source ·
Expand description

Mathematical constants.

The constants have the maximum precision possible for a fixed-point number, and are rounded down at that precision.

§Examples

use fixed::{consts, types::I4F28};
let tau = I4F28::from_num(consts::TAU);
println!("τ = 2π with eight binary places is {tau:.8b}");
assert_eq!(format!("{tau:.8b}"), "110.01001000");
println!("τ = 2π with eight decimal places is {tau:.8}");
assert_eq!(format!("{tau:.8}"), "6.28318531");

Constants§