Re: [Boost-bugs] [Boost C++ Libraries] #7290: complex acos is occasionally wrong

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7290: complex acos is occasionally wrong
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-08-26 18:31:37


#7290: complex acos is occasionally wrong
--------------------------------------------------------------+-------------
  Reporter: Stephen Montgomery-Smith <stephen@…> | Owner: johnmaddock
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: math
   Version: Boost 1.52.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------------------------------------+-------------

Comment (by Stephen Montgomery-Smith <stephen@…>):

 It looks like the mistake is in Figure 6 of the paper by Hull, Fairgrieve
 and Tang. It looks like this patch fixes it.

 {{{
 diff -u boost-trunk/boost/math/complex/acos.hpp boost-trunk-
 new/boost/math/complex/acos.hpp
 --- boost-trunk/boost/math/complex/acos.hpp 2012-08-26
 18:24:02.000000000 +0000
 +++ boost-trunk-new/boost/math/complex/acos.hpp 2012-08-26
 18:25:48.000000000 +0000
 @@ -172,14 +172,15 @@
              }
              else
              {
 - real = 0;
                 if(((std::numeric_limits<T>::max)() / xp1) > xm1)
                 {
                    // xp1 * xm1 won't overflow:
 + real = y / std::sqrt(xm1*xp1);
                    imag = boost::math::log1p(xm1 + std::sqrt(xp1*xm1));
                 }
                 else
                 {
 + real = y / x;
                    imag = log_two + std::log(x);
                 }
              }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7290#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC