changes from my egui fork
This commit is contained in:
@@ -531,7 +531,7 @@ impl FunctionEntry {
|
||||
}
|
||||
|
||||
// return value rounded to 8 decimal places
|
||||
Some(crate::misc::decimal_round(integral_data.1, 8))
|
||||
Some(emath::round_to_decimals(integral_data.1, 8))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
|
||||
10
src/lib.rs
10
src/lib.rs
@@ -28,8 +28,14 @@ pub use crate::{
|
||||
function_entry::{FunctionEntry, Riemann},
|
||||
math_app::AppSettings,
|
||||
misc::{
|
||||
decimal_round, format_bytes, hashed_storage_create, hashed_storage_read,
|
||||
option_vec_printer, resolution_helper, step_helper, SteppedVector,
|
||||
// decimal_round,
|
||||
format_bytes,
|
||||
hashed_storage_create,
|
||||
hashed_storage_read,
|
||||
option_vec_printer,
|
||||
resolution_helper,
|
||||
step_helper,
|
||||
SteppedVector,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
12
src/misc.rs
12
src/misc.rs
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user