On Wednesday, November 19, 2014 7:13:37 PM UTC-5, John Myles White wrote: > > I guess would argue there's a thin, but important, line between a > superstition and a heuristic. Universally avoiding exact equality tests for > floating point values seems like the simplest heuristic that would > generally lead one to correct conclusions, whereas using exact equality > tests while merely hoping they will work out seems like a very risky > heuristic. >
I'm not advocating "merely hoping". I'm advocating understanding how floating-point arithmetic works, and why x * 1.0 == x (for non-NaN), x * 0.0 == 0.0 (for non-NaN or Inf), and 1.0+1.0==2.0 while 1.0 + eps()/2 ==1. Without understanding these kinds of basics, it's hard to even use heuristics sensibly. My concern is that saying things like "x * (1/1) == x" are "dangerous" actively impedes understanding of the basics of fp arithmetic.
