mirror of
https://github.com/apple/swift-numerics
synced 2026-11-28 05:14:31 +00:00
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:
1 parent
e41c631052
commit
90d5ddd1f6
1 file changed
+3
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user