[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 47d6100 7/7: Suppress all output to null stre
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 47d6100 7/7: Suppress all output to null stream in decimal_root() |
Date: |
Tue, 27 Jun 2017 17:13:48 -0400 (EDT) |
branch: master
commit 47d6100934d1c18660d0e0c67f0ecee87810f4fc
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Suppress all output to null stream in decimal_root()
See:
http://lists.nongnu.org/archive/html/lmi/2017-06/msg00008.html
This change doubled the recent sevenfold improvement in the speed of
mete_dob_limit().
---
zero.hpp | 45 +++++++++++++++++++++++++++------------------
1 file changed, 27 insertions(+), 18 deletions(-)
diff --git a/zero.hpp b/zero.hpp
index af71c93..9606d3d 100644
--- a/zero.hpp
+++ b/zero.hpp
@@ -255,24 +255,30 @@ root_type decimal_root
double b = round_(bound1);
double fa = static_cast<double>(f(a));
- iteration_stream
- << "iteration " << number_of_iterations++
- << " iterand " << a
- << " value " << fa
- << std::endl
- ;
+ if(iteration_stream.good())
+ {
+ iteration_stream
+ << "iteration " << number_of_iterations++
+ << " iterand " << a
+ << " value " << fa
+ << std::endl
+ ;
+ }
if(0.0 == fa)
{
return std::make_pair(a, root_is_valid);
}
double fb = static_cast<double>(f(b));
- iteration_stream
- << "iteration " << number_of_iterations++
- << " iterand " << b
- << " value " << fb
- << std::endl
- ;
+ if(iteration_stream.good())
+ {
+ iteration_stream
+ << "iteration " << number_of_iterations++
+ << " iterand " << b
+ << " value " << fb
+ << std::endl
+ ;
+ }
double last_evaluated_iterand = b; // Note 1.
if(0.0 == fb)
{
@@ -401,12 +407,15 @@ root_type decimal_root
{
fb = static_cast<double>(f(b));
last_evaluated_iterand = b;
- iteration_stream
- << "iteration " << number_of_iterations++
- << " iterand " << b
- << " value " << fb
- << std::endl
- ;
+ if(iteration_stream.good())
+ {
+ iteration_stream
+ << "iteration " << number_of_iterations++
+ << " iterand " << b
+ << " value " << fb
+ << std::endl
+ ;
+ }
}
}
}
- [lmi-commits] [lmi] master updated (84e96df -> 47d6100), Greg Chicares, 2017/06/27
- [lmi-commits] [lmi] master b4420a3 3/7: Fix misspellings, Greg Chicares, 2017/06/27
- [lmi-commits] [lmi] master 7a09c77 2/7: Set 'badbit' for null stream, Greg Chicares, 2017/06/27
- [lmi-commits] [lmi] master eb90054 4/7: Do not use value_cast in decimal_root(), Greg Chicares, 2017/06/27
- [lmi-commits] [lmi] master c80737e 1/7: Measure minimum_birthdate() speed in unit test, Greg Chicares, 2017/06/27
- [lmi-commits] [lmi] master 47d6100 7/7: Suppress all output to null stream in decimal_root(),
Greg Chicares <=
- [lmi-commits] [lmi] master 1f03a06 5/7: Expunge max_stream_precision(), Greg Chicares, 2017/06/27
- [lmi-commits] [lmi] master f4d2b2c 6/7: Include headers iff used, stating reasons if not obvious, Greg Chicares, 2017/06/27