Skip to content

Commit

Permalink
Avoid using round as it is not available in some targets
Browse files Browse the repository at this point in the history
  • Loading branch information
eldruin committed May 4, 2019
1 parent 85c0896 commit 2c093af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scaled_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl ScaledDevice for ic::Kxcj9_1008 {
if threshold < 0.0 || threshold > 8.0 {
Err(Error::InvalidSetting)
} else {
Ok((threshold * 16.0).round() as u8)
Ok((threshold * 16.0 + 0.5) as u8)
}
}
}
Expand Down Expand Up @@ -72,7 +72,7 @@ impl ScaledDevice for ic::Kxcj9_1018 {
if threshold < 0.0 || threshold > 16.0 {
Err(Error::InvalidSetting)
} else {
Ok((threshold * 8.0).round() as u8)
Ok((threshold * 8.0 + 0.5) as u8)
}
}
}
Expand Down

0 comments on commit 2c093af

Please sign in to comment.