[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 6b65f7f 3/8: Rename certain arguments and var
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 6b65f7f 3/8: Rename certain arguments and variables |
Date: |
Wed, 2 Jun 2021 15:37:06 -0400 (EDT) |
branch: master
commit 6b65f7f58913083d186dba5e3ad16b4a7337ec1f
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Rename certain arguments and variables
detail::expatiate() can be thought of as a lambda, so naturally its
arguments' names should be the same as the names of the function that
it instruments.
---
zero.hpp | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/zero.hpp b/zero.hpp
index 0add6a6..28d7845 100644
--- a/zero.hpp
+++ b/zero.hpp
@@ -49,12 +49,17 @@ typedef std::pair<double,root_validity> root_type;
namespace detail
{
-inline void expatiate(int& n_iter, std::ostream& os, double x, double fx)
+inline void expatiate
+ (int & number_of_iterations
+ ,std::ostream& os_trace
+ ,double x
+ ,double fx
+ )
{
- if(os.good())
+ if(os_trace.good())
{
- os
- << "iteration " << n_iter++
+ os_trace
+ << "iteration " << number_of_iterations++
<< " iterand " << x
<< " value " << fx
<< std::endl
@@ -240,10 +245,10 @@ root_type decimal_root
,root_bias bias
,int decimals
,FunctionalType& f
- ,std::ostream& iteration_stream = null_stream()
+ ,std::ostream& os_trace = null_stream()
)
{
- iteration_stream.precision(DECIMAL_DIG);
+ os_trace.precision(DECIMAL_DIG);
static double const epsilon = std::numeric_limits<double>::epsilon();
@@ -257,14 +262,14 @@ root_type decimal_root
double b = round_(bound1);
double fa = static_cast<double>(f(a));
- detail::expatiate(number_of_iterations, iteration_stream, a, fa);
+ detail::expatiate(number_of_iterations, os_trace, a, fa);
if(0.0 == fa) // Note 0.
{
return std::make_pair(a, root_is_valid);
}
double fb = static_cast<double>(f(b));
- detail::expatiate(number_of_iterations, iteration_stream, b, fb);
+ detail::expatiate(number_of_iterations, os_trace, b, fb);
if(0.0 == fb) // Note 0 [bis].
{
return std::make_pair(b, root_is_valid);
@@ -387,7 +392,7 @@ root_type decimal_root
else
{
fb = static_cast<double>(f(b));
- detail::expatiate(number_of_iterations, iteration_stream, b, fb);
+ detail::expatiate(number_of_iterations, os_trace, b, fb);
}
}
}
- [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 <=
- [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, 2021/06/02