21.06.2013 Views

Rappresentazione binaria di numeri interi con segno

Rappresentazione binaria di numeri interi con segno

Rappresentazione binaria di numeri interi con segno

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>Rappresentazione</strong> <strong>binaria</strong> <strong>di</strong> <strong>numeri</strong> <strong>interi</strong> <strong>con</strong> <strong>segno</strong><br />

Esercizio 1<br />

Complemento a 1, Complemento a 2, Modulo e Segno<br />

Convertire i <strong>numeri</strong> decimali (6, -6) in Binario Puro, Modulo e Segno, Complemento a 1,<br />

Complemento a 2, su 4 bit.<br />

Esercizio 2<br />

Binario puro: è il proce<strong>di</strong>mento già visto negli esercizi precedenti.<br />

6 (decimale) --> 110 (binario)<br />

-6 (decimale) --> -110 (binario)<br />

Modulo e <strong>segno</strong>: la co<strong>di</strong>fica è identica al binario, <strong>con</strong> la <strong>di</strong>fferenza che il primo bit in<strong>di</strong>ca<br />

il <strong>segno</strong>.<br />

6 (decimale) --> 0110 (modulo e <strong>segno</strong>)<br />

-6 (decimale) --> 1110 (modulo e <strong>segno</strong>)<br />

Complemento a 1: la co<strong>di</strong>fica è identica al modulo e <strong>segno</strong>, <strong>con</strong> la <strong>di</strong>fferenza che i <strong>numeri</strong><br />

negativi vengono complementati a 1.<br />

6 (decimale) --> 0110 (modulo e <strong>segno</strong>)<br />

-6 (decimale) --> 1110 (modulo e <strong>segno</strong>) --> 1001 (complemento a<br />

1)<br />

Complemento a 2: la co<strong>di</strong>fica è identica al Complemento a 1, <strong>con</strong> la <strong>di</strong>fferenza che ai<br />

<strong>numeri</strong> negativi viene ancora sommata una unità.<br />

6 (decimale) --> 0110 (modulo e <strong>segno</strong>)<br />

-6 (decimale) --> 1001 (complemento a 1) --> 1010 (complemento a<br />

2)<br />

Scrivere i seguenti <strong>numeri</strong> decimali nelle varie co<strong>di</strong>fiche in Binario Puro, Modulo e Segno,<br />

Complemento a 1, Complemento a 2, tutte su 7 bit.<br />

Decimale Binario Modulo e Segno Complemento a 1 Complemento a 2<br />

15 1111 0001111 0001111 00001111<br />

-15 -1111 1001111 1110000 1110001<br />

-19 -10011 1010011 1101100 1101101


-27 -11011 1011011 1100100 1100101<br />

-63 -111111 1111111 1000000 1000001<br />

-64 -1000000 NON RAPPRES. NON RAPPRES. 1000000<br />

+63 111111 0111111 0111111 0111111<br />

+64 1000000 NON RAPPRES. NON RAPPRES. NON RAPPRES.<br />

+127 1111111 NON RAPPRES. NON RAPPRES. NON RAPPRES.<br />

-45 -101101 1101101 1010010 1010011<br />

Esercizio 3<br />

Scrivere i seguenti <strong>numeri</strong> decimali nelle varie co<strong>di</strong>fiche in Binario Puro, Modulo e Segno,<br />

Complemento a 1, Complemento a 2, tutte su 8 bit.<br />

Decimale Binario Modulo e Segno Complemento a 1 Complemento a 2<br />

-10 -1010 10001010 11110101 11110110<br />

+25 11001 00011001 00011001 00011001<br />

-59 -111011 10111011 11000100 11000101<br />

-47 -101111 10101111 11010000 11010001<br />

-35 -100011 10100011 11011100 11011101<br />

+31 11111 00011111 00011111 00011111<br />

-37 -100101 10100101 11011010 11011011<br />

-62 -111110 10111110 11000001 11000010<br />

Esercizio 4<br />

Convertire in Modulo e Segno e in Complemento a Due i seguenti <strong>numeri</strong> <strong>interi</strong> <strong>con</strong> <strong>segno</strong>: -32, -<br />

31, +15, +16, -46, -18, -4, +31, in<strong>di</strong>cando, per ognuno, il numero <strong>di</strong> bit necessari per<br />

rappresentarlo.


Esercizio 5<br />

Un numero intero <strong>con</strong> <strong>segno</strong>, X , è rappresentato in binario su N bit. In<strong>di</strong>care il possibile<br />

intervallo <strong>di</strong> variazione <strong>di</strong> X dapprima nel caso <strong>di</strong> rappresentazione in Modulo e Segno e poi per<br />

la rappresentazione in Complemento a Due.<br />

Esercizio 6<br />

Per ognuna delle seguenti coppie <strong>di</strong> <strong>numeri</strong>, <strong>di</strong> cui il primo è espresso in Complemento a Due ed<br />

il se<strong>con</strong>do in Modulo e Segno, in<strong>di</strong>carne il maggiore senza ricorrere alla <strong>con</strong>versione nel sistema<br />

decimale.<br />

Complemento a<br />

due<br />

Modulo e <strong>segno</strong> Risultato<br />

111010 111010 ><br />

000000 100000 =<br />

111111 100000

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

Saved successfully!

Ooh no, something went wrong!