06.07.2013 Views

Unités de calcul flottant - Lirmm

Unités de calcul flottant - Lirmm

Unités de calcul flottant - Lirmm

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Représentations <strong>de</strong>s réels<br />

Représentations en machine ou dans les circuits :<br />

• virgule fixe<br />

• virgule <strong>flottant</strong>e<br />

• système logarithmique<br />

• . . .<br />

Important : du fait <strong>de</strong> la précision fixe, on a une approximation <strong>de</strong>s<br />

nombres réels.<br />

A. Tisserand – LIRMM, CNRS-UM2 – ARCHI07 – <strong>Unités</strong> <strong>de</strong> <strong>calcul</strong> <strong>flottant</strong> 13/144<br />

Virgule <strong>flottant</strong>e<br />

Un nombre x est représenté en virgule <strong>flottant</strong>e <strong>de</strong> base β par :<br />

• son signe sx (codage sur un bit : 0 pour x positif et 1 pour x négatif)<br />

• son exposant ex, un entier <strong>de</strong> k chiffres compris entre emin et emax<br />

• sa mantisse mx <strong>de</strong> n + 1 chiffres<br />

tels que<br />

avec<br />

où xi ∈ {0, 1, . . . , β − 1}.<br />

x = (−1) sx × mx × β ex<br />

mx = x0 . x1 x2 x3 · · · xn<br />

Pour <strong>de</strong>s questions <strong>de</strong> précision, on exige que la mantisse soit normalisée,<br />

c’est-à-dire que son premier chiffre x0 soit différent <strong>de</strong> 0. On a alors<br />

mx ∈ [1, β[. Il faut alors un codage spécial pour le nombre 0.<br />

A. Tisserand – LIRMM, CNRS-UM2 – ARCHI07 – <strong>Unités</strong> <strong>de</strong> <strong>calcul</strong> <strong>flottant</strong> 15/144<br />

Virgule fixe<br />

Dans bon nombre <strong>de</strong> processeurs DSP, on trouve un support matériel<br />

très efficace (en vitesse et consommation d’énergie) pour le <strong>calcul</strong> sur les<br />

réels à l’ai<strong>de</strong> <strong>de</strong> multiples formats en virgule fixe (16, 24 ou 32 bits).<br />

23<br />

N16 ou Z16<br />

1Q15<br />

Q16<br />

16<br />

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0<br />

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2<br />

−1 −2 −3 −4 −5 −6 −7 −8 −9 −10 −11 −12 −13 −14 −15<br />

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2<br />

0<br />

−1 −2 −3 −4 −5 −6 −7 −8 −9 −10 −11 −12 −13 −14 −15 −16<br />

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2<br />

8Q16<br />

7 6 5 4 3 2 1 0 −1 −2 −3 −4 −5 −6 −7 −8 −9 −10 −11 −12 −13 −14 −15 −16<br />

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2<br />

s<br />

s<br />

s<br />

s<br />

MSB position <strong>de</strong>s bits<br />

LSB<br />

Mais la qualité numérique et la portablilité sont moindres qu’en IEEE-754<br />

A. Tisserand – LIRMM, CNRS-UM2 – ARCHI07 – <strong>Unités</strong> <strong>de</strong> <strong>calcul</strong> <strong>flottant</strong> 14/144<br />

Système logarithmique<br />

Un nombre est représenté par son signe et le logarithme <strong>de</strong> sa valeur<br />

absolue écrit en virgule fixe (le nombre 0 doit être représenté par un<br />

codage spécial).<br />

Les opérations dans ce système s’effectuent en utilisant :<br />

log 2(a × b) = log 2 a + log 2 b<br />

log 2(a ÷ b) = log 2 a − log 2 b<br />

log 2(a ± b) = log 2 a + log 2(1 ± 2 log 2 b−log 2 a )<br />

log 2(a q ) = q × log 2 a<br />

où les fonctions log 2(1 + 2 x ) et log 2(1 − 2 x ) sont tabulées ou approchées.<br />

Applications en traitement du signal et en contrôle numérique. Il y avait<br />

même un projet européen pour concevoir un processeur avec <strong>de</strong>s unités<br />

<strong>de</strong> <strong>calcul</strong> 32 bits en système logarithmique.<br />

A. Tisserand – LIRMM, CNRS-UM2 – ARCHI07 – <strong>Unités</strong> <strong>de</strong> <strong>calcul</strong> <strong>flottant</strong> 16/144<br />

8<br />

0

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!