mirror of
https://github.com/apple/swift-numerics
synced 2026-11-29 05:24:24 +00:00
Remove superfluous CustomStringConvertible impl
This commit is contained in:
1 parent
fac716fdb2
commit
d36d9ce02e
2 files changed
+5
-20
No files matched your search
@@ -89,26 +89,6 @@ extension BigInt: Comparable {
|
||||
}
|
||||
}
|
||||
|
||||
extension BigInt: CustomStringConvertible {
|
||||
|
||||
public var description: String {
|
||||
var result = ""
|
||||
|
||||
if words.count == 1 {
|
||||
return Int64(bitPattern: UInt64(words[0])).description
|
||||
} else {
|
||||
var next = abs(self)
|
||||
while next != 0 {
|
||||
let digit: BigInt
|
||||
(next, digit) = BigInt._div(lhs: next, rhs: 10)
|
||||
result += "\(digit.words[0])"
|
||||
}
|
||||
}
|
||||
|
||||
return (self < 0 ? "-" : "") + String(result.reversed())
|
||||
}
|
||||
}
|
||||
|
||||
extension BigInt: LosslessStringConvertible {
|
||||
|
||||
public init?(_ description: String) {
|
||||
|
||||
@@ -112,6 +112,11 @@ final class BigIntTests: XCTestCase {
|
||||
XCTAssertEqual(baz, bar)
|
||||
}
|
||||
|
||||
func testThing() {
|
||||
let foo = BigInt("-1234567890123456789012345678901234567890")!
|
||||
XCTAssertTrue(foo != 0)
|
||||
}
|
||||
|
||||
func testComparable() {
|
||||
let foo = BigInt("1234567890123456789012345678901234567890")!
|
||||
let bar = foo * foo
|
||||
|
||||
Reference in new issue
Block a user