From 19951768df0a80d37d8d7cd67e2fab3e05962dbe Mon Sep 17 00:00:00 2001 From: Robert Thompson Date: Tue, 28 Jan 2020 17:51:45 -0500 Subject: [PATCH] Another case where we'd get wrong negatives possibly --- Sources/BigInt/BigInt.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/BigInt/BigInt.swift b/Sources/BigInt/BigInt.swift index 6c69014..9d7a43f 100644 --- a/Sources/BigInt/BigInt.swift +++ b/Sources/BigInt/BigInt.swift @@ -644,6 +644,10 @@ extension BigInt { (quot[j], r) = v.dividingFullWidth((r, uj)) } + if quot[1] > UInt(Int.max) { + quot.append(0) + } + BigInt._dropExcessWords(words: ") return (quotient: BigInt(_uncheckedWords: quot), remainder: BigInt(r)) }