Ben Rimmington
5db4a69e57
[BigInt] Move the LosslessStringConvertible conformance
2020-01-14 02:04:16 +00:00
Ben Rimmington
2419741a7c
[BigInt] Move the CustomStringConvertible conformance
2020-01-14 02:00:12 +00:00
Ben Rimmington
368caf5b3f
[BigInt] Move the Comparable conformance
2020-01-14 01:58:03 +00:00
Ben Rimmington
a799618103
[BigInt] Move the Hashable conformance
2020-01-14 01:56:43 +00:00
Ben Rimmington
dbf743b314
[BigInt] Move the Equatable conformance
2020-01-14 01:54:58 +00:00
Ben Rimmington
2f40de6195
[BigInt] Move _isNegative and _digits properties
2020-01-14 01:52:01 +00:00
Ben Rimmington
38073d2ab5
[BigInt] Move init(words:) and init(bitPattern:)
2020-01-14 01:49:26 +00:00
Ben Rimmington
2863c44182
[BigInt] Remove the isSigned property
2020-01-14 01:42:43 +00:00
Robert Thompson
e490f1fc66
Explicitly implment hash(into:) per @benrimmington feedback
...
Technically, I believe the auto-generated implementation was already
doing exactly this, since `words` is the only stored property of
`BigInt`. However, it rarely hurts to be explicit.
2020-01-13 14:45:48 -05:00
Robert Thompson
67858690eb
Update LosslessStringConvertible initializer
...
as per further suggestions from @Wildchild9, adding in the removing
leading zeros part I missed.
2019-12-30 16:01:04 -05:00
Robert Thompson
cced27a6c0
Missed a spot where things should be alphabetical
2019-12-30 15:50:03 -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
b46dcf96c6
oops, change both occurrences of digitsAndDash
2019-12-30 15:13:26 -05:00
Robert Thompson and Ben Rimmington
eceae6d7bd
Update Sources/BigInt/BigInt.swift
...
As per benrimmington's excellent suggestion
Co-Authored-By: Ben Rimmington <me@benrimmington.com >
2019-12-30 15:12:20 -05:00
Robert Thompson
ac50a90a60
whoops
2019-12-30 10:44:48 -05:00
Robert Thompson
524dc69ae1
slightly refactor LosslessStringConvertible initializer as per PR feedback
2019-12-30 10:41:40 -05:00
Robert Thompson
ea2b6f8deb
BigInt no longer depends on NumericsShims
2019-12-30 10:33:00 -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
Robert Thompson
96d41bcf9f
Initial commit of BigInt
2019-12-30 10:33:00 -05:00
Stephen Canon
2c12891617
Merge pull request #87 from stephentyrone/cleanup-real-conformances
...
Split conformance of Float, Double, Float80 to Real out
2019-12-27 13:42:01 -08:00
Stephen Canon
f25a870cec
Merge pull request #86 from stephentyrone/real-test-cleanup
...
Refactor RealTests
2019-12-27 13:41:33 -08:00
Stephen Canon
3d637e1302
Split conformance of Float, Double, Float80 to Real out into separate files.
...
Also reformat these files to be more closely in line with Swift conventions.
2019-12-27 16:39:26 -05:00
Stephen Canon
b7e48c538c
Refactor RealTests
...
Redesign and rename sanityCheck to assertClose; basic function is the same, but the implementation is a bit more straightforward and it now reports an accurate ulp error and can track maximum error if you want (we want this for some use cases).
Also move the basic sanity checks into one file and the tests that more thoroughly excercise a single function into their own files.
2019-12-27 16:35:41 -05:00
Stephen Canon
7ff707f6f8
Merge pull request #83 from stephentyrone/pown
...
Initial pass at pow(Self, Int) for Float and Double
0.0.3
2019-11-29 23:13:19 -05:00
Stephen Canon
de5399615c
Additional test coverage of saturating values.
...
Also skip out of tests that won't compile and wouldn't make sense anyway on 32b systems.
2019-11-29 23:11:15 -05:00
Stephen Canon
f7842a76db
Capitalization search/replace-o
2019-11-29 23:00:45 -05:00
Stephen Canon
5bf2f828ef
Initial pass at implementing pow(Self,Int) with desired semantics.
...
We don't need to do anything special for Float80, but Float and Double require some handholding because Int values are not always representable.
2019-11-29 22:56:14 -05:00
Stephen Canon
65aac0be46
Add test cases to stress pow(_:Float/Double,:Int)
...
These are the hardest cases to get right; most of the fail at present.
Also some improvements to sanityCheck to handle negative values correctly and treat infinity as the next binade up (which isn't ideal for general use, but is good for this sort of rough testing.)
2019-11-29 22:54:03 -05:00
Stephen Canon
55f33b7769
Merge pull request #81 from stephentyrone/lgamma-shims-linux
...
Add inline decls of lgamma_r and friends on Linux, too.
2019-11-22 09:55:28 -05:00
Stephen Canon
5e978d85a2
Add inline decls of lgamma_r and friends on Linux, too.
2019-11-22 09:47:36 -05:00
Stephen Canon
2b63fc844e
Merge pull request #78 from stephentyrone/lengthSquared
...
Rename unsafeLengthSquared -> lengthSquared
0.0.2
2019-11-20 16:27:40 -05:00
Stephen Canon
f6c2c34910
Rename unsafeLengthSquared -> lengthSquared
...
Also further tweak polar init for Complex to allow (-infinity, θ) when θ is not finite.
2019-11-20 16:15:10 -05:00
Stephen Canon
f1d78c4d98
Merge pull request #77 from stephentyrone/zero-length-polar-init
...
Address behavior of Complex.init(length:phase:)
2019-11-20 16:03:09 -05:00
Stephen Canon and Richard Wei
5931d036ab
Update Sources/Complex/Complex.swift
...
Co-Authored-By: Richard Wei <rxrwei@gmail.com >
2019-11-20 14:56:31 -05:00
Stephen Canon
565839d673
Address behavior of Complex.init(length:phase:)
...
Instead of being failable, adopt the following policy:
- If length is zero or infinity, the phase does not matter.
- Otherwise, the phase must be finite or a precondition failure occurs.
Discussion here: https://github.com/apple/swift-numerics/issues/51
2019-11-20 14:32:19 -05:00
Stephen Canon
f96c6c2066
Rename swift.yml to macos.yml
2019-11-18 16:34:11 -05:00
Stephen Canon
ee54cc2075
Let's tryout workflows
2019-11-13 17:17:32 -05:00
Stephen Canon
4329602833
Merge pull request #74 from ole/delete-alltests
...
Delete RealTests.allTests
0.0.1
2019-11-12 15:35:38 -05:00
Ole Begemann
d875fdbd0b
Delete RealTests.allTests
...
This broke building the tests on Linux because of a missing symbol (ComplexTests.allTests), and with `--enable-test-discovery` we don't need this anyway.
2019-11-12 21:25:42 +01:00
Stephen Canon
39f94b7c7b
Merge pull request #73 from stephentyrone/empty-linuxmain
...
Replace LinuxMain.swift with a fatalError
2019-11-12 14:48:00 -05:00
Stephen Canon
2760aa4ba4
Replace LinuxMain.swift with a fatalError
...
Direct users to run with --enable-test-discovery until it becomes the default.
2019-11-12 14:45:59 -05:00
Stephen Canon
a27ffc7c63
Merge pull request #57 from tachoknight/master
...
Added LinuxMain.swift so numerics can be used on Linux
2019-11-12 14:27:12 -05:00
Stephen Canon
a301489b9a
Merge pull request #72 from ole/patch-1
...
Remove broken link in Real module readme
2019-11-12 14:25:05 -05:00
Ole Begemann
0ed7e786b5
Remove broken link in Real module readme
...
The link target for `[Real]` wasn't defined. I decided toremove the link altogether because the readme would essentially link to itself.
2019-11-12 17:28:36 +01:00
Stephen Canon
1b99c547b0
Merge pull request #69 from stephentyrone/cbrt
...
Defer to libm cbrt for root(x,3).
0.0.0
2019-11-11 08:38:04 -05:00
Stephen Canon and Xiaodi Wu
5d783ce458
Update Sources/Real/ScalarConformances.swift
...
Co-Authored-By: Xiaodi Wu <xiaodi.wu@gmail.com >
2019-11-10 22:19:39 -05:00
Stephen Canon and Xiaodi Wu
3fbc22cbe3
Update Sources/Real/ScalarConformances.swift
...
Co-Authored-By: Xiaodi Wu <xiaodi.wu@gmail.com >
2019-11-10 22:19:30 -05:00
Stephen Canon
e24586e2b1
Defer to libm cbrt for root(x,3).
...
This lets us get exact cases right only platforms where cbrt(x) has sub-ulp accuracy. It doesn't get all the other non-power-of-two roots quite right, and is still dependent on the host system, but 2 and 3 are the most common roots people take by far, so it's a good first step.
2019-11-10 22:02:53 -05:00
Stephen Canon
913a62eb5f
Merge pull request #67 from stephentyrone/document-additive-arithmetic
...
Document AdditiveArithmetic conformance of ElementaryFunctions
2019-11-10 21:14:15 -05:00