Fix failing tests (@benrimminton: it turned out simple)

If the last computed digit of a BinaryFloatingPoint source is > Int.max,
we need to add an extra zero digit to the end so we're not negative!
This commit is contained in:
Robert Thompson committed 2020-01-21 16:59:28 -05:00
1 parent e41c631052
commit 90d5ddd1f6
1 file changed
+3
+3
View File
@@ -358,6 +358,9 @@ extension BigInt: BinaryInteger {
float = (float / radix).rounded(.towardZero)
} while float != 0
if let last = words.last, last >= Int.max {
words.append(0)
}
self.words = words
}