fix comment

This commit is contained in:
Simon Gardling 2022-03-30 13:36:30 -04:00
parent c0996d91db
commit a49b99e274

View File

@ -239,8 +239,9 @@ impl SerdeValueHelper {
/// Rounds f64 to `n` decimal places /// Rounds f64 to `n` decimal places
pub fn decimal_round(x: f64, n: usize) -> f64 { pub fn decimal_round(x: f64, n: usize) -> f64 {
let large_number: f64 = 10.0_f64.powf(n as f64); // 10^n let large_number: f64 = 10.0_f64.powf(n as f64); // 10^n
(x * large_number).round() / large_number // round and devide in order to cut
// off after the `n`th decimal place // round and devide in order to cutoff after the `n`th decimal place
(x * large_number).round() / large_number
} }
/// Helper that assists with using newton's method of finding roots, iterating /// Helper that assists with using newton's method of finding roots, iterating