Skip to content

Commit fc387fe

Browse files
alberdingk-thijmeldruin
authored andcommitted
Loosen bounds in pick_appropriate_units
Change strict inequality to inequality for the inner loop of pick_appropriate_units, so that if a value is set to 1.0, then the unit returned follows a user's expectation. Closes #24.
1 parent eeda61f commit fc387fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/measurement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub trait Measurement {
6565
fn pick_appropriate_units(&self, list: &[(&'static str, f64)]) -> (&'static str, f64) {
6666
for &(unit, ref scale) in list.iter().rev() {
6767
let value = self.as_base_units() / scale;
68-
if value > 1.0 || value < -1.0 {
68+
if value >= 1.0 || value <= -1.0 {
6969
return (unit, value);
7070
}
7171
}

0 commit comments

Comments
 (0)