lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 5848d68 6/8: Improve an error term, and rewri


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 5848d68 6/8: Improve an error term, and rewrite a misleading comment
Date: Mon, 28 Jun 2021 10:29:52 -0400 (EDT)

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

    Improve an error term, and rewrite a misleading comment
    
    In the error term of AfMWD eq. 2.18:
      |ζ′- ζ| ≤ 6ϵ|ζ| + 2t
    when t is several orders of magnitude smaller than ϵ|ζ|, the t term is
    overwhelmed, but does not vanish. It was certainly incorrect to say
    that the dominant term vanished.
---
 zero_test.cpp | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/zero_test.cpp b/zero_test.cpp
index dd9adcc..4d04efb 100644
--- a/zero_test.cpp
+++ b/zero_test.cpp
@@ -316,8 +316,21 @@ void test_various_functions()
 
     r = decimal_root(-100.0, 100.0, bias_none, 20, eq_2_1);
     LMI_TEST(root_is_valid == r.validity);
-    // Twenty-decimal rounding makes the epsilon term vanish.
-    LMI_TEST(-100.0 <= r.root && r.root <= zeta + max_err(zeta, 0.0));
+    // Rounding 'x' (of type 'double') to twenty decimals doesn't
+    // affect its value near -100.0; the final bracketing values
+    // (for x86_64-pc-linux-gnu) are
+    //      x                       f(x)
+    //    -99.9999999999999147349   1
+    //   -100                      -6.41168279659337119941e+62
+    // in whose vicinity the error term in Brent's equation 2.18
+    //   6.0 * epsilon * std::fabs(zeta) + 2.0 * t;
+    // with t=0.5*10^-20 becomes
+    //   600e 1.33226762955018784851e-13
+    //   + 2t 0.00000010000000000000e-13 (same as 1.0e-20)
+    // where the 'epsilon' term overwhelms the 't' term.
+    double t = 0.5 * std::pow(10.0, -20.0);
+    LMI_TEST(-100.0 <= r.root && r.root <= zeta + max_err(zeta, t));
+
     LMI_TEST(  53 == max_n_iter_bolzano(-100.0, 100.0, 0.0, -100.0));
     LMI_TEST(2807 == max_n_iter_brent  (-100.0, 100.0, 0.0, -100.0));
     LMI_TEST(r.n_iter <= 2807);



reply via email to

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