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.