Commit Graph
177 Commits
Author SHA1 Message Date
Robert Thompson cc5f7e5d18 Apparently the @testable was only working in Xcode 2020-01-28 17:55:39 -05:00
Robert Thompson feeac39506 Whoops, this is better 2020-01-28 17:53:23 -05:00
Robert Thompson 19951768df Another case where we'd get wrong negatives possibly 2020-01-28 17:51:45 -05:00
Robert Thompson 87900161d6 Normalize the remainder! 2020-01-28 17:36:55 -05:00
Robert Thompson 6e0f0094dc fix tests compiling on arm32 2020-01-28 16:09:32 -05:00
Robert Thompson 7d6e5cda3e Clean up division a bit more 2020-01-28 16:02:30 -05:00
Robert Thompson e4f5257d0a fix division
Re-write _findQhat from scratch, add check for division by single digit
number in _div
2020-01-28 14:05:22 -05:00
Robert Thompson 9e1a1f5e8a Merge branch 'BigInt' of github.com:rothomp3/swift-numerics into BigInt 2020-01-27 12:31:33 -05:00
Robert Thompson 7026eb4085 more tests for division 2020-01-27 12:31:26 -05:00
Robert Thompson 1a29830c82 Merge pull request #6 from benrimmington/BigInt
[BigIntTests] Use generic testBinaryFloatingPoint
2020-01-27 12:17:45 -05:00
Ben Rimmington 5919d3f48f [BigIntTests] Use generic testBinaryFloatingPoint 2020-01-27 15:17:43 +00:00
Robert Thompson e3d01dd680 First step to increasing test coverage 2020-01-22 10:16:01 -05:00
Robert Thompson 90d5ddd1f6 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!
2020-01-21 16:59:28 -05:00
Robert Thompson e41c631052 Merge pull request #5 from benrimmington/BigInt
[BigInt] Add tests for floating-point conversions
2020-01-21 16:49:41 -05:00
Ben Rimmington 6e85aa2bbd [BigInt] Revert the BinaryFloatingPoint conversion 2020-01-21 19:47:19 +00:00
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