
30 Apr
2009
30 Apr
'09
10:53 p.m.
On Thu, Apr 30, 2009 at 1:57 PM, Dominique Devienne
[DD] Rarely, not never ;-) Never for people who do not know how it actually works internally :P
On Thu, Apr 30, 2009 at 1:57 PM, Dominique Devienne
A more proper implementation would be: bool FloatsEqual(float f1, float f2, float eps=0.00001) { return eps>(f1-f2); }
I'm no expert, but the above does not take into account the "magnitude" of the numbers. Comparing 0.000001 and 0.0000011 with 0.000001 and 999999.0 and 999999.1 with 0.00001 don't mean the same thing at all.
Which is why eps was a default value that can be overridden with whatever might be good for the time. And yea, forgot the absolute, been a long day. :)