From f06f83583f466b53950ab4d8f42d1e40303e440b Mon Sep 17 00:00:00 2001 From: Adam Wick Date: Wed, 4 Apr 2018 18:13:50 -0400 Subject: [PATCH] Whoops. Don't correct for rounding if there's no remainder on the division. --- src/cryptonum/signed.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cryptonum/signed.rs b/src/cryptonum/signed.rs index 1fd0e28..b159024 100644 --- a/src/cryptonum/signed.rs +++ b/src/cryptonum/signed.rs @@ -152,7 +152,7 @@ impl<'a> DivAssign<&'a SCN> for SCN { let copy = self.value.contents.clone(); divmod(&mut self.value.contents, &mut remainder, ©, &rhs.value.contents); - if self.negative { + if self.negative && !remainder.is_empty() { let one = UCN{ contents: vec![1] }; self.sub_assign(SCN{ negative: false, value: one}); }