pub fn floor<T: Float>(number: T, decimal_places: u32) -> T
Expand description
Rounds the number down to the given number of decimal places
ยงExamples
use common_math::rounding::floor;
assert_eq!(floor(123.456_f64, 2), 123.45_f64);
assert_eq!(floor(123.456_f64, 0), 123_f64);
assert_eq!(floor(123.454_f32, 2), 123.454_f32);