[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 9292445 5/8: Fix a unit test
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 9292445 5/8: Fix a unit test |
Date: |
Wed, 2 Jun 2021 15:37:07 -0400 (EDT) |
branch: master
commit 9292445fceddc531e6fc2b20bd7e6abefef5847a
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Fix a unit test
Brent's book finds a zero of x^19 to within 1e-20, which means twenty
decimals, not negative twenty. With iterates rounded to negative twenty
decimals, both bounds were zero, and a root was found immediately, but
for (x^19 - 1) no root would have been found in the [0, 0] range that
results from rounding [-1, 4].
---
zero_test.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/zero_test.cpp b/zero_test.cpp
index fd21c18..76eb79e 100644
--- a/zero_test.cpp
+++ b/zero_test.cpp
@@ -189,8 +189,9 @@ int test_main(int, char*[])
// chasing after wind that costs many iterations.
e_nineteenth e_19;
- r = decimal_root(-1.0, 4.0, bias_none, -20, e_19);
+ r = decimal_root(-1.0, 4.0, bias_none, 20, e_19);
LMI_TEST(root_is_valid == r.second);
+ LMI_TEST(std::fabs(r.first) <= epsilon);
test_zero(-1.0, 4.0, -100, e_19, std::exp(1.0));
test_zero(-1.0, 4.0, 0, e_19, std::exp(1.0));
- [lmi-commits] [lmi] master updated (f9276c0 -> f0526be), Greg Chicares, 2021/06/02
- [lmi-commits] [lmi] master ad14033 6/8: Improve and test translation from ALGOL 60, Greg Chicares, 2021/06/02
- [lmi-commits] [lmi] master f0526be 8/8: Designate release candidate 20210602T1807Z, Greg Chicares, 2021/06/02
- [lmi-commits] [lmi] master 6b65f7f 3/8: Rename certain arguments and variables, Greg Chicares, 2021/06/02
- [lmi-commits] [lmi] master e41a14f 4/8: Improve instrumentation, Greg Chicares, 2021/06/02
- [lmi-commits] [lmi] master 7a75531 2/8: Write non-const reference arguments first, Greg Chicares, 2021/06/02
- [lmi-commits] [lmi] master d0e0746 1/8: Improve documentation, Greg Chicares, 2021/06/02
- [lmi-commits] [lmi] master d35e677 7/8: Add a unit test: root of an unfriendly function, Greg Chicares, 2021/06/02
- [lmi-commits] [lmi] master 9292445 5/8: Fix a unit test,
Greg Chicares <=