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 ?
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 @)
-----------------------------------------------------------------------
Bonjour...
Reponse un peu tardive, mais je ne prends connaissance qu'aujourd'hui de
votre message!!
J'utilise personnellement depuis *toujours* (!) la seconde formule
(avec; ABS (A), qui va de soi je suppose).
Je prends: k = 5
Je considere aussi le cas ou A est "petit", pour eviter un depassement
de capacite vers le bas dans le produit A * Epsilon (A).
Cordialement,
---------------------------------------------------------
* Patrice LIGNELET *
* Tel: 01 40 27 23 83 Fax: 01 40 27 23 77 *
* 22 58 (Secretariat) *
* Courriel: [log in to unmask] *
* Sur la Toile mondiale (le Ouaibe): *
* http://www2.cnam.fr/~lignelet *
* *
* Conservatoire National des Arts et Metiers *
* Departement d'Informatique *
* 292, rue Saint Martin (\
* 75141 PARIS Cedex 03 ( \
=========================================================) ) />
/ ) / //))/
\ \_/ /////
\ /
\_ /
| |
| |
-----
-----
|