changes from my egui fork

This commit is contained in:
Simon Gardling
2022-05-13 14:13:19 -04:00
parent 2d63c1b5f7
commit e2c2713633
6 changed files with 43 additions and 35 deletions

View File

@@ -188,13 +188,13 @@ impl EguiHelper for Vec<Value> {
fn to_tuple(&self) -> Vec<(f64, f64)> { self.iter().map(|ele| (ele.x, ele.y)).collect() }
}
/// Rounds f64 to `n` decimal places
pub fn decimal_round(x: f64, n: usize) -> f64 {
let large_number: f64 = 10.0_f64.powf(n as f64); // 10^n
// /// Rounds f64 to `n` decimal places
// pub fn decimal_round(x: f64, n: usize) -> f64 {
// let large_number: f64 = 10.0_f64.powf(n as f64); // 10^n
// round and devide in order to cutoff after the `n`th decimal place
(x * large_number).round() / large_number
}
// // 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 over data `data`
/// `threshold` is the target accuracy threshold