An Emacs-Cairo Scrolling Bug due to Floating-Point Inaccuracy
Résumé
We study a bug that we found in the GNU Emacs text editor when built against the Cairo graphics library. We analyze both the Emacs code and the Cairo code, and we suggest what can be done to avoid unexpected results. This involves a particular case with a computation that can be reduced to the equivalent floating-point expression ((1/s)·b)·s, where s and b are small positive integers such that b < s and the basic operations are rounded to nearest. The analysis takes into account the values of s and b that can occur in practice, and the suggestions for workarounds must avoid handling this particular case in a separate branch or breaking the structure of the Cairo library (so that just returning b is not possible).
Domaines
Arithmétique des ordinateursOrigine | Fichiers produits par l'(les) auteur(s) |
---|---|
Licence |