94 Commits
Author SHA1 Message Date
Stephen Canon a2aa24d236 Merge pull request #96 from benrimmington/complex-unkeyed
[Complex] Encode and decode using unkeyedContainer
0.0.4
2020-01-22 13:43:51 -05:00
Ben Rimmington eda432142d [Complex] Encode and decode using unkeyedContainer 2020-01-22 18:34:20 +00:00
Stephen Canon 7bd2909875 Merge pull request #91 from apple/FieldProtocol
Introduce AlgebraicField protocol
2020-01-20 13:35:59 -05:00
Stephen Canon 323542cba1 Add short notes to README docs on AlgebraicField. 2020-01-19 16:06:31 -05:00
Stephen Canon 98f3d25fe8 Rename Field -> AlgebraicField
We might walk this back in the future, but for the short-term let's avoid stomping on the generic term "Field".
2020-01-19 15:53:35 -05:00
Stephen Canon f3e1e15312 Merge pull request #93 from stephentyrone/Euclidean
s/euclidean/Euclidean/
2020-01-16 11:13:16 -05:00
Stephen Canon 8cbda03867 s/euclidean/Euclidean/ 2020-01-16 11:12:46 -05:00
Stephen Canon b6839260cb Add some clarification to documentation of .reciprocal. 2020-01-16 11:11:56 -05:00
Stephen Canon 1879299216 Avoid shadowing function argument by using a different name for local var. 2020-01-13 20:56:48 -05:00
Stephen Canon 53af148f0f Introduce Field protocol
For now, this mostly allows one to write code generic over Real and Complex types. TBD whether it should also include finite fields, or be restricted to characteristic-zero. Also bikeshedding to be done on exactly what operations should fall into this protocol and what it should be named. This is just to get discussion started.
2020-01-13 16:19:19 -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 CanonandRichard 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 CanonandXiaodi 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 CanonandXiaodi 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
Stephen Canon 6d904ea56c Add documentation for AdditiveArithmetic conformance of ElementaryFunctions 2019-11-10 21:12:37 -05:00
Stephen Canon d064661dba Merge pull request #66 from NevinBR/patch-2
Made ElementaryFunctions refine AdditiveArithmetic

Discussion here: https://github.com/apple/swift-numerics/issues/56
2019-11-10 20:57:46 -05:00
NevinBR 6195693e3a Made ElementaryFunctions refine AdditiveArithmetic 2019-11-10 19:58:07 -05:00
Stephen Canon 3519620ac6 Merge pull request #65 from stephentyrone/split-codable-make-debugDecription-unconditional
Split Codable conformance of Complex into Encodable and Decodable. NFC.
2019-11-10 14:59:18 -05:00
Stephen Canon 0ddfd0ead7 Split Codable conformance of Complex into Encodable and Decodable. NFC.
Also make conformance to CustomDebugStringConvertible unconditional using String(reflecting:) on x and y.
2019-11-10 14:32:09 -05:00
Stephen Canon db2046b7ed Merge pull request #63 from NevinBR/patch-1
Fixed typo in a comment
2019-11-10 13:58:16 -05:00
NevinBR ab19494638 Fixed typo in a comment 2019-11-10 10:35:22 -05:00
Stephen Canon d065a84750 Merge pull request #61 from Wildchild9/master
Fixed `Complex` division by zero to return .infinity
2019-11-09 15:38:50 -05:00
Noah Wilder 6ac60de457 Added two more test cases for Complex division by zero 2019-11-09 15:18:30 -05:00
Noah Wilder d5e0caa6f8 Added test cases for division by zero 2019-11-09 15:11:55 -05:00