WIP refactor plant_state
This commit is contained in:
10
rust/src/util.rs
Normal file
10
rust/src/util.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
pub trait LimitPrecision {
|
||||
fn to_precision(self, presision: i32) -> self;
|
||||
}
|
||||
|
||||
impl LimitPrecision for f32 {
|
||||
fn to_precision(self, precision: i32) -> self {
|
||||
(self * (10_f32).powi(precision)).round() / (10_f32).powi(precision)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user