You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
IEEE-754 : mo<strong>de</strong>s d’arrondis<br />
Si a et b sont <strong>de</strong>ux nombres exactement représentables en machine (ou<br />
nombres machine) alors le résultat d’une opération r = a ⊚ b n’est, en<br />
général, pas représentable en machine. Il faut arrondir le résultat. Par<br />
exemple, en base β = 10, le nombre 1/3 n’est pas représentable avec un<br />
nombre fini <strong>de</strong> chiffres.<br />
La norme propose 4 mo<strong>de</strong>s d’arrondi :<br />
• arrondi vers +∞ (ou par excès), noté △(x) : retourne le plus petit<br />
nombre machine supérieur ou égal au résultat exact x<br />
• arrondi vers −∞ (ou par défaut), noté ∇(x) : retourne le plus grand<br />
nombre machine inférieur ou égal au résultat exact x<br />
• arrondi vers 0, noté Z(x) : retourne △(x) pour les nombres négatifs<br />
et ∇(x) pour les positifs<br />
• arrondi au plus près, noté ◦(x) : retourne le nombre machine le plus<br />
proche du résultat exact x (celui dont la mantisse se termine par un<br />
0 pour le milieu <strong>de</strong> nombres machine consécutifs, on parle d’arrondi<br />
pair)<br />
A. Tisserand – LIRMM, CNRS-UM2 – ARCHI07 – <strong>Unités</strong> <strong>de</strong> <strong>calcul</strong> <strong>flottant</strong> 37/144<br />
IEEE-754 : mo<strong>de</strong>s d’arrondi en C<br />
#i n c l u d e <br />
#i n c l u d e ” u t i l −i e e e . h”<br />
#i n c l u d e /∗ g e s t i o n <strong>de</strong> l ’ e n v i r o n n e m e n t f l o t t a n t ∗/<br />
i n t main ( ) {<br />
c f l o a t a , b , sup , sdown ;<br />
/∗ a = 2 − 2ˆ( −23) e t b = 2ˆ( −24) ∗/<br />
a . s . s i g = 0 ; a . s . exp = 0+127; a . s . man = (2