Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76373 - in trunk: boost/math/special_functions/detail libs/math/test
From: john_at_[hidden]
Date: 2012-01-08 13:51:25


Author: johnmaddock
Date: 2012-01-08 13:51:23 EST (Sun, 08 Jan 2012)
New Revision: 76373
URL: http://svn.boost.org/trac/boost/changeset/76373

Log:
Correct overflow logic in Bessel Y and add new test case.
Fixes #6367.
Text files modified:
   trunk/boost/math/special_functions/detail/bessel_yn.hpp | 2 +-
   trunk/libs/math/test/test_bessel_y.hpp | 5 +++--
   2 files changed, 4 insertions(+), 3 deletions(-)

Modified: trunk/boost/math/special_functions/detail/bessel_yn.hpp
==============================================================================
--- trunk/boost/math/special_functions/detail/bessel_yn.hpp (original)
+++ trunk/boost/math/special_functions/detail/bessel_yn.hpp 2012-01-08 13:51:23 EST (Sun, 08 Jan 2012)
@@ -90,7 +90,7 @@
            ++k;
        }
        while(k < n);
- if(tools::max_value<T>() * factor < value)
+ if(fabs(tools::max_value<T>() * factor) < fabs(value))
           return sign(value) * sign(value) * policies::raise_overflow_error<T>(function, 0, pol);
        value /= factor;
     }

Modified: trunk/libs/math/test/test_bessel_y.hpp
==============================================================================
--- trunk/libs/math/test/test_bessel_y.hpp (original)
+++ trunk/libs/math/test/test_bessel_y.hpp 2012-01-08 13:51:23 EST (Sun, 08 Jan 2012)
@@ -163,7 +163,7 @@
         {{ SC_(1), SC_(1e+03), SC_(-0.0247843312923517789148623560971412909386318548648705287583490) }},
         {{ SC_(1), SC_(1e+05), SC_(0.00171921035008825630099494523539897102954509504993494957572726) }}
     }};
- static const boost::array<boost::array<T, 3>, 9> yn_data = {{
+ static const boost::array<boost::array<T, 3>, 10> yn_data = {{
         {{ SC_(2), SC_(1e-20), SC_(-1.27323954473516268615107010698011489627570899691226996904849e40) }},
         {{ SC_(5), SC_(10), SC_(0.135403047689362303197029014762241709088405766746419538495983) }},
         {{ SC_(-5), SC_(1e+06), SC_(0.000331052088322609048503535570014688967096938338061796192422114) }},
@@ -172,7 +172,8 @@
         {{ SC_(-10), SC_(1e+06), SC_(0.000725951969295187086245251366365393653610914686201194434805730) }},
         {{ SC_(1e+02), SC_(5), SC_(-5.08486391602022287993091563093082035595081274976837280338134e115) }},
         {{ SC_(1e+03), SC_(1e+05), SC_(0.00217254919137684037092834146629212647764581965821326561261181) }},
- {{ SC_(-1e+03), SC_(7e+02), SC_(-1.88753109980945889960843803284345261796244752396992106755091e77) }}
+ {{ SC_(-1e+03), SC_(7e+02), SC_(-1.88753109980945889960843803284345261796244752396992106755091e77) }},
+ {{ SC_(-25), SC_(8), SC_(3.45113613777297661997458045843868931827873456761831907587263e8) }}
     }};
     static const boost::array<boost::array<T, 3>, 9> yv_data = {{
         //SC_(2.25), {{ SC_(1) / 1024, SC_(-1.01759203636941035147948317764932151601257765988969544340275e7) }},


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