Fix division by not returning a weirdly-shifted remainder when the quotient is zero.

This commit is contained in:
2018-04-02 15:24:48 -04:00
parent fa33de88db
commit 80f57b9f22

View File

@@ -573,7 +573,7 @@ fn divmod(quotient: &mut Vec<u64>, remainder: &mut Vec<u64>,
let n = x.contents.len(); let n = x.contents.len();
let t = y.contents.len(); let t = y.contents.len();
if n < t { if n < t {
remainder.append(&mut x.contents); remainder.extend_from_slice(&inx);
return; return;
} }
// Also, it's real convient for n and t to be greater than one, which we // Also, it's real convient for n and t to be greater than one, which we