Opened 8 years ago
Closed 8 years ago
#10046 closed Bugs (fixed)
halley iteration
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | To Be Determined | Component: | math |
Version: | Boost 1.55.0 | Severity: | Problem |
Keywords: | Cc: |
Description
When I use the halley iteration, it is coded as follows,
if(f1 != 0 && f2 != 0) {
Oops zero derivative!!!
} else {
if(f2 != 0) {
... T num = 2 * f1 - f0 * (f2 / f1); ...
} else {
delta = f0 / f1;
}
}
But there is no case for f1 == 0, so this might cause division by zero. The code should handle this case gracefully.
Note:
See TracTickets
for help on using tickets.
Fixed in git develop to bisect if the first derivative is zero: https://github.com/boostorg/math/commit/ab6cc524ddc42c4770ea653fc681f2c8581e3a18
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!