13.11.2014 Views

La représentation de l'information - IIHE

La représentation de l'information - IIHE

La représentation de l'information - IIHE

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.

<strong>La</strong> <strong>représentation</strong> <strong>de</strong> l’information<br />

• Technologie : système à 2 états stables<br />

(binaire)<br />

• Représentation <strong>de</strong> :<br />

— Données numériques<br />

— Texte<br />

— Instructions<br />

— Images<br />

— Son<br />

— …<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 1


Le système binaire<br />

• Elément <strong>de</strong> base : le bit (binary digit; 0, 1)<br />

• Groupement en :<br />

— octets (bytes) : 8 bits (2 3 )<br />

— mots (words) : 2 n octets (n = 1, 2 ou 3 actuellement !)<br />

• Unité <strong>de</strong> base : l’octet<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 2


Les puissances (<strong>de</strong> 10 <strong>de</strong> 2)<br />

Kilo : 10 3 = 1.000 2 10 =1024<br />

Méga : 10 6 = 1.000.000 2 20 =1.048.576<br />

Giga : 10 9 = 1.000.000.000 2 30 =1.073.741.824<br />

Téra : 10 12 = 1.000.000.000.000 2 40 =1.099.511.627.776<br />

Péta : 10 15 = 1.000.000.000.000.000 2 50 =1.125.899.906.842.624<br />

NB. 1 Moctet = 8x2 20 = 2 3 x2 20 = 2 23 = 8.388.608 bits<br />

milli : 10 -3 = 0,001<br />

micro : 10 -6 = 0,000001<br />

nano : 10 -9 = 0,000000001<br />

pico : 10 -12 = 0,000000000001<br />

femto : 10 -15 = 0,000000000000001<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 3


<strong>La</strong> numération par addition<br />

• Les symboles conservent leur valeur<br />

• Leur juxtaposition les additionne (soustrait)<br />

• Les chiffres romains :<br />

I , II , III , IV …<br />

• Arithmétique difficile !<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 4


<strong>La</strong> numération par position<br />

• Définition d’une base<br />

• <strong>La</strong> base détermine le nombre <strong>de</strong> symboles<br />

• <strong>La</strong> position multiplie le symbole par la<br />

puissance correspondante <strong>de</strong> la base<br />

• Exemple système décimal : base = 10<br />

10 symboles : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 5


2837 10 = 7x10 0 + 3x10 1 + 8x10 2 + 2x10 3<br />

Généralisation : n i est le chiffre en position i et b est la base<br />

m<br />

∑ m m-1 2 1 0 i<br />

i=0<br />

(n n ...n n n ) = n × b<br />

Système octal : base 8, 8 symboles (0, 1, 2, 3, 4, 5, 6, 7)<br />

5425 8 = 5x8 0 + 2x8 1 + 4x8 2 + 5x8 3 = 2837 10<br />

Système binaire : base 2, 2 symboles (0, 1)<br />

101100010101 2 =<br />

1x2 0 +0x2 1 +1x2 2 +0x2 3 +1x2 4 +0x2 5 +0x2 6 +0x2 7 +1X2 8 +1X2 9 +0x2 10 +1X2 11<br />

= 2837 10<br />

i<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 6


Système hexadécimal : base 16, 16 symboles (0, 1, 2, 3, 4, 5, 6, 7, 8, 9,<br />

A[10], B[11], C[12], D[13], E[14], F[15])<br />

B15 16 = 5x16 0 + 1x16 1 + 11x16 2 = 2837 10<br />

Les seize premiers nombres<br />

binaire octal hexadécimal décimal<br />

0000 00 0 00<br />

0001 2 1 01 1 01<br />

0010 02 2 02<br />

0011 2 2 03 3 03<br />

0100 04 4 04<br />

0101 05 5 05<br />

0110 06 6 06<br />

0111 2 3 07 7 07<br />

1000 10 8 08<br />

1001 11 9 09<br />

1010 12 A 10<br />

1011 13 B 11<br />

1100 14 C 12<br />

1101 15 D 13<br />

1110 16 E 14<br />

1111 17 F 15<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 7


Passage d’une base à l’autre<br />

Rappel passage <strong>de</strong> la base b à la base 10 :<br />

m<br />

∑ 10 i<br />

i=0<br />

x = n × b<br />

i<br />

q<br />

q<br />

Passage <strong>de</strong> la base 10 à la base b : Divisions successives<br />

x<br />

10<br />

= (nmn m-1...n2n1n 0)<br />

x<br />

10<br />

=q<br />

0.b+n<br />

n<br />

0<br />

0 est le reste <strong>de</strong> la division <strong>de</strong> x par b<br />

q = (n n ...n n ) q 0 est le quotient <strong>de</strong> cette division<br />

q<br />

q<br />

0 m m-1 2 1<br />

0 1 1<br />

1<br />

m−1<br />

=q .b+n<br />

=q<br />

2.b+n2<br />

.<br />

=q .b+n<br />

m-2 m-1 m-1<br />

=0.b+n<br />

m<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 8


Exemple<br />

Transformation du nombre 2837 10 en octal :<br />

2837 8<br />

24 354 8<br />

43<br />

32<br />

40 34<br />

44 8<br />

3 7 32 40<br />

5<br />

32 2<br />

4<br />

5<br />

2837 10 = 5425 8<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 9


Passage d’une base b à une base b k<br />

• Regrouper les chiffres k par k<br />

• Transformer chaque groupe en chiffre <strong>de</strong> la base b k<br />

Exemple : passage <strong>de</strong> la base 2 à la base 2 3 (8) k = 3<br />

101100010101 2 = 101 2 100 2 010 2 101 2 = 5 8 4 8 2 8 5 8 = 5425 8<br />

passage <strong>de</strong> la base 2 à la base 2 4 (16) k = 4<br />

101100010101 2 = 1011 2 0001 2 0101 2 = B 16 1 16 5 16 = B15 16<br />

• <strong>La</strong> transformation inverse se réalise en remplaçant<br />

chaque chiffre <strong>de</strong> la base b k par k chiffres <strong>de</strong> la base b.<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 10


Entiers non signés ( ≡ positifs)<br />

Mémoire organisée logiquement en entités <strong>de</strong> w bits correspondant à<br />

<strong>de</strong>s multiples d’octets :<br />

2 octets (w=16 bits) : <strong>de</strong>mi mot<br />

4 octets (w=32 bits): mot<br />

8 octets (w=64 bits): mot long<br />

<strong>La</strong> <strong>représentation</strong> binaire est complétée par <strong>de</strong>s " 0 " en tête <strong>de</strong> mot<br />

Exemple: 2837 10 dans un <strong>de</strong>mi mot (w = 16): 0000 1011 0001 0101 2<br />

Le plus grand nombre pouvant être représenté sur 16 bits est :<br />

1111 1111 1111 1111 2 = 1 0000 0000 0000 0000 2 – 1 = 2 16 - 1<br />

L'intervalle d'une <strong>représentation</strong> sur w bits est : [ 0, 2 w - 1 ]<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 11


Entiers signés<br />

Le signe est une information binaire ( + ou -) 1 bit (0 ou 1)<br />

<strong>La</strong> longueur <strong>de</strong> l'entité réservée au nombre est raccourcie d'une unité<br />

Exemple (w=16): +2837 10 0000 1011 0001 0101 2 = B15 16<br />

- 2837 10 1000 1011 0001 0101 2 = 8B15 16<br />

Intervalle accessible : [ - (2 w-1 -1) , 2 w-1 -1 ]<br />

35605 10 !<br />

Convention !!!!<br />

Deux problèmes : 1) 2 <strong>représentation</strong>s du zéro :<br />

+0 0000 0000 0000 0000 = 0000 16<br />

-0 1000 0000 0000 0000 = 8000 16<br />

2) Arithmétique compliquée :<br />

Soustraction ≠ addition nombre négatif<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 12


Complément à un<br />

-n 2 w -n -1<br />

Solutions<br />

+2837 10 0000 1011 0001 0101 2 = B15 16<br />

- 2837 10 1111 0100 1110 1010 2 = F4EA 16<br />

Tous les bits sont inversés<br />

Arithmétique OK mais :<br />

Deux zéros<br />

Problème <strong>de</strong> parité !<br />

Complément à <strong>de</strong>ux<br />

+0 0000 0000 0000 0000 = 0000 16<br />

-0 1111 1111 1111 1111 = FFFF 16<br />

Intervalle : [ - (2 w-1 -1) , 2 w-1 -1 ]<br />

+2837<br />

-n 2 w 10 0000 1011 0001 0101 2 = B15 16<br />

-n<br />

- 2837 10 1111 0100 1110 1011 2 = F4EB 16<br />

Tous les bits sont inversés<br />

puis +1<br />

0 0000 0000 0000 0000 = 0000<br />

Arithmétique OK<br />

16<br />

Un zéro<br />

Intervalle : [ - 2 w-1 , 2 w-1 -1 ]<br />

Pas <strong>de</strong> problème <strong>de</strong> parité<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 13


Les réels<br />

<strong>La</strong> <strong>représentation</strong> à virgule fixe<br />

Exemple : 2837,51 10 = 1x10 -2 + 5x10 -1 + 7x10 0 + 3x10 1 + 8x10 2 + 2x10 3<br />

Définition: partie entière (longueur m)<br />

partie fractionnaire (longueur k)<br />

m+k=w (longueur <strong>de</strong> l'entité)<br />

m = 4; k = 2<br />

Généralisation :<br />

m-1<br />

∑ m-1 m-2 2 1 0 -1 -2 -k i<br />

i=-k<br />

(n n ...n n n ,n n ...n ) = n × b<br />

i<br />

En binaire : m = 8; k = 3 : 10011010,101 2<br />

1x2 -3 + 0x2 -2 + 1x2 -1 + 0x2 0 + 1x2 1 + 0x2 2 + 1x2 3 + 1x2 4 + 0x2 5 + 0x2 6 + 1x2 7<br />

= 154,625 10<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 14


Transformation inverse<br />

14,42 10 binaire (m=8, k=8) ?<br />

14,42 = 14 + 0,42<br />

14 10 =00001110 2<br />

0,42 × 2 = 0,84<br />

0,42 10 = 0, 01101<br />

011<br />

0,84 × 2 = 1,68<br />

0,68 × 2 = 1,36<br />

0,36 × 2 = 0,72<br />

0,72 × 2 = 1,44<br />

0,44 × 2 = 0,88<br />

0,88 × 2 = 1,76<br />

0,76 × 2 = 1,52<br />

= 0,41796875 10<br />

14,42 10 = 00001110,01101011 2<br />

Précision !<br />

0,01101011 2 = 0 ×2 -1 +1 ×2 -2 +1 ×2 -3 +0 ×2 -4<br />

+1 ×2 -5 +0 ×2 -6 +1 ×2 -7 +1 ×2 -8<br />

NB. 1 bit <strong>de</strong> plus : 0,011010111 2 =0,419921875 10<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 15


Précision …<br />

Mot <strong>de</strong> longueur w intervalle -2 w-k-1 < r < 2 w-k-1 (Complément à 1)<br />

-2 w-k-1 ≤ r < 2 w-k-1 (Complément à 2)<br />

Conséquence : à longueur <strong>de</strong> mot (w) constante<br />

Gran<strong>de</strong> précision k grand : petits nombres<br />

Grands nombres k petit : petite précision<br />

Exemple (en décimal) :<br />

w=7; k=5 (5 chiffres <strong>de</strong>rrière la virgule) intervalle [-9,99999 , 9,99999]<br />

w=7; k=0 intervalle [-999999 , 999999]<br />

Pour augmenter la taille <strong>de</strong>s nombres k négatif<br />

w=7; k =-3 intervalle [-999999000 , 999999000]<br />

± 999999 x 10 -k<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 16


Représentation en virgule flottante<br />

Notation du type "ingénieur" :<br />

1,37603x10 1 ATS<br />

4,03399x10 1 BEF<br />

1,95583x10 0 DEM<br />

1,66386x10 2 ESP<br />

5,94573x10 0 FIM<br />

6,55957x10 0 FRF<br />

7,87564x10 -1 IEP<br />

1,93627x10 3 ITL<br />

= 1 €<br />

6 chiffres exacts<br />

taille du nombre puissance <strong>de</strong> 10<br />

Du très petit (1,67262 x 10 -27 : masse du proton en kg)<br />

Au très grand (6,02214 x 10 23 : nombre d'Avogadro)<br />

avec la même précision<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 17


En binaire<br />

Signe (1 bit)<br />

Exposant (puissance <strong>de</strong> 2)<br />

Mantisse (en virgule fixe) normalisation !!<br />

m=1 k=23<br />

exemple : +0,11010000000000000000000 x 2 3 = 0,8125 x 8 = 6,5 10<br />

0 00000011 11010000000000000000000<br />

signe(s) exposant(e) mantisse(m)<br />

Technicalités :<br />

<strong>La</strong> convention IEEE :<br />

• L'exposant est incrémenté d'un décalage<br />

(pour éviter les <strong>représentation</strong>s négatives)<br />

• L'exposant peut-être appliqué à un nombre X<br />

où X est une puissance <strong>de</strong> 2 (2 p )<br />

• Le bit le plus significatif <strong>de</strong> la mantisse est non nul<br />

1 8 23 bits<br />

s 1,m x 2 e s e+127 m<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 18


Caractères, texte et symboles spéciaux<br />

Version ”codée” du caractère<br />

D'abord utilisée pour représenter les chiffres <strong>de</strong>cimaux :<br />

10 symboles (0, 1,…, 9) 4 bits (2 4 = 16 possibilités)<br />

<strong>La</strong> convention BCD (Binary Co<strong>de</strong>d Decimal) :<br />

Chiffre BCD<br />

0 0000 2<br />

Les 6 <strong>de</strong>rniers nombres :<br />

1 0001 2<br />

<strong>de</strong> 1010<br />

2 0010 2 1111 2 utilisés pour les<br />

2<br />

. symboles ”speciaux” ”!”, ”.”, ” * ”, ”:”, …<br />

.<br />

9 1001 2<br />

Exemple : 853.91 representé par : 1000 0101 0011 1011 1001 0001 2<br />

NB. 1000 0101 0011 1011 1001 0001 2 = 853B91 16 = 8,731,537 10<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 19


Extensions<br />

6 bits 64 symboles; 7 bits 128 symboles; 8 bits 256 symboles<br />

ASCII (American Standard Co<strong>de</strong> for Information Interchange) : 7 bits<br />

EBCDIC ( Exten<strong>de</strong>d Binary Co<strong>de</strong>d Decimal Interchange Co<strong>de</strong>) : 8 bits<br />

Caractère<br />

ASCII<br />

0 011 0000 2<br />

1 011 0001 2<br />

2 011 0010 2<br />

. .<br />

. .<br />

9 011 1001 2<br />

A 100 0001 2<br />

B 100 0010 2<br />

C 100 0011 2<br />

. .<br />

. .<br />

Z 101 1010 2<br />

a 110 0001 2<br />

b 110 0010 2<br />

. .<br />

. .<br />

EBCDIC<br />

1111 0000 2<br />

1111 0001 2<br />

1111 0010 2 .<br />

1111 1001 2<br />

1100 0001 2<br />

1100 0010 2<br />

1100 0011 2 . .<br />

1110 1001 2<br />

1000 0001 2<br />

1000 0010 2 . .<br />

Sept bits ?<br />

<strong>de</strong>tection <strong>de</strong>s erreurs<br />

8 ème bit : test <strong>de</strong> parité<br />

Parité paire :<br />

nombre pair <strong>de</strong> bits ”1”<br />

ex.: ”A” : 0100 0001<br />

(2 bits ”1”)<br />

Parité impaire :<br />

nombre impair <strong>de</strong> bits ”1”<br />

ex.: ”A” : 1100 0001<br />

(3 bits ”1”)<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 20


y<br />

Les images (vecteurs)<br />

(x 2 ,y 2 )<br />

z<br />

(x 2 ,y 2 ,z 2 )<br />

(x 1 ,y 1 ,z 1 )<br />

(x 3 ,y 3 ,z 3 )<br />

(x 1 ,y 1 )<br />

2 dimensions (plan)<br />

y<br />

2 x 2 entiers : coordonnées<br />

<strong>de</strong> début et <strong>de</strong> fin<br />

Taille <strong>de</strong>s nombres ≡ résolution du milieu<br />

Ecran : 1024 points x768lignes;<br />

1280 points x1024lignes.<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

x<br />

3 dimensions (espace) :<br />

”Meshes” : 3 x 3 entiers :<br />

sommets du triangle<br />

2 réels : cosinus directeurs<br />

<strong>de</strong> la normale :<br />

Réflexion <strong>de</strong> la lumière<br />

D. Bertrand 21<br />

x


Lesimages(”bit maps”)<br />

0000000100000000<br />

0000001010000000<br />

0000000100000000<br />

0000010001000000<br />

0000001010000000<br />

0000100000100000<br />

0000000100000000<br />

0000010001000000<br />

0001000000010000<br />

0000001010000000<br />

0000100000100000<br />

0010000000001000<br />

0000010001000000<br />

0001000000010000<br />

0100000000000100<br />

0000100000100000<br />

0010000000001000<br />

1111111111111110<br />

0001000000010000<br />

0100000000000100<br />

0010000000001000<br />

1111111111111110<br />

0100000000000100<br />

0100000000000100<br />

0100000000000100<br />

1111111111111110<br />

0100000000000100<br />

0100000011100100<br />

0100000000000100<br />

0100000000000100<br />

0100000000000100<br />

0100000011100100<br />

0100100000000100<br />

0100000000000100<br />

0101010011100100<br />

0100000011100100<br />

0100100000000100<br />

0101010000000100<br />

0100000000000100<br />

0101010011100100<br />

1111111111111110<br />

0100100000000100<br />

0101010000000100<br />

0101010011100100<br />

1111111111111110<br />

0101010000000100<br />

1111111111111110<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

2 couleurs : 1 bit<br />

Noir/blanc (0/1)<br />

4 niveaux <strong>de</strong> gris : 2 bits<br />

00 noir<br />

01 gris foncé<br />

10 gris clair<br />

11 blanc<br />

8 couleurs : 3 bits<br />

000 noir<br />

001 rouge<br />

010 vert<br />

011 jaune<br />

100 bleu<br />

101 magenta<br />

110 cyan<br />

111 blanc<br />

D. Bertrand 22


Inflation mémoire …<br />

256 couleurs 8 plans <strong>de</strong> mémoires (256 = 2 8 )<br />

Plus <strong>de</strong> couleurs Plus <strong>de</strong> plans <strong>de</strong> mémoires<br />

Solution possible …<br />

<strong>La</strong> palette <strong>de</strong> couleur :<br />

Définition d'une ”vi<strong>de</strong>o look-up table” (ou table <strong>de</strong> couleur ou ”color map”)<br />

Ex. : choix <strong>de</strong> 256 couleurs dans une palette <strong>de</strong> 16,777,216 possibilités<br />

<strong>La</strong> mémoire <strong>de</strong> 8 plans est utilisée comme in<strong>de</strong>x<br />

d'une table <strong>de</strong> 256 (2 8 ) mots <strong>de</strong> 24 bits (2 24 = 16,777,216) :<br />

bbbb bbbb vvvv vvvv rrrr rrrr 2<br />

bits ”bleus”<br />

bits ”verts”<br />

bits ”rouges”<br />

Du léger (0000 0001 2<br />

) à l'intense (1111 1111 2<br />

) rouge, vert, bleu<br />

01 16<br />

FF 16<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

D. Bertrand 23


H<br />

Son …<br />

Intervalles <strong>de</strong> temps<br />

Fréquence d'échantillonnage<br />

Ex.: 0,0001 s 10 kHz<br />

CD-ROM qualité HI-FI :<br />

t<br />

Fréquence 44,1kHz (NB. Transmission tél. : 3kHz)<br />

Résolution 16 bits<br />

Une minute musique stéréo :<br />

2 x 2 x 60 x 44.100 ≈ 10 Moctets<br />

canaux octets sec échantillons<br />

Vitesse <strong>de</strong> transmission :<br />

16<br />

bits<br />

Année préparatoire Licence Informatique (ULB/UMH) Charleroi. Fonctionnement <strong>de</strong>s ordinateurs. Chapitre 3<br />

Divisions échelle verticale (# <strong>de</strong> bits)<br />

Résolution<br />

Ex.: 16 bits 65536 divisions<br />

x 44.100 ≈ 1,4 Mbits/s<br />

échant./s<br />

Capacité CD-ROM :<br />

650 Moctets <br />

65 min. <strong>de</strong> musique<br />

D. Bertrand 24

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

Saved successfully!

Ooh no, something went wrong!