Re: [Boost-bugs] [Boost C++ Libraries] #13606: sinc_pi incorrect taylor_0_bound

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #13606: sinc_pi incorrect taylor_0_bound
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-06-18 13:31:09


#13606: sinc_pi incorrect taylor_0_bound
-------------------------------+------------------------------------
  Reporter: minorlogic@… | Owner: John Maddock
      Type: Bugs | Status: reopened
 Milestone: To Be Determined | Component: math
   Version: Boost 1.63.0 | Severity: Optimization
Resolution: | Keywords: sinc_pi taylor_0_bound
-------------------------------+------------------------------------

Comment (by minorlogic@…):

 1. It only should optimize precision. Cause sin(x)/x is pretty fast and
 quite precise (it use hardware asm code on many platforms). sin(x)/x only
 should check x != 0. With float ranges close to zero, sin(x) strongly
 equal to x, and division of any floating point to itself must equal to
 1.0. So sin(x)/x with x!= 0 is quite precise and save.

 2. Within range (pow(eps, 1/2) , pow(eps, 1/6)) taylor expansion provide a
 small precision improvement. It is small comparing to direct sin(x)/x but
 can provide several bits of precision (difference of errors about 5%-10%
 on most platforms).

 It is not easy, to predict precision loss from sin(x)/x. Different
 platforms and compilers provides different sin(x) precision, and its error
 grows after division by x. Using Taylor approximation we can provide exact
 solution with known error upper bound (compared to float epsilon).

 From other hand, if we use sin(x) on most of "sinc" ranges, we can use it
 in whole range, and final error depends from sin(x) implementation.

 3. For improvement of precision, ranges and errors should be carefully
 verified and tested ( against six(x)/x ) in ranges approximating "sinc".

 4. For fast and save implementation i propose use only one branch and
 range check (0, pow(eps, 1/4) ) and expansion with 1.0 - x2/6.

 if(abs(x) < eps_root_four)
 {
    return 1.0 - x2/6;
 }

 return six(x)/x;

-- 
Ticket URL: <https://svn.boost.org/trac10/ticket/13606#comment:4>
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 : 2018-06-18 13:36:35 UTC