Add rounding correction to unsafe simd exp tests too
authorErik Lindahl <erik@kth.se>
Fri, 13 Sep 2019 20:43:05 +0000 (22:43 +0200)
committerErik Lindahl <erik@kth.se>
Fri, 13 Sep 2019 20:43:05 +0000 (22:43 +0200)
This was already present for the safe-version tests,
but when modifying the test limits of the unsafe version
we need it there too to fix the ARMv7 tests.

Change-Id: I4dbab9655a9405bb17a8007a065aea3f4b991ed5

src/gromacs/simd/tests/simd_math.cpp

index 425d22897b0002b7a973cb27e12c58c1fc1a5baf..959009013a3f83fb5ebecbfbe9708b178a14fc5f 100644 (file)
@@ -771,7 +771,7 @@ TEST_F(SimdMathTest, exp)
 TEST_F(SimdMathTest, expUnsafe)
 {
     // See test of exp() for comments about test ranges
-    const real      lowestRealThatProducesNormal     = (std::numeric_limits<real>::min_exponent - 1)*std::log(2.0);
+    const real      lowestRealThatProducesNormal     = (std::numeric_limits<real>::min_exponent - 1)*std::log(2.0)*(1-std::numeric_limits<real>::epsilon());
     const real      highestRealThatProducesNormal    = (std::numeric_limits<real>::max_exponent - 1)*std::log(2.0);
 
     CompareSettings settings {
@@ -1256,7 +1256,7 @@ TEST_F(SimdMathTest, expSingleAccuracy)
 TEST_F(SimdMathTest, expSingleAccuracyUnsafe)
 {
     // See test of exp() for comments about test ranges
-    const real lowestRealThatProducesNormal     = (std::numeric_limits<real>::min_exponent - 1)*std::log(2.0);
+    const real lowestRealThatProducesNormal     = (std::numeric_limits<real>::min_exponent - 1)*std::log(2.0)*(1-std::numeric_limits<real>::epsilon());
     const real highestRealThatProducesNormal    = (std::numeric_limits<real>::max_exponent - 1)*std::log(2.0);
 
     // Increase the allowed error by the difference between the actual precision and single