Boost C++ Libraries: Ticket #13606: sinc_pi incorrect taylor_0_bound https://svn.boost.org/trac10/ticket/13606 <p> from taylor_0_bound to taylor_2_bound all "result" values equal to "1.0" cause x2 can be greater epsilon only if x greater taylor_2_bound. </p> <p> So bounds should be recalculated and properly applied. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13606 Trac 1.4.3 John Maddock Sun, 17 Jun 2018 18:21:08 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/13606#comment:1 https://svn.boost.org/trac10/ticket/13606#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> You're quite right: fixed in <a class="ext-link" href="https://github.com/boostorg/math/commit/658945d50822adae83d77083a559e785ce18609c"><span class="icon">​</span>https://github.com/boostorg/math/commit/658945d50822adae83d77083a559e785ce18609c</a> along with better tests. </p> Ticket anonymous Mon, 18 Jun 2018 08:47:52 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/13606#comment:2 https://svn.boost.org/trac10/ticket/13606#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> Bounds is still incorrect. Should look like </p> <ul><li>Range0 for abs(x) in ( 0 , pow(eps, 1/2) ) result == 1.0, cause next Taylor x2/6 LESS than "epsilon" and 1.0-x2/6 == 1.0 </li></ul><p> For example (for double) if abs(x) == 1.0e-10. The x2 == 1.0e-20 and 1.0e-20/6 is less than double::epsilon, so 1.0 + 1.0e-20/6 == 1.0. </p> <ul><li>Range1 for abs(x) in ( pow(eps, 1/2) , pow(eps, 1/4) ) </li></ul><p> result == 1.0-x2/6, cause next Taylor x2*x2/120 LESS than "epsilon" even in Horner method. Important signs of x2*x2 is out of epsilon range. </p> <ul><li>Range2 for abs(x) in ( pow(eps, 1/4) , pow(eps, 1/6) ) </li></ul><p> result == 1.0 + x2 * (-1.0 + x2 / 20.0) / 6.0;, cause x<sup>6/7! LESS than "epsilon" even in Horner method. </sup></p> <p> NOTE: We can use approximate bounds from above ignoring Taylor series coefficients. Calculation of exact bounds is not trivial, and should use exact analytical precision bounds of all operations. </p> Ticket anonymous Mon, 18 Jun 2018 11:36:22 GMT <link>https://svn.boost.org/trac10/ticket/13606#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13606#comment:3</guid> <description> <p> Apologies: you're quite correct that the powers of epsilon are all wrong, I confess when looking at this that it may be over-optimised in any case given that evaluation of sin(x) is usually pretty fast in any case. I'll come back to this shortly when I'm less rushed. </p> </description> <category>Ticket</category> </item> <item> <author>minorlogic@…</author> <pubDate>Mon, 18 Jun 2018 13:31:08 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13606#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13606#comment:4</guid> <description> <ol><li>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. </li></ol><ol start="2"><li>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). </li></ol><p> 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). </p> <p> 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. </p> <ol start="3"><li>For improvement of precision, ranges and errors should be carefully verified and tested ( against six(x)/x ) in ranges approximating "sinc". </li></ol><ol start="4"><li>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. </li></ol><p> if(abs(x) &lt; eps_root_four) { </p> <blockquote> <p> return 1.0 - x2/6; </p> </blockquote> <p> } </p> <p> return six(x)/x; </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Tue, 19 Jun 2018 17:27:58 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/13606#comment:5 https://svn.boost.org/trac10/ticket/13606#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> See <a class="ext-link" href="https://github.com/boostorg/math/commit/838dd9419374d43b3021a959522a005bef0df4a2"><span class="icon">​</span>https://github.com/boostorg/math/commit/838dd9419374d43b3021a959522a005bef0df4a2</a> </p> Ticket