lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] odd/eraseme_error dd8fb62 01/10: Postpone considerat


From: Greg Chicares
Subject: [lmi-commits] [lmi] odd/eraseme_error dd8fb62 01/10: Postpone consideration of NaN-valued objective functions
Date: Wed, 7 Jul 2021 06:22:13 -0400 (EDT)

branch: odd/eraseme_error
commit dd8fb6275ef8a8357f561f18897c24dc4170675e
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Postpone consideration of NaN-valued objective functions
---
 zero_test.cpp | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/zero_test.cpp b/zero_test.cpp
index be1ad58..5bb93f8 100644
--- a/zero_test.cpp
+++ b/zero_test.cpp
@@ -375,9 +375,27 @@ void test_biases()
     LMI_TEST(e_more_or_less == e_or_less || e_more_or_less == e_or_more);
 
     // Various tests--see function-template definition.
-
-    test_bias(-1.0e100, 4.0e100, -100, e, std::exp(1.0));
-    test_bias(-1.0    , 4.0    ,    0, e, std::exp(1.0));
+    // However...     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+    // ...the tests commented out below might seem to "work" only
+    // by accident, as the function doesn't map negative arguments
+    // to any real number. This should be revisited later. It seems
+    // unlikely that Brent actually figured out how to make NaNs work
+    // correctly on IBM 360 hardware, where there is no NaN because
+    // every bit pattern represents a valid floating-point number,
+    // and ln(-1) would presumably have elicited an exception.
+    //
+    // Should lmi_root() check for NaN when it evaluates the objective
+    // function, and just throw if detected? Or should it be able to
+    // find a root anyway?
+    //
+    // A function such as f(x) =
+    //   -NaN, x < π
+    //    0.0, x ≡ π
+    //   +NaN, x > π
+    // might be considered as a test case.
+
+//  test_bias(-1.0e100, 4.0e100, -100, e, std::exp(1.0));
+//  test_bias(-1.0    , 4.0    ,    0, e, std::exp(1.0));
     test_bias( 0.5    , 5.0    ,    1, e, std::exp(1.0));
     test_bias( 0.5    , 5.0    ,    2, e, std::exp(1.0));
     test_bias( 0.5    , 5.0    ,    3, e, std::exp(1.0));
@@ -386,7 +404,7 @@ void test_biases()
     test_bias( 0.5    , 5.0    ,    6, e, std::exp(1.0));
     test_bias( 0.5    , 5.0    ,    7, e, std::exp(1.0));
     test_bias( 0.5    , 5.0    ,    8, e, std::exp(1.0));
-    test_bias(-1.0    , 4.0    ,  100, e, std::exp(1.0));
+//  test_bias(-1.0    , 4.0    ,  100, e, std::exp(1.0));
 }
 
 /// Test the worked-out example given here:



reply via email to

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