Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75456 - sandbox/variadic_templates/sandbox/stepper/boost/array_stepper/numeric
From: cppljevans_at_[hidden]
Date: 2011-11-12 09:22:20


Author: cppljevans
Date: 2011-11-12 09:22:20 EST (Sat, 12 Nov 2011)
New Revision: 75456
URL: http://svn.boost.org/trac/boost/changeset/75456

Log:
More debug prints and bigger tolerance for difference.
The bigger tolerance was needed because when size
of dimensions in test driver, array_dyn.diff_pde.cpp
(in libs/array_stepper/examples) was increased from around
10 to 60, got error indicating equations not solved.
That error produced by solve_tridiag.hpp calling
this function in back_substitute when SOLVE_TRIDIAG_VERIFY
was defined.

TODO:
  Find a more robust back_substitute.

Text files modified:
   sandbox/variadic_templates/sandbox/stepper/boost/array_stepper/numeric/almost_equal_relative.hpp | 11 +++++++----
   1 files changed, 7 insertions(+), 4 deletions(-)

Modified: sandbox/variadic_templates/sandbox/stepper/boost/array_stepper/numeric/almost_equal_relative.hpp
==============================================================================
--- sandbox/variadic_templates/sandbox/stepper/boost/array_stepper/numeric/almost_equal_relative.hpp (original)
+++ sandbox/variadic_templates/sandbox/stepper/boost/array_stepper/numeric/almost_equal_relative.hpp 2011-11-12 09:22:20 EST (Sat, 12 Nov 2011)
@@ -18,7 +18,7 @@
       almost_equal_relative
         ( Value value_a
         , Value value_b
- , Value eps_factor=Value(2.25)
+ , Value eps_factor=Value(30.0)
         )
        /**@brief
         * Are value_a and value_b almost equal?
@@ -27,9 +27,10 @@
         // http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
         //
         {
- Value max_error=eps_factor*std::numeric_limits<Value>::epsilon();
- Value abs_diff=std::abs(value_a - value_b);
- bool abs_lt_max=abs_diff < max_error;
+ Value const eps_val=eps_factor*std::numeric_limits<Value>::epsilon();
+ Value const max_error=eps_factor*eps_val;
+ Value const abs_diff=std::abs(value_a - value_b);
+ bool const abs_lt_max=abs_diff < max_error;
             if (abs_lt_max)
                 return true;
             Value abs_a=std::abs(value_a);
@@ -44,6 +45,8 @@
               <<"almost_equal_relative:"
               <<"\n:value_a="<<value_a
               <<"\n:value_b="<<value_b
+ <<"\n:eps_factor="<<eps_factor
+ <<"\n:eps_val="<<eps_val
               <<"\n:max_error="<<max_error
               <<"\n:abs_diff="<<abs_diff
               <<"\n:rel_error="<<rel_error


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk