Commit Graph
11 Commits
Author SHA1 Message Date
Ben Rimmington b39dd05db3 [BigIntTests] Update the testExample() method 2020-01-15 06:44:41 +00:00
Ben Rimmington 1cb69383a5 [BigIntTests] Wrap to 80 characters 2020-01-15 03:53:16 +00:00
Ben Rimmington c9d72fc3ae [BigIntTests] Trim trailing whitespace 2020-01-15 03:34:14 +00:00
Ben Rimmington 4ec520a726 [BigIntTests] Update the testCodable() method
Top-level JSON fragments might fail on Linux, so encode Range<BigInt> instead.

<https://bugs.swift.org/browse/SR-6163>
2020-01-15 03:30:50 +00:00
Ben Rimmington 3cf0b0cf74 [BigInt] Update the LosslessStringConvertible init
This performs 6x faster (measured with a 1000-digit string).

But it doesn't fix the testMinMaxDescriptions() failures.
2020-01-15 00:47:04 +00:00
Ben Rimmington f6a3d2d4e4 [BigIntTests] Add testMinMaxDescriptions() method
This currently fails for:

BigInt(Int64.min) - 2
BigInt(Int64.min) - 1
BigInt(Int64.max) + 1
BigInt(Int64.max) + 2
2020-01-15 00:17:17 +00:00
Robert Thompson 036ab5fe94 Conform to Codable with default implementation
Since we have only a single stored property which itself already
conforms to `Codable`, there's no need to go down the rabbit hole of
explicitly implementing it. If someone wants to do it to produce a more
human-readable JSON (eg, as a string instead of an array of integers),
then you're welcome to.
2020-01-14 15:07:08 -05:00
Robert Thompson 7c6e2ce0d8 Explicitly implement public mutating func negate()
As per the TODO put in by @benrimmington. I'm not 100% sure this is
actually better than the default implementation provided by
`SignedNumeric`, but there's a chance it is.
2020-01-14 15:00:38 -05:00
Robert Thompson 821fcbd6a4 Update following suggestions from @benrimmington
Includes reformatting to use 2-space indentation and the correct file
headers, among other simplifications.
2019-12-30 15:46:18 -05:00
Robert Thompson cb56525312 Address PR feedback
Eliminate unnecessary math function calls, and also handle floating
point edge cases better.
2019-12-30 10:33:00 -05:00
Robert Thompson bc2f9fb7c6 Use NumericShims for math functions 2019-12-30 10:33:00 -05:00