approxEqual() has fooled me for a long time...

Aelxx aelxx at yandex.ru
Wed Oct 20 10:45:05 PDT 2010


"Don" <nospam at nospam.com> ÐÏ×?ÄÏÍÉ×/ÐÏ×?ÄÏÍÉÌÁ × 
ÎÏ×ÉÎÁÈ:i9mhvd$2l5f$1 at digitalmars.com...
> Lars T. Kyllingstad wrote:
> in all the tricky special cases. Unlike a naive relative equality test 
> involving divisions, it doesn't fail for values near zero. (I _think_ 
> that's the reason why people think you need an absolute equality test as 
> well).
> And it's fast. No divisions, no poorly predictable branches.

Just wonder. I always used relative equality in form:  fabs(a-b) > eps * 
fabs(a)    is therew something wrong in that, except maybe zero a? 




More information about the Digitalmars-d mailing list