[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master a7d0900 10/11: Don't assume every function ha
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master a7d0900 10/11: Don't assume every function has a root at the origin |
Date: |
Thu, 1 Jul 2021 20:19:05 -0400 (EDT) |
branch: master
commit a7d09006058d28306269b86fe14ebdc1d27bb938
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Don't assume every function has a root at the origin
The error term should be close to zero; the root might not be.
---
zero_test.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/zero_test.cpp b/zero_test.cpp
index 412f218..6a59f32 100644
--- a/zero_test.cpp
+++ b/zero_test.cpp
@@ -108,11 +108,13 @@ void test_a_function
int const max_n_iter = max_n_iter_brent(bound0, bound1, tol, exact_root);
double d = brent_zero(bound0, bound1, tol, f);
- INVOKE_LMI_TEST_RELATION(std::fabs(d),<=,maximum_error,file,line);
+ double error = d - exact_root;
+ INVOKE_LMI_TEST_RELATION(std::fabs(error),<=,maximum_error,file,line);
root_type r = decimal_root(bound0, bound1, bias_none, decimals, f);
INVOKE_LMI_TEST(root_is_valid == r.validity, file, line);
- INVOKE_LMI_TEST_RELATION(std::fabs(r.root),<=,maximum_error,file,line);
+ error = r.root - exact_root;
+ INVOKE_LMI_TEST_RELATION(std::fabs(error),<=,maximum_error,file,line);
INVOKE_LMI_TEST_RELATION(r.n_iter,<=,max_n_iter,file,line);
#if defined LMI_X86_64 && defined LMI_POSIX
- [lmi-commits] [lmi] master updated (04ec593 -> a03c499), Greg Chicares, 2021/07/01
- [lmi-commits] [lmi] master e73bc36 01/11: Use mathematical symbols in comments, Greg Chicares, 2021/07/01
- [lmi-commits] [lmi] master 7b7d039 02/11: Include appropriate headers, Greg Chicares, 2021/07/01
- [lmi-commits] [lmi] master b4dd6cf 09/11: Suspend investigation of wikipedia example, Greg Chicares, 2021/07/01
- [lmi-commits] [lmi] master bb21c29 06/11: Expatiate less garrulously, Greg Chicares, 2021/07/01
- [lmi-commits] [lmi] master 172f4ab 04/11: Separate incrementation from expatiation, Greg Chicares, 2021/07/01
- [lmi-commits] [lmi] master 3975592 07/11: Expatiate more informatively, Greg Chicares, 2021/07/01
- [lmi-commits] [lmi] master a7d0900 10/11: Don't assume every function has a root at the origin,
Greg Chicares <=
- [lmi-commits] [lmi] master 620dfec 03/11: Don't test good() explicitly, Greg Chicares, 2021/07/01
- [lmi-commits] [lmi] master 2a75758 05/11: Expatiate by lambda, Greg Chicares, 2021/07/01
- [lmi-commits] [lmi] master 4249bab 08/11: Find zeros of two more functions, Greg Chicares, 2021/07/01
- [lmi-commits] [lmi] master a03c499 11/11: Find roots of several functions, Greg Chicares, 2021/07/01