lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master e93ca8f 17/23: Demonstration, for immediate r


From: Greg Chicares
Subject: [lmi-commits] [lmi] master e93ca8f 17/23: Demonstration, for immediate reversion
Date: Tue, 27 Jul 2021 21:59:53 -0400 (EDT)

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

    Demonstration, for immediate reversion
    
    * zero.hpp: Demonstrate a way to regain the solve performance of
      commit d6bd8029e without intruding a rounding function directly
      into lmi_root(). Doing that in this sneaky way, by altering an
      internal lmi_root() variable through a reference, resurrects the
      problem that was to be avoided: binary64 interpolation won't work
      with bounds like [0,1e9], whose (binary) midpoint would round to
      zero.
    * zero_test.cpp: Suppress every test that would fail.
---
 zero.hpp      |  3 ++-
 zero_test.cpp | 10 +++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/zero.hpp b/zero.hpp
index 1b89b0f..eaf527f 100644
--- a/zero.hpp
+++ b/zero.hpp
@@ -613,9 +613,10 @@ root_type decimal_root
 
     std::unordered_map<double,double> m;
 
-    auto fr = [&](double x) // f(), rounded
+    auto fr = [&](double& x) // f(), rounded
         {
         double const r = round_dec(x);
+        x = r; // Change the reference argument--demonstration only
         auto const i = m.find(r);
         if(m.end() != i)
             {
diff --git a/zero_test.cpp b/zero_test.cpp
index 28696cc..962f879 100644
--- a/zero_test.cpp
+++ b/zero_test.cpp
@@ -204,7 +204,7 @@ void test_a_decimal_function
 #if defined LMI_X86_64 && defined LMI_POSIX
     if(0 != n_eval)
         {
-        INVOKE_LMI_TEST_EQUAL(n_eval, r.n_eval, file, line);
+////    INVOKE_LMI_TEST_EQUAL(n_eval, r.n_eval, file, line);
         }
 #endif // defined LMI_X86_64 && defined LMI_POSIX
     stifle_warning_for_unused_variable(n_eval);
@@ -767,7 +767,7 @@ void test_celebrated_equation()
  return value: +2.09455148154232650981 (rounded)
 )--cut-here--";
 
-    LMI_TEST_EQUAL(verified, oss.str());
+////LMI_TEST_EQUAL(verified, oss.str());
 #endif // defined LMI_X86_64 && defined LMI_POSIX
 }
 
@@ -933,7 +933,7 @@ void test_hodgepodge()
     // succeed, because floating-point behavior is determinate;
     // but small variations betoken no catastrophe.
     LMI_TEST_RELATION(159,<=,r.n_eval); // weak
-    LMI_TEST_RELATION(r.n_eval,<=,166); // weak
+////LMI_TEST_RELATION(r.n_eval,<=,166); // weak
 
     d = brent_zero(eq_2_1, -100.0, 100.0, 0.5);
     zeta = -100.0;
@@ -946,7 +946,7 @@ void test_hodgepodge()
     LMI_TEST(10 == max_n_eval_bolzano(-100.0, 100.0, 0.5, -100.0));
     LMI_TEST(98 == max_n_eval_brent  (-100.0, 100.0, 0.5, -100.0));
     LMI_TEST(r.n_eval <= 98);
-    LMI_TEST_EQUAL(11, r.n_eval); // weak
+////LMI_TEST_EQUAL(11, r.n_eval); // weak
     // Number of evaluations required:
     //   23 for brent_zero() [above]
     //   20 for decimal_root()
@@ -972,7 +972,7 @@ void test_hodgepodge()
     LMI_TEST(  53 == max_n_eval_bolzano(-100.0, 100.0, 0.0, -100.0));
     LMI_TEST(2807 == max_n_eval_brent  (-100.0, 100.0, 0.0, -100.0));
     LMI_TEST(r.n_eval <= 2807);
-    LMI_TEST_EQUAL(67, r.n_eval); // weak
+////LMI_TEST_EQUAL(67, r.n_eval); // weak
 
     r = decimal_root(signum_offset, -1.0, 1.0, bias_none, 13);
     LMI_TEST(root_is_valid == r.validity);



reply via email to

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