float: lower ULPs threshold for almost_equal

we weren't detecting differences with 4 decimal point differences
This commit is contained in:
Danny Robson 2015-08-20 15:34:20 +10:00
parent 6bb287fe04
commit 08b6cbacea
2 changed files with 5 additions and 1 deletions

View File

@ -97,7 +97,7 @@ bool
ieee_float<E, S>::almost_equal (floating_t a,
floating_t b)
{
return almost_equal (a, b, 10000u);
return almost_equal (a, b, 100u);
}

View File

@ -54,6 +54,10 @@ test_comparisons (util::TAP::logger &tap)
tap.expect (!almost_equal (numeric_limits<double>::quiet_NaN (),
numeric_limits<double>::quiet_NaN ()),
"not almost_equal NaN/NaN");
// Compare reasonably close values that are wrong
tap.expect (!almost_equal (1.0000f, 1.0001f), ".0001f difference inequality");
tap.expect ( almost_equal (1.0000f, 1.00001f), ".00001f difference inequality");
}