Stupid is as Stupid Does: Taking the Square Root of the Square of a Floating-Point Number - INRIA - Institut National de Recherche en Informatique et en Automatique Accéder directement au contenu
Communication Dans Un Congrès Année : 2015

Stupid is as Stupid Does: Taking the Square Root of the Square of a Floating-Point Number

Résumé

Floating-point experts know that mathematical formulas may fail or give imprecise results when implemented in floating-point arithmetic. This article describes an example where, surprisingly, it is absolutely not the case. Indeed, using radix 2 and an unbounded exponent range, the computation of the square root of the square of a floating-point number a is exactly |a|. A consequence is the fact that the floating-point computation of a/ sqrt (a^2 + b^2) is always in the interval [−1, 1]. This removes the need for a test when calling an arccos or an arcsin on this value. For more guarantees, this property was formally checked using the Coq proof assistant and the Flocq library. The conclusion will give hints on what happens without assumptions and in other radices, where the behavior is very different.
Fichier principal
Vignette du fichier
article.pdf (255.4 Ko) Télécharger le fichier
Origine : Fichiers produits par l'(les) auteur(s)

Dates et versions

hal-01148409 , version 1 (05-05-2015)

Identifiants

  • HAL Id : hal-01148409 , version 1

Citer

Sylvie Boldo. Stupid is as Stupid Does: Taking the Square Root of the Square of a Floating-Point Number. Seventh and Eighth International Workshop on Numerical Software Verification, Apr 2015, Seattle, WA, United States. pp.50--55. ⟨hal-01148409⟩
1205 Consultations
1409 Téléchargements

Partager

Gmail Facebook X LinkedIn More