lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 11df70d 2/6: Assert nonnegativity of certain


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 11df70d 2/6: Assert nonnegativity of certain unit-test parameters
Date: Thu, 26 Aug 2021 20:48:05 -0400 (EDT)

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

    Assert nonnegativity of certain unit-test parameters
---
 zero_test.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/zero_test.cpp b/zero_test.cpp
index 3206507..828c19c 100644
--- a/zero_test.cpp
+++ b/zero_test.cpp
@@ -23,6 +23,7 @@
 
 #include "zero.hpp"
 
+#include "assert_lmi.hpp"
 #include "materially_equal.hpp"
 #include "math_functions.hpp"           // signum()
 #include "miscellany.hpp"               // stifle_warning_for_unused_variable()
@@ -48,6 +49,7 @@ static double const epsilon = 
std::numeric_limits<double>::epsilon();
 
 double max_err(double zeta, double tol)
 {
+    LMI_ASSERT(0.0 <= tol);
     return 6.0 * epsilon * std::fabs(zeta) + 2.0 * tol;
 }
 
@@ -78,6 +80,7 @@ double max_err(double zeta, double tol)
 
 int max_n_eval_bolzano(double a, double b, double tol, double zeta)
 {
+    LMI_ASSERT(0.0 <= tol);
     double delta = 2.0 * epsilon * std::fabs(zeta) + tol;
     double k = std::ceil(std::log2(std::fabs(b - a) / delta));
     return 1 + static_cast<int>(k);



reply via email to

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