I'm using MSVC 2019 v16.11.12.
When I tried compiling my code with /fp:fast instead of /fp:precise, my tests started failing.
The simplest case is:
BOOST_AUTO_TEST_CASE(test_division) {
float v = 3000.f;
BOOST_TEST((v / 1000.f) == 3.f);
}
Failing with result:
error: in "test_division": check (v / 1000.f) == 3.f has failed [3.00000024 != 3]
I understand that /fp:fast can have worse floating-point precision in some cases; but, here, it seems excessive...
How come it can't accurately divide 3000 by 1000?
I understand that 0.1 + 0.2 is not 0.3, but here all the numbers are representable and the division returns exactly 3 with fp:precise.
Is it possible that I have some other flag flipped which decreased the floating-point precision even more?