Re:Mean of two floating point numbers can be dangerous
by wronskian on Sunday June 05, 2016 @04:28PM
(#11842955)
I saw this exact failure mode in the wild - a C++ Newton-Raphson implementation that relied on the order coming out of the mean calculation. In this case, the ordering put the N-R algorithm out and instability resulted. I seem to remember the fix was to put some simple bisection around the N-R guess, and if it went outside that range, truncate at the bisection range. It worked! (If anyone really wants the details, I can probably find the exact fix in our source control history.)
[ Parent
| on HN ]