In older toolchains, Float16 is marked unavailable on all mac targets; starting with the 5.4 toolchain, it is available starting in macOS 11.0 when targeting Apple Silicon.
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.
These are _mostly_ implementation hooks for Complex, but are generally useful, so I've made them public. Experimental, subject to renaming, especially mulAdd.
The most general version of the API is now defined on AA as:
```
public func isApproximatelyEqual<Magnitude>(
to other: Self,
absoluteTolerance: Magnitude,
relativeTolerance: Magnitude = 0,
norm: (Self) -> Magnitude
) -> Bool where Magnitude: FloatingPoint {
```
Note that AA does not have the magnitude property, so we can't default the norm in this setting. Therefore the following is kept on Numeric:
```
public func isApproximatelyEqual(
to other: Self,
absoluteTolerance: Magnitude,
relativeTolerance: Magnitude = 0
) -> Bool {
self.isApproximatelyEqual(
to: other,
absoluteTolerance: absoluteTolerance,
relativeTolerance: relativeTolerance,
norm: \.magnitude
)
}
```
to provide the operation with norm defaulted (note: it's not optional, because then this would call itself).
- Removed isApproximatelyEqual(to:), since that functionality already
exists via the default value of relativeTolerance.
- Added the ability to specify a norm to use in the expert-mode
operation, defaulting to using $0.magnitude.
- Respell as isApproximatelyEqual(to:), by analogy to isEqual(to:),
isLess(than:), etc.
- Refactor to eliminate the need for the Tolerance<Magnitude> type.
Now all we have is one overloaded function with three implementations.
This could be futher trimmed down to two versions by taking an
optional parameter instead, but that seems a little bit less clean.
I want to write some more documentation and examples here, but this is
enough to discuss and start review.
This adds a CMake based build, which enables the build of swift-numerics
on Windows. This currently does not add the test suite to the build as
there are still some issues to work out in building the full test suite
which require additional math operations to fully build.
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.
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.