Richard Wei
488e250259
Make 'Complex' differentiable.
...
* Conform `Complex` to `Differentiable`.
* Define derivatives for `init(_:_:)`, `real`, `imaginary`, `conjugate`, `+(_:_:)`, `-(_:_:)`, `*(_:_:)`, `/(_:_:)`.
Gated under `#if canImport(_Differentiation)`.
2020-04-22 13:35:36 -07:00
Stephen Canon
6e77726ac9
Merge pull request #109 from stephentyrone/swiftpm-directions
...
Add basic directions for adding a swiftpm dependency.
2020-04-15 11:44:55 -04:00
Stephen Canon
c14381db8c
Add basic directions for adding a swiftpm dependency.
2020-04-13 10:58:41 -04:00
Stephen Canon
8978159f21
Merge pull request #108 from stephentyrone/better-pown-float16
...
Somewhat better implementation of pow(x,n) for Float16.
2020-04-10 16:19:54 -04:00
Stephen Canon
59444343c4
Somewhat better implementation of pow(x,n) for Float16.
2020-04-10 16:16:25 -04:00
Stephen Canon
ee082efdaf
Fix bug for very large exponents pow(Float/Double, Int).
...
Just-added tests expose this issue, where the split of n into high/low parts could produce parts with different signs. If both x**high and x**low then overflow and underflow, the resulting computation would be 0*inf (or inf*0) and produce NaN instead of either zero or infinity.
2020-04-10 11:51:57 -04:00
Stephen Canon
6dc8bb4d17
Merge pull request #107 from stephentyrone/bugfix-pown
...
Bugfix integer power function for Float and Double with very large exponents.
2020-04-10 11:51:11 -04:00
Stephen Canon
ff6a0ff2a5
Fix bug for very large exponents pow(Float/Double, Int).
...
Just-added tests expose this issue, where the split of n into high/low parts could produce parts with different signs. If both x**high and x**low then overflow and underflow, the resulting computation would be 0*inf (or inf*0) and produce NaN instead of either zero or infinity.
2020-04-10 11:46:22 -04:00
Stephen Canon
4db6faa3e7
Additional test coverage for pow with integer exponents.
...
These cases expose a bug in the current implementation; because the split of the exponent into high and low parts may produce numbers with different signs, if both parts overflow or underflow, we can end up with 0 * infinity = NaN, when the result should actually be either zero or infinity.
2020-04-10 10:11:19 -04:00
Stephen Canon
75e4116989
Additional test coverage for Float16 power with integer exponents.
2020-04-10 10:09:34 -04:00
Stephen Canon
9e1645a495
Additional test coverage for pow with integer exponents.
...
These cases expose a bug in the current implementation; because the split of the exponent into high and low parts may produce numbers with different signs, if both parts overflow or underflow, we can end up with 0 * infinity = NaN, when the result should actually be either zero or infinity.
2020-04-10 10:08:59 -04:00
Stephen Canon
29d25b62c5
Merge pull request #106 from stephentyrone/Float16-support
...
Add Real conformance for Float16.
2020-04-08 15:21:36 -04:00
Stephen Canon
a35f5ba889
Add Real conformance for Float16.
2020-04-08 15:14:48 -04:00
Stephen Canon
fc9ff1401d
Merge pull request #104 from compnerd/swapfiles
...
gitignore: ignore vim swap files
2020-03-20 10:52:17 -04:00
Saleem Abdulrasool
33d10c02cd
gitignore: ignore vim swap files
2020-03-13 13:02:38 -07:00
Stephen Canon
5dfc460876
Merge pull request #97 from stephentyrone/prefix-modules
...
Enable name lookup for modules by suffixing `Module` when needed to break ambiguity.
In particular, the following module renames are applied:
- Real -> RealModule
- Complex -> ComplexModule
This is a source-breaking change, if you currently directly import these modules. (sorry!)
The fix is to either import Numerics instead, or to use the new, suffixed, names. The good news is that fixing this should require only a straightforward search-and-replace for anyone affected.
0.0.5
2020-02-21 09:26:16 -05:00
Stephen Canon
014ce562a4
Update README.md
2020-02-21 09:22:40 -05:00
Stephen Canon
9dba38cc1a
Update README.md
2020-02-21 09:22:40 -05:00
Stephen Canon
0fa2cd458e
Update README.md
2020-02-21 09:22:40 -05:00
Stephen Canon
be3d09ab26
Update README.md
2020-02-21 09:22:40 -05:00
Stephen Canon
ba4469d3fd
Update README.md
2020-02-21 09:22:40 -05:00
Stephen Canon
6951647e4c
Update README.md
2020-02-21 09:22:40 -05:00
Stephen Canon
a7c141e818
Update README.md
2020-02-21 09:22:40 -05:00
Stephen Canon
76954c06a7
Back to trailing 'Module'
2020-02-21 09:22:40 -05:00
Stephen Canon
4352c3a6a1
Put an underscore between the module prefix and name.
...
Ideally we'd be able to use Numerics.Module instead of underscore, but we can't always get what we want.
2020-02-21 09:22:40 -05:00
Stephen Canon
43052f0819
Prefix modules with "Numerics"; use underscored prefix for NumericsShims.
2020-02-21 09:22:40 -05:00
Robert Thompson
5ea7711e02
Probably a slightly faster way to get trailingZeroBitCOunt
2020-02-19 15:15:42 -05:00
Robert Thompson
b74c1ce133
Fix trailingZeroBitCount as per @nixberg
...
Also add a couple tests for it
2020-02-14 16:23:37 -05:00
Robert Thompson
cd88f161eb
Fix two tests for arm32, should all pass now
2020-01-29 10:48:46 -05:00
Robert Thompson
aaeb9029e9
Another fix for conversion of multi-word Ints
2020-01-29 10:42:52 -05:00
Robert Thompson
52e7e70caf
Actual fix for multi-word integer types
2020-01-29 10:07:34 -05:00
Robert Thompson
caeeaaa9dd
Another fix for arm32 and actually for anything with multi-word ints
...
UInt64, Int64, etc have more than one word on 32-bit architectures
2020-01-29 09:55:10 -05:00
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
Stephen Canon
119377cc49
Merge pull request #99 from stephentyrone/algebraicField-should-be-signedNumeric
...
AlgebraicField should conform to SignedNumeric, not just Numeric.
2020-01-24 10:46:15 -05:00
Stephen Canon
016cd6a2fc
AlgebraicField should conform to SignedNumeric, not just Numeric.
...
Because a field necessarily has additive inverses, SignedNumeric conformance is appropriate. (SignedNumeric is poorly named; it doesn't actually mean that a type has a "sign", only that there's a negation operation).
2020-01-24 10:42:11 -05:00
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
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