Ben Rimmington
ceee280ebe
[BigIntTests] Don't use the CLongDouble typealias
2020-01-21 18:09:39 +00:00
Ben Rimmington
3501fa7c61
[BigInt] Restore precondition message for inf/nan
2020-01-21 17:30:47 +00:00
Ben Rimmington
ca75d2d124
[BigInt] Move pow(_:_:) into test-only extension
2020-01-21 16:24:51 +00:00
Ben Rimmington
ffdaf86868
[BigIntTests] Change fac(BigInt(512)) to BigInt.fac(512)
2020-01-21 13:30:21 +00:00
Ben Rimmington
bf9afea2eb
[BigIntTests] Add testFloatingPoint_signalingNaN()
2020-01-21 08:36:48 +00:00
Ben Rimmington
4c425513cd
[BigIntTests] Use fac(_:) to test Strideable
2020-01-20 13:05:49 +00:00
Ben Rimmington
fc7b3bf44f
[BigIntTests] Update expected descriptions
2020-01-20 11:48:46 +00:00
Ben Rimmington
0dee6d0927
[BigIntTests] Move other test methods
2020-01-20 11:05:12 +00:00
Ben Rimmington
cfc63e8adc
[BigIntTests] Move testFloatingPoint_...() methods
2020-01-20 10:30:16 +00:00
Ben Rimmington
01c30961ef
[BigIntTests] Move the typealias of CLongDouble
2020-01-19 20:31:22 +00:00
Ben Rimmington
05a45984d9
[BigInt] Update signum(), add testSignum()
2020-01-19 19:48:07 +00:00
Ben Rimmington
cfc2cd7c97
[BigIntTests] Add measure {} to testFactorial()
2020-01-19 12:32:11 +00:00
Ben Rimmington
98023c3575
[BigInt] Combine *= and << into simpler <<=
2020-01-19 10:31:39 +00:00
Ben Rimmington
506ea36331
[BigIntTests] Update testFloatingPoint_random()
2020-01-19 09:37:20 +00:00
Ben Rimmington
1b733de54a
[BigInt] Fix initializers with BinaryFloatingPoint
2020-01-18 19:44:27 +00:00
Ben Rimmington
937c292898
[BigIntTests] Add testFloatingPoint_...() methods
...
The testFloatingPoint_greatestFiniteMagnitude() method currently fails.
2020-01-18 19:38:05 +00:00
Robert Thompson
49121f353a
Merge pull request #4 from benrimmington/BigInt
...
[BigIntTests] Add min and max Int1024 descriptions
2020-01-17 14:23:20 -05:00
Ben Rimmington
e632de88c4
[BigIntTests] Add testFactorial()
2020-01-17 13:51:21 +00:00
Ben Rimmington
b03af80076
[BigInt] Change self = -self to self.negate()
2020-01-17 07:33:36 +00:00
Ben Rimmington
6f4374cd99
[BigIntTests] Add min and max Int1024 descriptions
2020-01-17 07:32:52 +00:00
Robert Thompson
d36d9ce02e
Remove superfluous CustomStringConvertible impl
2020-01-16 17:08:52 -05:00
Robert Thompson
fac716fdb2
Fix implementation of <
...
Previously, all BigInts were less than themselves. This is no longer
true. Discovered thanks to @lorentey and @benrimmington re: discussion
on explicit implementation of `!=`.
2020-01-16 15:15:37 -05:00
Robert Thompson
7ca51a3e50
normalize words in the BinaryInteger bitPattern init
...
as per @lorentey
2020-01-16 14:25:46 -05:00
Robert Thompson
1ddbbfe0d1
Rename internal init as per @lorentey
2020-01-16 14:24:24 -05:00
Robert Thompson
eab5a94499
Merge pull request #3 from benrimmington/BigInt
...
[BigInt] Update tests and SignedNumeric operator
2020-01-16 14:19:55 -05:00
Ben Rimmington
a6ecb7442a
[BigIntTests] Update testRadicesAndNumerals()
2020-01-16 14:50:19 +00:00
Ben Rimmington
2410717a17
[BigInt] Update the SignedNumeric prefix operator
2020-01-16 13:12:29 +00:00
Ben Rimmington
7ae61f775b
[BigIntTests] Update testLosslessStringConvertible
2020-01-16 13:04:39 +00:00
Ben Rimmington
fe212356fd
[BigIntTests] Rename testRandomDescriptions()
2020-01-16 12:40:02 +00:00
Ben Rimmington
830927ecbb
[BigIntTests] Rewrite testMinMaxDescriptions()
2020-01-16 12:19:33 +00:00
Robert Thompson
fd8049e481
remove debugging code from test
2020-01-15 15:25:11 -05:00
Robert Thompson
0b121fd774
Fix failing tests (@benrimmington)
...
We were not correctly handling the case where two single-word operands
added up to a number > Int.max. Also, negate (and `-`) was not removing
excess words, resulting in identical numbers not comparing equal!
2020-01-15 15:13:58 -05:00
Robert Thompson
72f1cb3554
Merge branch 'BigInt' of github.com:rothomp3/swift-numerics into BigInt
2020-01-15 14:15:36 -05:00
Robert Thompson
0e58379b4f
explicitly call out TAOCP by Knuth
2020-01-15 14:15:27 -05:00
Robert Thompson
ddaf8be1a2
Merge pull request #2 from benrimmington/BigInt
...
[BigInt] Update LosslessStringConvertible, etc.
2020-01-15 14:07:37 -05:00
Ben Rimmington
9ddc664ef1
[BigIntTests] Remove messages from XCTAssert calls
2020-01-15 06:51:21 +00:00
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
8c378528de
[BigInt] Update the Codable conformance
2020-01-15 00:59:46 +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
3a4cc1c623
Merge pull request #1 from benrimmington/BigInt
...
[BigInt] Reorganize into extensions by conformance
2020-01-14 14:47:02 -05:00
Ben Rimmington
4d7e4e9b97
[BigInt] Rename private _findQhat method
2020-01-14 04:44:44 +00:00
Ben Rimmington
3c916262e0
[BigInt] Update bitWidth and magnitude properties
2020-01-14 02:46:47 +00:00
Ben Rimmington
831f06ac78
[BigInt] Add the MARK and TODO comments
2020-01-14 02:44:38 +00:00
Ben Rimmington
d15400e6ab
[BigInt] Add the Words typealias
2020-01-14 02:39:59 +00:00