From 30b68d499254b9579ae8a5c98f70a660eb462b9c Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Mon, 7 Jun 2021 20:39:49 +1000 Subject: [PATCH] Fix ceil implementation in NativeFloat64 --- src/numbers/fixed.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/numbers/fixed.rs b/src/numbers/fixed.rs index ed135ff..d9f3e30 100644 --- a/src/numbers/fixed.rs +++ b/src/numbers/fixed.rs @@ -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; } }