Fix ulp distance calculation for numbers with different signs

This is a simplification of the fix proposed in #2152, with the
critical function split out so that it can be tested directly,
without having to go through the ULP matcher.

Closes #2152
This commit is contained in:
Martin Hořeňovský
2021-07-26 22:01:04 +02:00
parent 6f21a3609c
commit 3d1cf95b32
19 changed files with 502 additions and 38 deletions

View File

@@ -161,6 +161,11 @@ away from the `target` value. The short version of what this means
is that there is no more than `maxUlpDiff - 1` representeable floating
point numbers between the argument for matching and the `target` value.
**Important**: The WithinULP matcher requires the platform to use the
[IEEE-754](https://en.wikipedia.org/wiki/IEEE_754) representation for
floating point numbers.
`WithinRel` creates a matcher that accepts floating point numbers that
are _approximately equal_ with the `target` with tolerance of `eps.`
Specifically, it matches if