Commit Graph
521 Commits
Author SHA1 Message Date
Stephen Canon 2baff8fc30 Also fixup real edge cases for pow(0,0). 2022-09-15 16:10:17 -04:00
Stephen Canon b9e8b970f2 Fixup indentation. 2022-09-15 15:39:34 -04:00
Stephen Canon d34f5636c4 Fix the edge-case handling of Complex.pow(.zero, <int>) 2022-09-15 15:07:06 -04:00
Stephen Canon 2624562948 Merge pull request #233 from xymus/missing-import-for-conformance
Add missing import required to use a conformance
2022-07-12 14:31:29 -04:00
Alexis Laferrière c8e3d9f54b Add missing import required to use a conformance
A new compiler check reports a missing import for a conformance
implicitly imported:

```
Sources/_TestSupport/Error.swift:21:13: error: cannot use conformance of
'Float' to 'Real' here; 'RealModule' was not imported by this file
public func componentwiseError(_ tst: Complex<Float>, _ ref:
Complex<Double>) -> Double {
            ^
```

Address this issue in the project by adding the missing import.
2022-07-11 14:44:42 -07:00
Stephen Canon a7ceb774fe Merge pull request #231 from markuswntr/patch-1
Fix broken link to `IntegerUtilities` in README.md
2022-06-20 09:26:24 -10:00
Markus Winter 0ea36c3109 Update README.md 2022-06-16 08:16:18 +02:00
Stephen Canon 0dc8fef6e9 Merge pull request #227 from buttaface/math
Link math library on Android too
2022-04-07 22:35:51 -04:00
Stephen Canon 98a8a166df Merge pull request #226 from compnerd/patch-1
Update CMakeLists.txt to link math library on Linux.
2022-04-07 17:25:38 -04:00
Saleem Abdulrasool 0d9f0b2a98 Update CMakeLists.txt
Adjust the CMake build system to reflect the recent changes of requiring the explicit linking of libm on Linux platforms.
2022-04-07 14:24:06 -07:00
Butta 1db31ebdf0 Link math library on Android too 2022-04-07 23:27:42 +05:30
Stephen Canon 48003e8b7a Fixup banner comment on Scale.swift. 2022-04-07 10:18:54 -04:00
Stephen Canon 56db9b5ec9 Merge pull request #225 from apple/remove-differentiable
Remove conformance of Complex to Differentiable
2022-04-06 23:15:28 -04:00
Stephen Canon 5803eaf5bb Let's try a different approach. 2022-04-06 22:42:21 -04:00
Stephen Canon cc53a7b085 Make _NumericsShims a systemLibrary target. 2022-04-06 15:21:00 -04:00
Stephen Canon 027bcc5b8e Remove conformance of Complex to Differentiable
The conformance was breaking CI testing, because the CI bots use a macOS version that predates availability of the _Differentiation module, and the compiler-generated differentation operations have neither availability attributes nor checks, so any reference to those operations simply crashes in dyld because the library is not present. We can add availability, but that's not really accurate either, because these operations are not actually binary-stable, so while we wouldn't crash in dyld, we also might not work correctly in the future. We could mark them unavailable on Apple platforms, but that's also not quite right (and further means that they're not going to get a lot of attention). The best solution seems to be to remove the conformance (which was never source-stable).
2022-04-06 14:41:04 -04:00
Stephen Canon fc1b2d1e67 Merge pull request #224 from apple/documentation-formatting
Minor documentation formatting cleanup.
2022-04-06 13:21:32 -04:00
Stephen Canon 270972dd8a Minor documentation formatting cleanup. 2022-04-06 11:50:25 -04:00
Stephen Canon b6018fa8a9 Merge pull request #222 from NevinBR/patch-1
GCD bug fix
2022-04-06 10:04:39 -04:00
Stephen Canon 5bbf0e2229 Merge pull request #223 from stephentyrone/require-swift-5.4
Move baseline supported tools version to 5.4
2022-04-06 10:00:56 -04:00
Stephen Canon 27f8192a63 Attempt to work around CI misconfiguration by removing Complex Differentiable conformance. 2022-04-06 09:58:40 -04:00
Stephen Canon c4f8886a11 Move baseline supported tools version to 5.4. 2022-03-05 10:18:13 -05:00
NevinBR 7f2d022d3d GCD bug fix
The standard-library documentation for `trailingZeroBitCount` states:

> If the value is zero, then `trailingZeroBitCount` is equal to `bitWidth`.

Thus, if `T` is not a fixed-width integer type, and `x == 0`, and `y` has more trailing zeros than the representation of `x`, then the gcd calculation will be incorrect.

In particular, the left-shift by `min(xtz, ytz) == xtz` will not “undo” the earlier right-shift by `ytz`,  so the final result will be incorrectly right-shifted by `ytz - xtz`.

To fix this I have added an early exit when `x == 0`. I am not sure if this is the optimal solution, and I’m open to alternatives.

***

This change ensures that `x != 0` at the top of the loop, so I have also converted it from a `while` to a `repeat-while` loop, in order to eliminate a redundant extra comparison on the first iteration.

I don’t know if this actually affects performance, and I’m happy to change it back if that’s preferred.
2022-02-22 11:46:06 -05:00
Stephen Canon 4ce74b4235 Merge pull request #220 from stephentyrone/refactor-complex-cmake
Update complex cmake for refactoring.
2021-12-16 15:19:39 -05:00
Stephen Canon 445b0da15d Update complex cmake for refactoring. 2021-12-16 13:38:20 -05:00
Stephen Canon 9596f40d3b Merge pull request #219 from stephentyrone/refactor-complex
Refactor complex
2021-12-16 13:33:55 -05:00
Stephen Canon d329698498 remove F16/F80 stubs for complex elfns. 2021-12-11 14:57:36 -05:00
Stephen Canon ba65b0fc77 Refactor Complex module for finer granularity. 2021-12-11 11:19:29 -05:00
Stephen Canon 1939f34fde Merge pull request #217 from stephentyrone/double-width-testing-right-shift
Use DoubleWidth in stochastic rounding right-shift tests.
2021-11-24 11:40:29 -05:00
Stephen Canon 47a233758d Use DoubleWidth in stochastic rounding right-shift tests.
This lets us get rid of Double here, and get more meaningful test coverage for 64b values. Also test 128b to cover double-width itself somewhat.
2021-11-24 11:35:40 -05:00
Stephen Canon f3365bd0b4 Merge pull request #213 from DanboDuan/main
add macOS/arm64 support in the CMake build.
2021-11-18 09:17:22 -05:00
bob 8983be89c7 add arm64 support for M1 Mac 2021-11-17 20:39:39 +08:00
Stephen Canon f5b33a6c07 Merge pull request #212 from stephentyrone/integer-utils-cleanup
Minor cleanups in integer utilities.
2021-11-09 08:08:12 -05:00
Stephen Canon bfd905c9e4 Minor cleanups in integer utilities. 2021-11-03 13:53:38 -04:00
Stephen Canon 80d758ac5b Merge pull request #211 from stephentyrone/further-doublewidth-cleanup
Clean out some unnecessary stuff in DoubleWidth.
2021-11-03 09:37:41 -04:00
Stephen Canon 48099a09b4 Clean out some unnecessary stuff in DoubleWidth. 2021-11-03 09:33:32 -04:00
Stephen Canon 9e50430d23 Merge pull request #210 from stephentyrone/double-width-comments
Expand some comments on DoubleWidth basic properties and inits.
2021-11-03 09:08:24 -04:00
Stephen Canon cdb092bb31 Expand some comments on DoubleWidth basic properties and inits. 2021-11-03 08:46:34 -04:00
Stephen Canon 84044a8382 Merge pull request #209 from stephentyrone/unnecessary-endian
Remove big/little endiant distinction in representation of DoubleWidth
2021-11-03 08:38:28 -04:00
Stephen Canon db932c9871 Remove big/little endiant distinction in representation of DoubleWidth
This doesn't really add anything that we need; we might as well simply pick one.
2021-11-03 08:22:25 -04:00
Stephen Canon b501ca406c Merge pull request #197 from benrimmington/experimental
Add the `DoubleWidth` type
2021-10-27 15:48:29 -04:00
be0534a3e3 Add the DoubleWidth type
Co-authored-by: Nate Cook <natecook@apple.com>
Co-authored-by: Max Moiseev <moiseev@users.noreply.github.com>
Co-authored-by: Xiaodi Wu <13952+xwu@users.noreply.github.com>
2021-10-27 18:14:10 +01:00
Stephen Canon c74d817e8d Merge pull request #208 from markuswntr/two-sum
Add `Augmented.sum(_:_:)` aka "twoSum"
2021-10-27 12:27:16 -04:00
Markus Winter 05366d7f4a Revert names of temporary variables 2021-10-27 08:48:54 +02:00
Markus WinterandXiaodi Wu 6ec74ec80e Fix source code formatting
Co-authored-by: Xiaodi Wu <13952+xwu@users.noreply.github.com>
2021-10-27 08:28:25 +02:00
Markus Winter d4a440fd05 Update range of random values in test cases 2021-10-26 16:27:04 +02:00
Markus Winter f6e5563514 Fix argument ordering in twoSum and add test cases 2021-10-26 15:57:30 +02:00
Markus Winter 8b05d1c8e0 Update comments on the difference of sum(_:_:) and sum(large:small:) 2021-10-21 10:55:24 +02:00
Markus Winter 1e724835bd Add twoSum to augmented arithmetic 2021-10-20 23:47:27 +02:00
Stephen Canon f956c239e1 Merge pull request #203 from stephentyrone/rounding
Right shift and division with rounding.
2021-10-15 11:40:53 -04:00