Boost C++ Libraries: Ticket #10046: halley iteration https://svn.boost.org/trac10/ticket/10046 <p> When I use the halley iteration, it is coded as follows, </p> <p> if(f1 != 0 &amp;&amp; f2 != 0) { </p> <blockquote> <p> <em> Oops zero derivative!!! </em></p> </blockquote> <p> } else { </p> <blockquote> <p> if(f2 != 0) { </p> <blockquote> <p> ... T num = 2 * f1 - f0 * (f2 / f1); ... </p> </blockquote> <p> } else { </p> <blockquote> <p> delta = f0 / f1; </p> </blockquote> <p> } </p> </blockquote> <p> } </p> <p> But there is no case for f1 == 0, so this might cause division by zero. The code should handle this case gracefully. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10046 Trac 1.4.3 John Maddock Sun, 25 May 2014 14:37:19 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/10046#comment:1 https://svn.boost.org/trac10/ticket/10046#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> Fixed in git develop to bisect if the first derivative is zero: <a class="ext-link" href="https://github.com/boostorg/math/commit/ab6cc524ddc42c4770ea653fc681f2c8581e3a18"><span class="icon">​</span>https://github.com/boostorg/math/commit/ab6cc524ddc42c4770ea653fc681f2c8581e3a18</a> </p> <p> Note that this case can only happen if you're exactly bang on a maximum or minimum, in which case you actually have other things to worry about anyway! </p> Ticket