workaround apparent MSVC mis-optimization

MSVC appears to misapply the identity
"A + -A == 0" which is not true for
non-finite floating point values.
This commit is contained in:
Michael Davidsaver
2019-09-29 21:02:19 -07:00
parent 2f88b70f21
commit e83818b25e
2 changed files with 11 additions and 17 deletions

View File

@@ -612,18 +612,12 @@ MAIN(epicsCalcTest)
testExpr(0.0 + NaN);
testExpr(Inf + 0.0);
testExpr(Inf + Inf);
#if defined(_WIN64) && defined(_MSC_VER)
// only test CALC as MSVC seems to incorrectly evaluate this expression at compile time.
// see note in epicsMathTest
testCalc("Inf + -Inf", NaN);
#else
testExpr(Inf + -Inf);
#endif
testExpr(Inf + NaN);
testExpr(-Inf + 0.0);
#if defined(_WIN64) && defined(_MSC_VER)
testCalc("-Inf + Inf", NaN);
#else
testExpr(-Inf + Inf);
#endif
testExpr(-Inf + -Inf);
testExpr(-Inf + NaN);
testExpr(NaN + 0.0);