28 Commits
Author SHA1 Message Date
Stephen Canon 673c0f6c3d Enable and include Builtin module to pickup fadd/fmul_relaxed. 2026-10-11 17:00:36 -04:00
Stephen Canon 31fe14d084 Remove stochastic rounding mode
It's a useful operation, but it deserves its own API to allow the use of a custom random source.
Also, the existing API blocks some constant-folding operations because the call to the system random source is an opaque optimization barrier, so removing it allows us to produce better codegen for the other rounding modes.

We're also bumping required Swift version to 5.9, and removing the executable test targets for log/log1p, as they're really only useful for development of those algorithms.
2025-04-10 10:39:51 -04:00
Stephen Canon e8a3ddbb3e Move the -lm link command to RealModule (from _NumericsShims).
Hopefully this resolves some niche link errors that we've seen sporadically.
2023-11-30 09:27:03 -05:00
Stephen Canon 740cc5012f Some cleanups to relaxed arithmetic. 2023-04-26 09:05:28 -04:00
Steve (Numerics) Canon 8353ce4c3d Bump tools version to 5.5, add @swift-5.4 for legacy support. 2022-12-28 18:25:22 -05:00
Butta 1db31ebdf0 Link math library on Android too 2022-04-07 23:27:42 +05:30
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 c4f8886a11 Move baseline supported tools version to 5.4. 2022-03-05 10:18:13 -05: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 abb899865e resolve warnings in 5.5 tools build, add skeleton readme for integer utilities 2021-09-20 09:53:38 -04:00
Stephen Canon 5f28ad0e97 Explicitly exclude CMakeLists.txt and README.md files from all targets.
If/when we bump swift-tools-version to 5.3 or greater, swift-pm will start complaining about these, so let's explicitly exclude them now.
2021-08-31 12:31:58 -04:00
Stephen Canon b9415c9ad2 Add missing IntegerUtilities dependency for Numerics module 2021-08-27 09:01:35 -04:00
Stephen Canon 21ff6d38fd Revert "Remove Real and Complex _libraries_; keep modules." 2021-08-27 08:45:25 -04:00
Stephen Canon 84474a3410 Initial setup of IntegerUtilities module.
Seeded with rotate(right:) and rotate(left:) on FixedWidthInteger. These implementations are basically sane, but need documentation written for users who are not already familiar with bitwise rotation.
2021-08-25 15:36:24 -04:00
Stephen Canon 988f1e1cea Remove Real and Complex _libraries_; keep modules.
These are vestigial, and not needed to support swift-pm.
2021-08-25 10:52:07 -04:00
Stephen Canon 2b4c6701f2 log and log(onePlus:) implementations for Complex
These significantly improve on the state of the art for arguments close to the circle where the result vanishes, producing good componentwise relative accuracy as well as relative accuracy in the complex norm.

Also drops the argument parser dependency, which is desirable to avoid possible circular dependencies in the future with algorithms.
2020-11-05 15:14:25 -05:00
Stephen Canon 0b2dc469ed Moved sampling-based tests out of unit and into an exectuable target. 2020-10-01 16:39:11 -04:00
Stephen Canon c2d6cb716d Factor test support out into a module so Real and Complex tests can use it. 2020-08-24 16:21:25 -04:00
Stephen Canon 7c0eb30664 Update complex test dependencies. 2020-07-14 12:33:25 -04: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
Stephen Canon f59e64a1aa Rename ElementaryFunctions module -> Real
No change to the protocols involved, purely a change so that the module that users import shares the name of the feature they are most likely to be using, rather than a somewhat-esoteric implementation detail.
2019-11-06 12:40:12 -05:00
Stephen Canon eb76aa632b Update license headers, add CONTRIBUTING.md and umbrella module 2019-10-30 16:11:20 -04:00
Steve (Numerics) Canon 919f13ce2e Restore the NumericShims module, use it instead of silgen_name.
I had thought that we could get away with just using @_silgen_name to wrap the platform libm functions in ElementaryFunctions conformances, but that's now failing in release builds when both ElementaryFunctions and the Platform module are imported (and actually crashing swiftc).

Fall back on the previous strategy of using C header shims. This adds an extra layer of source abstraction, but we're still able to optimize it away at compile time, even in unoptimized builds, so we can live with it for now.
2019-08-01 22:12:03 -04:00
Steve (Numerics) Canon fa9422ec6e Remove NumericShims module; we don't need it thanks to silgen_name. 2019-07-19 16:29:53 -04:00
Steve (Numerics) Canon 8aab7a90f8 Initial project setup for swift-numerics
Two modules to begin with:
- ElementaryFunctions
- Complex
Added README.md files describing each module very roughly, and a project
README to describe goals and process.
2019-07-06 15:27:21 -04:00