Hello,
just a numerical question: to test the equality of two floating point numbers 'a' and 'b', which of these 2 expressions you prefer:
abs(b-a) <= k * spacing(a)
abs(b-a) <= k * a * epsilon(a)
I've seen recommendations for the former, but I tend to prefer the latter, since spacing(a) varies with step functions, while a*epsilon(a) is linear with respect to 'a' ( a refinement is max(a*epsilon(a),tiny(a)) )
Also, is there a recommended value for k ?
Thanks,
Pierre
--
-----------------------------------------------------------------------
Pierre Hugonnet R&D Data Processing
COMPAGNIE GENERALE DE GEOPHYSIQUE - Paris Processing Centre
1, rue Leon Migaux / 91341 MASSY cedex / FRANCE
phone:(33) 164 47 45 59 fax:(33) 164 47 32 49
email:phugonnet(at)cgg.com (replace (at) by @)
-----------------------------------------------------------------------
The opinions expressed in this message are not necessarily
those of CGG or of Jacques Chirac
-----------------------------------------------------------------------
|