in reply to Re^4: Floating Point Errors: How and Why to Avoid Adding and Subtracting Varying Numbers (contriving)
in thread Floating Point Errors
And it appears that it demonstrated the problem quite successfully to you.
Indeed. Enlightenment achieved.
I started my reply thinking that I'd find that in a more common (i.e., not contrived) case, ikegami's better_average really would be better. What I found instead is that in the more common case they're pretty much the same. Even though I did not show what I set out thinking I'd show, I posted my results anyway.
Someone else who had the same thoughts I had can examine my results and my methods and go forward from there or at least not have to cover the same ground again.
You seem to be saying that contrived examples are more important than a common case. That is, the very limit of inaccuracy is where to make a decision. I think for any given method, the more common the case is, the more important it is. For these two, with what's shown so far, bad_average looks better. If there were some less common but still plausible scenario where better_average wins, I'd want to go with that, even though it fails in a case I'll probably never see.
I appreciate your thoughts on handling floats. As I said elsewhere, my own attitude toward them is mostly just fear and loathing left over since I've forgotten the details.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Floating Point Errors: How and Why to Avoid Adding and Subtracting Varying Numbers (contriving)
by tye (Sage) on May 29, 2008 at 06:40 UTC |