Subject: |
[Merge] ~freddie-akeroyd/epics-base:nan_inf_tests into epics-base:7.0 |
From: |
Freddie Akeroyd via Core-talk <[email protected]> |
To: |
[email protected] |
Date: |
Mon, 30 Sep 2019 20:37:22 -0000 |
Freddie Akeroyd has proposed merging ~freddie-akeroyd/epics-base:nan_inf_tests into epics-base:7.0.
Requested reviews:
EPICS Core Developers (epics-core)
For more details, see:
https://code.launchpad.net/~freddie-akeroyd/epics-base/+git/epics-base/+merge/373425
Change tests to be more "a + -b" like than "a + -a" to avoid compiler optimisation issues
--
Your team EPICS Core Developers is requested to review the proposed merge of ~freddie-akeroyd/epics-base:nan_inf_tests into epics-base:7.0.
diff --git a/modules/libcom/test/epicsCalcTest.cpp b/modules/libcom/test/epicsCalcTest.cpp
index 2492c95..9edc7c6 100644
--- a/modules/libcom/test/epicsCalcTest.cpp
+++ b/modules/libcom/test/epicsCalcTest.cpp
@@ -294,6 +294,13 @@ static inline double MIN(double a, double b, double c, double d, double e,
MAIN(epicsCalcTest)
{
int repeat;
+ /*
+ * we need to create these to avoid issues with "NaN + -NaN" etc
+ * and compiler optimisation. In the real world we would see a + -b
+ * rather than a + -a
+ * calc expressions are case insensive, so we can use "NaN + -NAN" in C
+ */
+ float inf = Inf, nan = NaN;
const double a=1.0, b=2.0, c=3.0, d=4.0, e=5.0, f=6.0,
g=7.0, h=8.0, i=9.0, j=10.0, k=11.0, l=12.0;
@@ -612,19 +619,11 @@ MAIN(epicsCalcTest)
testExpr(0.0 + NaN);
testExpr(Inf + 0.0);
testExpr(Inf + Inf);
-#if defined(_WIN64) && defined(_MSC_VER)
- testCalc("Inf + -Inf", NaN);
-#else
- testExpr(Inf + -Inf);
-#endif
+ testExpr(Inf + -inf);
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 + inf);
+ testExpr(-Inf + -inf);
testExpr(-Inf + NaN);
testExpr(NaN + 0.0);
testExpr(NaN + Inf);
@@ -638,11 +637,11 @@ MAIN(epicsCalcTest)
testExpr(0.0 - NaN);
testExpr(Inf - 0.0);
testExpr(Inf - Inf);
- testExpr(Inf - -Inf);
+ testExpr(Inf - -inf);
testExpr(Inf - NaN);
testExpr(-Inf - 0.0);
- testExpr(-Inf - Inf);
- testExpr(-Inf - -Inf);
+ testExpr(-Inf - inf);
+ testExpr(-Inf - -inf);
testExpr(-Inf - NaN);
testExpr(NaN - 0.0);
testExpr(NaN - Inf);
diff --git a/modules/libcom/test/epicsMathTest.c b/modules/libcom/test/epicsMathTest.c
index 8ea763c..b3e67cf 100644
--- a/modules/libcom/test/epicsMathTest.c
+++ b/modules/libcom/test/epicsMathTest.c
@@ -20,6 +20,13 @@ MAIN(epicsMathTest)
double huge = 1e300;
double tiny = 1e-300;
double c;
+ /*
+ * we need to create these to avoid issues with "NaN + -NaN" etc and
+ * compiler optimisation. In the real world we would
+ * see a + -b rather than a + -a
+ */
+ float epicsINF_ = epicsINF;
+ float epicsNAN_ = epicsNAN;
testPlan(35);
@@ -28,29 +35,17 @@ MAIN(epicsMathTest)
testOk1(!isnan(epicsINF));
testOk1(isinf(epicsINF));
- testOk1(epicsINF == epicsINF);
+ testOk1(epicsINF == epicsINF_);
testOk1(epicsINF > 0.0);
- testOk1(epicsINF - epicsINF != 0.0);
+ testOk1(epicsINF - epicsINF_ != 0.0);
-#if defined(_WIN64) && defined(_MSC_VER)
- testTodoBegin("Known failure on windows-x64");
-#endif
- testOk1(epicsINF + -epicsINF != 0.0);
- testOk1(-epicsINF + epicsINF != 0.0);
-#if defined(_WIN64) && defined(_MSC_VER)
- testTodoEnd();
-#endif
+ testOk1(epicsINF + -epicsINF_ != 0.0);
+ testOk1(-epicsINF + epicsINF_ != 0.0);
testOk1(isnan(epicsINF - epicsINF));
-#if defined(_WIN64) && defined(_MSC_VER)
- testTodoBegin("Known failure on windows-x64");
-#endif
- testOk1(isnan(epicsINF + -epicsINF));
- testOk1(isnan(-epicsINF + epicsINF));
-#if defined(_WIN64) && defined(_MSC_VER)
- testTodoEnd();
-#endif
+ testOk1(isnan(epicsINF + -epicsINF_));
+ testOk1(isnan(-epicsINF + epicsINF_));
testOk1(isnan(epicsNAN));
testOk1(!isinf(epicsNAN));
@@ -62,14 +57,8 @@ MAIN(epicsMathTest)
testOk1(!(epicsNAN > epicsNAN));
testOk1(isnan(epicsNAN - epicsNAN));
-#if defined(_WIN64) && defined(_MSC_VER)
- testTodoBegin("Known failure on windows-x64");
-#endif
- testOk1(isnan(epicsNAN + -epicsNAN));
- testOk1(isnan(-epicsNAN + epicsNAN));
-#if defined(_WIN64) && defined(_MSC_VER)
- testTodoEnd();
-#endif
+ testOk1(isnan(epicsNAN + -epicsNAN_));
+ testOk1(isnan(-epicsNAN + epicsNAN_));
c = huge / tiny;
testOk(!isnan(c), "!isnan(1e300 / 1e-300)");
- Replies:
- Re: [Merge] ~freddie-akeroyd/epics-base:nan_inf_tests into epics-base:7.0 Andrew Johnson via Core-talk
- Navigate by Date:
- Prev:
Build failed: epics-base base-7.0-325 AppVeyor via Core-talk
- Next:
[Bug 1845854] Re: EPICS Math tests failing on Windows with MSVC Freddie Akeroyd via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
<2019>
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Build failed: epics-base base-7.0-325 AppVeyor via Core-talk
- Next:
Re: [Merge] ~freddie-akeroyd/epics-base:nan_inf_tests into epics-base:7.0 Andrew Johnson via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
<2019>
2020
2021
2022
2023
2024
|