Fix ceil implementation in NativeFloat64

This commit is contained in:
RunasSudo 2021-06-07 20:39:49 +10:00
parent d0df27a55c
commit 30b68d4992
No known key found for this signature in database
GPG Key ID: 7234E476BF21C61A
1 changed files with 2 additions and 1 deletions

View File

@ -70,9 +70,10 @@ impl Number for Fixed {
fn ceil_mut(&mut self, dps: usize) {
// Only do something if truncating
if dps < get_dps() {
self.0 += IBig::one();
self.0 -= IBig::one();
let factor = IBig::from(10).pow(get_dps() - dps);
self.0 /= &factor;
self.0 += IBig::one();
self.0 *= factor;
}
}