lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 3eef4d20 2/5: Distinguish signed zeros in uni


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 3eef4d20 2/5: Distinguish signed zeros in unit tests
Date: Thu, 2 Jun 2022 20:13:04 -0400 (EDT)

branch: master
commit 3eef4d20c2a1f998b40587623c86443936b04f79
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Distinguish signed zeros in unit tests
    
    Changed exponents from {1,9} to {7,8} to test both odd and even.
---
 bin_exp_test.cpp | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/bin_exp_test.cpp b/bin_exp_test.cpp
index b18f7b2c..b3c37792 100644
--- a/bin_exp_test.cpp
+++ b/bin_exp_test.cpp
@@ -24,6 +24,7 @@
 #include "bin_exp.hpp"
 
 #include "materially_equal.hpp"
+#include "math_functions.hpp"           // neg0, pos0
 #include "test_tools.hpp"
 #include "timer.hpp"
 
@@ -45,15 +46,15 @@ void test_systematically()
     LMI_TEST_EQUAL( 1.0, bin_exp( 0.0, -0));
     LMI_TEST_EQUAL( 1.0, bin_exp(-0.0, -0));
 
-    LMI_TEST_EQUAL( 0.0, bin_exp( 0.0,  1));
-    LMI_TEST_EQUAL( 0.0, bin_exp(-0.0,  1));
-    LMI_TEST_EQUAL( inf, bin_exp( 0.0, -1));
-    LMI_TEST_EQUAL(-inf, bin_exp(-0.0, -1));
+    LMI_TEST_EQUAL(pos0, bin_exp( 0.0,  7));
+    LMI_TEST_EQUAL(neg0, bin_exp(-0.0,  7));
+    LMI_TEST_EQUAL( inf, bin_exp( 0.0, -7));
+    LMI_TEST_EQUAL(-inf, bin_exp(-0.0, -7));
 
-    LMI_TEST_EQUAL( 0.0, bin_exp( 0.0,  9));
-    LMI_TEST_EQUAL( 0.0, bin_exp(-0.0,  9));
-    LMI_TEST_EQUAL( inf, bin_exp( 0.0, -9));
-    LMI_TEST_EQUAL(-inf, bin_exp(-0.0, -9));
+    LMI_TEST_EQUAL(pos0, bin_exp( 0.0,  8));
+    LMI_TEST_EQUAL(pos0, bin_exp(-0.0,  8));
+    LMI_TEST_EQUAL( inf, bin_exp( 0.0, -8));
+    LMI_TEST_EQUAL( inf, bin_exp(-0.0, -8));
 
     // powers of one
 
@@ -101,8 +102,8 @@ void test_systematically()
 
     LMI_TEST_EQUAL(     inf, bin_exp( e,  999));
     LMI_TEST_EQUAL(    -inf, bin_exp(-e,  999));
-    LMI_TEST_EQUAL(     0.0, bin_exp( e, -999));
-    LMI_TEST_EQUAL(    -0.0, bin_exp(-e, -999));
+    LMI_TEST_EQUAL(    pos0, bin_exp( e, -999));
+    LMI_TEST_EQUAL(    neg0, bin_exp(-e, -999));
 }
 
 void test_integral_powers_of_two()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]