pub fn to_fixed(n: f64, p: u32) -> String
JavaScript’s n.toFixed(p): the EXACT binary value rounded half away from zero ((2.5).toFixed(0) = 3, (1.005).toFixed(2) = 1.00).
n.toFixed(p)
(2.5).toFixed(0)
3
(1.005).toFixed(2)
1.00