La codifica binaria della informazione: differenze tra le versioni

Da Bioingegneria Elettronica e Informatica.
Riga 1: Riga 1:
'''Sommario.'''Il presente paragrafo si riferisce alle prime due lezioni del corso di Fondamenti di Informatica e Laboratorio di Informatica.   </span><span style='font-size:
+
'''La codifica binaria della informazione''''''''' Vitoantonio Bevilacqua    bevilacqua@poliba.it''' ''''''Sommario.''' Il  
10.0pt;line-height:104%;font-family:"Arial","sans-serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:93.6pt;margin-bottom:
+
presente paragrafo si riferisce alle prime due lezioni del corso di Fondamenti  
35.9pt;margin-left:35.8pt;text-indent:-1.0pt;line-height:104%'>'''<span
+
di Informatica e Laboratorio di Informatica.    '''Parole  
style='font-size:9.0pt;line-height:104%;font-family:"Arial","sans-serif"'>Parole  
+
chiave: '''Codifica Binaria, Memoria RAM, Complemento a 2, IEEE  
chiave: </span>'''<span style='font-size:9.0pt;line-height:104%;font-family:
+
754   a singola e doppia precisione.  1   Introduzione  Il fine principale degli argomenti trattati  
"Arial","sans-serif"'>Codifica Binaria, Memoria RAM, Complemento a 2, IEEE  
+
754   a singola e doppia precisione. </span><span style='font-size:10.0pt;
+
line-height:104%;font-family:"Arial","sans-serif"'> </span><h1>1   Introduzione  </h1><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:28.7pt;
+
margin-left:8.3pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Il fine principale degli argomenti trattati  
+
 
in queste iniziali lezioni consiste nell'illustrare in quale maniera  
 
in queste iniziali lezioni consiste nell'illustrare in quale maniera  
 
l'informazione, per adesso soltanto numerica, viene memorizzata nella memoria  
 
l'informazione, per adesso soltanto numerica, viene memorizzata nella memoria  
Riga 19: Riga 13:
 
reali in singola e doppia precisione secondo lo standard IEEE 754, gli effetti  
 
reali in singola e doppia precisione secondo lo standard IEEE 754, gli effetti  
 
sulla dichiarazione delle variabili signed e unsigned di tipo char ed int, e  
 
sulla dichiarazione delle variabili signed e unsigned di tipo char ed int, e  
delle variabili float e double in linguaggio C.  </span><h1>2   La memoria di lavoro  </h1><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
delle variabili float e double in linguaggio C.  2   La memoria di lavoro  La memoria RAM (Random Access Memory) è la  
margin-left:7.85pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>La memoria RAM (Random Access Memory) è la  
+
 
memoria di lavoro (elaborazione) di un sistema di calcolo; per semplicità essa  
 
memoria di lavoro (elaborazione) di un sistema di calcolo; per semplicità essa  
 
può essere rappresentata come una tabella organizzata in righe, ciascuna delle  
 
può essere rappresentata come una tabella organizzata in righe, ciascuna delle  
 
quali (per ora chiamata word) viene suddivisa in 4 colonne o blocchi, da ora in  
 
quali (per ora chiamata word) viene suddivisa in 4 colonne o blocchi, da ora in  
 
poi chiamati byte, costituiti da una sequenza di 8 bit (binary digit) ovvero 8  
 
poi chiamati byte, costituiti da una sequenza di 8 bit (binary digit) ovvero 8  
cifre che possono assumere soltanto valori 0 o 1.   </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:1.8pt;
+
cifre che possono assumere soltanto valori 0 o 1.   In generale, ogni programma di elaborazione  
margin-left:7.85pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>In generale, ogni programma di elaborazione  
+
 
si occupa della gestione delle informazioni per unità elementari corrispondenti  
 
si occupa della gestione delle informazioni per unità elementari corrispondenti  
 
alla dimensione dei byte, senza necessariamente scendere al livello di dettaglio  
 
alla dimensione dei byte, senza necessariamente scendere al livello di dettaglio  
Riga 38: Riga 26:
 
iniziando sempre dal numero progressi 0, è da destra verso a sinistra (“little  
 
iniziando sempre dal numero progressi 0, è da destra verso a sinistra (“little  
 
Endian”), laddove il verso dall’alto verso il basso è ovviamente relativo a  
 
Endian”), laddove il verso dall’alto verso il basso è ovviamente relativo a  
come più avanti si dirà essere partizionata la intera memoria RAM.  </span><h1 style='margin-left:.45pt'>3   Le regole per le trasformazioni di base  </h1><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
come più avanti si dirà essere partizionata la intera memoria RAM.  3   Le regole per le trasformazioni di base  Dato un numero, le basi del sistema di  
margin-left:7.85pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Dato un numero, le basi del sistema di  
+
 
numerazione che si usano per leggere tale numero sono la base 2 (binaria), 8  
 
numerazione che si usano per leggere tale numero sono la base 2 (binaria), 8  
 
(ottale), 16 (esadecimale); assegnata una base del sistema di numerazione, le  
 
(ottale), 16 (esadecimale); assegnata una base del sistema di numerazione, le  
 
cifre sono date da 0 fino a numero base – 1. Dopo la cifra 9, si aggiungono A,  
 
cifre sono date da 0 fino a numero base – 1. Dopo la cifra 9, si aggiungono A,  
B, C, D, E, F per formare la base di un sistema esadecimale.  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.1pt;
+
B, C, D, E, F per formare la base di un sistema esadecimale.    Assegnato un numero codificato in base 2, si  
margin-left:7.8pt'><span style='font-size:10.0pt;line-height:107%;font-family:
+
"Arial","sans-serif"'>  </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:1.4pt;
+
margin-left:8.3pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Assegnato un numero codificato in base 2, si  
+
 
decodifica facilmente in base 10; esempio della codifica chiamata “in binario  
 
decodifica facilmente in base 10; esempio della codifica chiamata “in binario  
puro”:  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
puro”:   (1010.101)2 = (1 x 23+  
margin-left:7.8pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
0 x 22+1 x 21+ 0 x 20 + 1 x·2-1+  
line-height:107%;font-family:"Arial","sans-serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:5.7pt;
+
0 x 2-2 + 1 x·2-3)10=(10.625)10  Codifica binaria di un numero:  
margin-left:7.85pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>(1010.101)<sub>2 </sub>= (1 x 2<sup>3</sup>+  
+
0 x 2<sup>2</sup>+1 x 2<sup>1</sup>+ 0 x 2<sup>0 </sup>+ 1 x·2<sup>-1</sup>+  
+
0 x 2<sup>-2 </sup>+ 1 x·2<sup>-3</sup>)<sub>10</sub>=(10.625)<sub>10</sub></span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:3.95pt;
+
margin-left:7.8pt'><span style='font-size:6.0pt;line-height:107%;font-family:
+
"Arial","sans-serif"'> </span><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:8.3pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><u><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Codifica binaria di un numero</span></u><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>:  
+
 
per l’operazione inversa, si utilizzano due algoritmi rispettivamente per la  
 
per l’operazione inversa, si utilizzano due algoritmi rispettivamente per la  
parte intera e decimale del numero:  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
parte intera e decimale del numero:    3.1   Algoritmo di Horner - divisioni successive  Si prende il numero intero, si mette in  
margin-left:1.45pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Times New Roman","serif"'>  </span><h2 style='margin-left:.45pt'>3.1   Algoritmo di Horner - divisioni successive <span
+
style='font-weight:normal'> </span></h2><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Si prende il numero intero, si mette in  
+
 
colonna a sinistra, lo si divide per 2, riportando quoziente sotto il dividendo  
 
colonna a sinistra, lo si divide per 2, riportando quoziente sotto il dividendo  
 
mentre il resto accanto al dividendo, e così via fino a raggiungere il  
 
mentre il resto accanto al dividendo, e così via fino a raggiungere il  
 
quoziente 0. La parte intera del numero in binario è la sequenza dei resti,  
 
quoziente 0. La parte intera del numero in binario è la sequenza dei resti,  
presa dal basso verso l’alto. </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
presa dal basso verso l’alto.  3.2   Algoritmo di Horner - moltiplicazioni  
margin-left:18.75pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
successive  Si prende il numero decimale, si mette in  
line-height:107%;font-family:"Times New Roman","serif"'> </span><h2 style='margin-left:.45pt'>3.2   Algoritmo di Horner - moltiplicazioni  
+
colonna a sinistra, lo si moltiplica per 2, riportando:  1.      
successive <span style='font-weight:normal'> </span></h2><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
Se  
margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Si prende il numero decimale, si mette in  
+
colonna a sinistra, lo si moltiplica per 2, riportando:  </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:58.1pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>1.<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>Se  
+
 
il prodotto è ≥1, accanto al primo fattore 1 e sotto il complemento del  
 
il prodotto è ≥1, accanto al primo fattore 1 e sotto il complemento del  
prodotto </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
prodotto 2.      
margin-left:58.1pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
Se  
-18.0pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
il prodotto è
font-family:"Arial","sans-serif"'>2.<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>Se  
+
il prodotto è <1, accanto al primo fattore lo 0 e sotto il prodotto  </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Cosi via, fino a raggiungere il prodotto 0.
+
La sequenza da prendere come parte decimale del numero in binario è la sequenza
+
di destra presa dall’alto verso il basso. </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.15pt;
+
margin-left:.7pt'><span style='font-size:10.0pt;line-height:107%;font-family:
+
"Arial","sans-serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:1.5pt;
+
margin-left:.7pt'><span style='font-size:10.0pt;line-height:107%;font-family:
+
"Arial","sans-serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:74.95pt;margin-bottom:
+
.25pt;margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;
+
text-indent:-.5pt;line-height:107%'><img width=104 height=394
+
src="1%20Prima%20Dispensa%20-La%20codifica%20binaria%20dell%20informazione_revisione2015_file/image001.gif"
+
align=left hspace=12><span style='font-size:10.0pt;line-height:107%;font-family:
+
"Arial","sans-serif"'>Mentre nell’algoritmo delle divisioni lo 0 si raggiunge
+
sempre, nell’algoritmo delle moltiplicazioni non è sempre possibile
+
raggiungerlo e ciò dipende dal concetto di periodo della base; il periodo si
+
ripete dal momento in cui si trova un numero già trovato in precedenza. </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:.7pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Arial","sans-serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:.7pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Arial","sans-serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:.7pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Arial","sans-serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:.7pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Arial","sans-serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Esempio:  </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Codifica in binario e ricodifica in decimale
+
del numero 127.4   </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:1.85pt;
+
margin-left:99.3pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>(127.4)<sub>10 </sub>= (1111111.0110)<sub>2 </sub>=
+
(127.375)<sub>10 </sub> </span><p class=MsoNormal style='margin-top:0cm;margin-right:124.9pt;margin-bottom:
+
.25pt;margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;
+
text-indent:-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:
+
107%;font-family:"Arial","sans-serif"'>Nel momento in cui si accetta un
+
periodo, si commette un “errore di codifica”.  Si definisce: </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:0cm;
+
margin-left:37.45pt;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;
+
text-indent:-18.0pt;line-height:112%'><span style='font-size:10.0pt;line-height:
+
112%;font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:112%;font-family:"Arial","sans-serif"'>Errore
+
assoluto </span><span style='font-size:10.0pt;line-height:112%;font-family:
+
"Cambria Math","serif"'>𝑒<sub>𝑎</sub></span><span
+
style='font-size:10.0pt;line-height:112%;font-family:"Arial","sans-serif"'>lo
+
scarto tra il numero iniziale da codificare e il numero ottenuto dopo la
+
ricodifica nella stessa base di partenza. Esempio: </span><span
+
style='font-size:10.0pt;line-height:112%;font-family:"Cambria Math","serif"'>𝑒<sub>𝑎</sub></span><span
+
style='font-size:10.0pt;line-height:112%;font-family:"Arial","sans-serif"'>=
+
127.4 – 127.375 = 0.025 </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:37.45pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>Errore
+
relativo</span><img width=50 height=20 id="Picture 10409"
+
src="1%20Prima%20Dispensa%20-La%20codifica%20binaria%20dell%20informazione_revisione2015_file/image002.gif"><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>dove
+
''num ''è il numero iniziale rispetto al quale si è commesso l’errore di
+
codifica </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:37.95pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Esempio: </span><img width=53 height=21
+
id="Picture 10410"
+
src="1%20Prima%20Dispensa%20-La%20codifica%20binaria%20dell%20informazione_revisione2015_file/image003.gif"><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:37.45pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>Errore
+
relativo percentuale </span><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Cambria Math","serif"'>𝑒<sub>𝑟% </sub>= 𝑒<sub>𝑟
+
</sub>∗ 100</span><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'></span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Concetto di ''range ''(intervallo di
+
rappresentazione di un numero): preso un byte, supponendo che, avendo a
+
disposizione ''n ''bit, tutti gli ''n ''codificano numeri interi in base
+
binaria, il ''range ''di rappresentazione varia tra </span><p class=MsoNormal align=center style='margin-top:0cm;margin-right:0cm;
+
margin-bottom:1.15pt;margin-left:2.55pt;text-align:center'><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Cambria Math","serif"'>[0,
+
2<sup>𝑛 </sup>− 1]</span><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Arial","sans-serif"'>. </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>La formula deriva dal numero di combinazioni
+
diverse che si possono ottenere </span><p class=MsoNormal style='margin-top:0cm;margin-right:176.75pt;margin-bottom:
+
1.9pt;margin-left:1.15pt;text-align:justify;text-justify:inter-ideograph;
+
text-indent:221.1pt;line-height:107%'><span style='font-size:10.0pt;line-height:
+
107%;font-family:"Cambria Math","serif"'>2<sup>𝑛 </sup>= 256</span><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>
+
Tenendo conto che si inizia la numerazione da 0. </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Essendo 8 i bit: [0, 255] </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.25pt;
+
margin-left:.7pt'><span style='font-size:10.0pt;line-height:107%;font-family:
+
"Arial","sans-serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:18.5pt;margin-bottom:
+
.25pt;margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;
+
text-indent:-.5pt;line-height:107%'><u><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Arial","sans-serif"'>Codifica esadecimale di un
+
numero</span></u><span style='font-size:10.0pt;line-height:107%;font-family:
+
"Arial","sans-serif"'>: è necessaria per minimizzare il codice; per eseguirla
+
si possono utilizzare due metodi:  </span><p class=MsoNormal style='margin-top:0cm;margin-right:58.85pt;margin-bottom:
+
.25pt;margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;
+
text-indent:-18.0pt;line-height:107%'><span style='font-size:10.0pt;line-height:
+
107%;font-family:"Arial","sans-serif"'>1.<span style='font:7.0pt "Times New Roman"'>    
+
</span></span><span style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>Gli
+
algoritmi da usare sono sempre gli algoritmi di Horner, con le opportune
+
modifiche (in colonna si moltiplica e divide per 16). Infatti i due algoritmi
+
sono generici, nel senso che, non dipendono dalla base in cui è rappresentato
+
un numero. </span><p class=MsoNormal style='margin-top:0cm;margin-right:58.85pt;margin-bottom:
+
.25pt;margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;
+
text-indent:-18.0pt;line-height:107%'><span style='font-size:10.0pt;line-height:
+
107%;font-family:"Arial","sans-serif"'>2.<span style='font:7.0pt "Times New Roman"'>    
+
</span></span><span style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>Si
+
codifica in binario il numero, quindi, essendo </span><span style='font-size:
+
10.0pt;line-height:107%;font-family:"Cambria Math","serif"'>2<sup>4 </sup>= 16 </span><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>si
+
raccolgono le cifre a 4 a 4, a partire dalla virgola e si decodifica da base
+
binaria a base decimale ciascuno dei blocchi Esempio: </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Codifica in esadecimale di 65.25: (65.25)<sub>10
+
</sub>= (1000001.01)<sub>2</sub>;  </span><p class=MsoNormal style='margin-bottom:.25pt;line-height:107%'><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>0100
+
    0001     .0100 </span><p class=MsoNormal style='margin-bottom:.25pt;line-height:107%'><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>4           1
+
         .4 </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Dunque (65.25)<sub>10 </sub>= (41.4)<sub>16  </sub></span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:2.1pt;
+
margin-left:.7pt'><span style='font-size:10.0pt;line-height:107%;font-family:
+
"Times New Roman","serif"'> </span><h2 style='margin-left:.45pt'>3.3 Rappresentazione con modulo e segno (“signed
+
magnitude” o M&S)  </h2><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:3.55pt;
+
margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Per rappresentare un numero con segno, si
+
usa, per convenzione:  </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>Un
+
bit per il segno: 0 per + (più), 1 per – (meno) </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:.25pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>N-1
+
bit per il modulo  </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:2.75pt;
+
margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Il bit che codifica il segno è definito MSB
+
(Most Significant Bit, il primo bit, il più significativo). </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:5.15pt;
+
margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>Esempio: n = 8, range [-127,+127] </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.15pt;
+
margin-left:.95pt;text-indent:-.5pt'><span style='font-size:10.0pt;line-height:
+
107%;font-family:"Cambria Math","serif"'>(−11)<sub>10 </sub>= (0011011)<sub>2</sub></span><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>  </span><p class=MsoNormal align=center style='margin-top:0cm;margin-right:0cm;
+
margin-bottom:0cm;margin-left:3.35pt;margin-bottom:.0001pt;text-align:center'><img
+
width=189 height=35 id="Picture 721"
+
src="1%20Prima%20Dispensa%20-La%20codifica%20binaria%20dell%20informazione_revisione2015_file/image004.jpg"><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:77.0pt;margin-bottom:
+
.25pt;margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;
+
text-indent:-.5pt;line-height:107%'><span style='font-size:10.0pt;line-height:
+
107%;font-family:"Arial","sans-serif"'>In questo caso le combinazioni si
+
riducono a 255 causa la doppia rappresentazione dello 0: 10000000 = 00000000 =
+
0 e il range è: [-(2<sup>n-1</sup>-1),2<sup>n-1</sup>-1] = [-127,127].  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:1.7pt;
+
margin-left:.7pt'><span style='font-size:10.0pt;line-height:107%;font-family:
+
"Times New Roman","serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:78.65pt;margin-bottom:
+
.25pt;margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;
+
text-indent:-.5pt;line-height:142%'>'''<span style='font-size:10.0pt;
+
line-height:142%;font-family:"Times New Roman","serif"'>3.4 L’operazione di
+
complemento a uno. (CA1)  </span>'''<span style='font-size:10.0pt;line-height:
+
142%;font-family:"Arial","sans-serif"'>E’ un’operazione molto semplice per un
+
sistema di calcolo ed è alla base dell’operazione di complemento a due grazie
+
alla quale è possibile rappresentare numeri interi negativi e positivi. </span><p class=MsoNormal style='margin-top:0cm;margin-right:78.85pt;margin-bottom:
+
.1pt;margin-left:0cm;line-height:101%'><span style='font-size:10.0pt;
+
line-height:101%;font-family:"Arial","sans-serif";color:#252525'>Per trovare la
+
rappresentazione in complemento a uno si invertono semplicemente tutti i bit
+
della parola. </span><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt'><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Times New Roman","serif"'> 
+
</span><h2 style='margin-left:.45pt'>3.5 La codifica in complemento a due per i numeri
+
con segno (CA2)  </h2><p class=MsoNormal style='margin-top:0cm;margin-right:78.5pt;margin-bottom:
+
.5pt;margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;
+
text-indent:-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:
+
104%;font-family:"Arial","sans-serif"'>Il complemento a due è il metodo più
+
diffuso per la rappresentazione dei numeri con segno. </span><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>Il
+
valore da utilizzare relativamente al MSB risulta essere il suo opposto (questo
+
implica che se vale 0 porta a una decodifica di valore uguale alla
+
rappresentazione in binario puro):  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:1.45pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Times New Roman","serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>00000000=0  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:1.95pt;
+
margin-left:36.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>00000001=1  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>…  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:4.1pt;
+
margin-left:36.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>01111111=+127  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>10000000=-1</span><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Segoe UI Symbol","sans-serif"'>⋅</span><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>2<sup>7</sup>=-128 
+
</span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:1.9pt;
+
margin-left:36.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>10000001=-128+1=-127  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>…  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>11111111=-1  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:1.45pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Times New Roman","serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:1.0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Le combinazioni sono 256 per la
+
rappresentazione univoca dello 0: ovvero soltanto 00000000 = 0; in questo caso
+
il range varia tra [-(2<sup>n-1</sup>),2<sup>n-1</sup>-1] = [-128,127].  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:12.15pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Times New Roman","serif"'>  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:2.55pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Per codificare un numero in complemento
+
a due:  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:18.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>1.<span style='font:7.0pt "Times New Roman"'>                 
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>Si
+
sceglie il range per il quale è possibile codificare il numero e di conseguenza
+
i bit necessari </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:18.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>2.<span style='font:7.0pt "Times New Roman"'>                 
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>Si
+
rappresenta il valore assoluto del numero in binario </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:18.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>3.<span style='font:7.0pt "Times New Roman"'>                 
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>Si
+
applica l’operazione di complemento a 1 e si somma 1 </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:2.15pt;
+
margin-left:18.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>4.<span style='font:7.0pt "Times New Roman"'>                 
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>La
+
sequenza ottenuta è la codifica del numero iniziale in complemento a due
+
Esempio: </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:2.3pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Si vuole codifica in complemento a 2 il
+
numero -65 </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:3.65pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Il range varia tra [-128,127] </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:2.35pt;
+
margin-left:.95pt;text-indent:-.5pt'><span style='font-size:10.0pt;line-height:
+
107%;font-family:"Cambria Math","serif"'>2<sup>8</sup> 𝑐𝑜𝑚𝑏𝑖𝑛𝑎𝑧𝑖𝑜𝑛𝑖</span><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Times New Roman","serif"'></span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:4.05pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>8 bit necessari </span><p class=MsoNormal style='margin-top:0cm;margin-right:270.0pt;margin-bottom:
+
.5pt;margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;
+
text-indent:-.5pt;line-height:133%'><span style='font-size:10.0pt;line-height:
+
133%;font-family:"Times New Roman","serif"'>Il valore assoluto è: </span><span
+
style='font-size:10.0pt;line-height:133%;font-family:"Cambria Math","serif"'>(65)<sub>10
+
</sub>= (01000001)<sub>2</sub></span><span style='font-size:10.0pt;line-height:
+
133%;font-family:"Times New Roman","serif"'> Faccio il complemento a 1:
+
10111110 </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:2.3pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Il complemento a 2 è: 10111110 + 1 =
+
10111111 </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:.7pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Times New Roman","serif"'> </span><h1 style='margin-left:.45pt'>4   Lo standard IEEE 754  </h1><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:.7pt;margin-bottom:.0001pt'><u><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Times New Roman","serif"'>Standard IEEE 754
+
single precision</span></u><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Times New Roman","serif"'>:  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Rappresentazione di un numero reale in
+
32 bit. </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>I 32 bit vengono suddivisi in 3 gruppi: </span><p class=MsoNormal style='margin-bottom:.5pt;line-height:104%'><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>±
+
             esponente             mantissa </span><p class=MsoNormal style='margin-bottom:.5pt;line-height:104%'><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>1
+
             8                             23 </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:.7pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Times New Roman","serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Il modulo del numero viene codificato in
+
base binaria usando gli algoritmi di divisione e moltiplicazione successive
+
evidenziando, nella parte decimale, un periodo ove ci fosse. </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>La rappresentazione binaria risultante è
+
detta “fixed point” (a virgola fissa). </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Si passa alla rappresentazione “floating
+
point” (a virgola mobile) per determinare mantissa ed esponente.  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Si sposta la virgola fino alla sinistra
+
dell’ultima cifra diversa da zero, cambiando anche l’esponente per
+
riequilibrare l’ordine di grandezza. </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>La parte dopo la virgola indica la
+
mantissa matematica. </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Se si sposta la virgola alla destra
+
dell’ultima cifra diversa da zero, cambiando anche l’esponente: </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>La
+
parte del numero dopo la virgola indica la mantissa normalizzata che, se
+
composta da un numero di cifre < 23, ai restanti bit si assegna valore 0 </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>Per
+
codificare l’esponente, si usa la rappresentazione per eccesso: si somma
+
l’esponente al ''bias ''(</span><span style='font-size:10.0pt;line-height:
+
104%;font-family:"Cambria Math","serif"'>2<sup>𝑛−1 </sup>−</span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.15pt;
+
margin-left:37.25pt;text-indent:-.5pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Cambria Math","serif"'>1, 𝑑𝑜𝑣𝑒
+
𝑛 è 𝑖𝑙 𝑛𝑢𝑚𝑒𝑟𝑜
+
𝑑𝑖 𝑏𝑖𝑡 𝑟𝑖𝑠𝑒𝑟𝑣𝑎𝑡𝑖
+
𝑎𝑙𝑙′𝑒𝑠𝑝𝑜𝑛𝑒𝑛𝑡𝑒</span><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Times New Roman","serif"'>)
+
e quindi si codifica il numero </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Esempio: </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:2.3pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Si vuole codificare secondo lo standard
+
IEEE754 a single precision, il numero -118.625 </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>Codifico
+
la parte intera: </span><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Cambria Math","serif"'>(118)<sub>10 </sub>= (1110110)<sub>2</sub></span><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'></span><span style='font-size:10.0pt;line-height:104%;font-family:"Segoe UI Symbol","sans-serif"'></span><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Arial","sans-serif"'>     </span><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>Codifico
+
la parte decimale: </span><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Cambria Math","serif"'>(0.625)<sub>10 </sub>= (.101)<sub>2</sub></span><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'></span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>La
+
rappresentazione in fixed point è: 1110110.101 </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>Sposto
+
la virgola fino alla sinistra dell’ultima cifra diversa da 0 e riequilibrio l’ordine
+
di grandezza: </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:1.8pt;
+
margin-left:37.25pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>0.1110110101*</span><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Cambria Math","serif"'>2<sup>7</sup></span><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'></span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>La
+
mantissa matematica è: 1110110101 </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>Sposto
+
la virgola fino alla destra dell’ultima cifra diversa da zero e riequilibrio
+
l’ordine di grandezza: </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:1.95pt;
+
margin-left:37.25pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>1.110110101*</span><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Cambria Math","serif"'>2<sup>6</sup></span><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'></span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>La
+
mantissa normalizzata è: 110110101 </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.15pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt'><span style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>•<span
+
style='font:7.0pt "Times New Roman"'>       </span></span><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Times New Roman","serif"'>Codifico
+
l’esponente: </span><span style='font-size:10.0pt;line-height:107%;font-family:
+
"Cambria Math","serif"'>6 + 2<sup>7 </sup>− 1 = 6 + 127 = 5 + 128 =
+
10000101</span><span style='font-size:10.0pt;line-height:107%;font-family:"Times New Roman","serif"'></span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>La
+
         rappresentazione                secondo                lo            standard
+
              IEEE754               a             single      precision                è: 
+
</span><p class=MsoNormal style='margin-bottom:.5pt;line-height:104%'>                <span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>1
+
            1000101              11011010100000000000000 </span><p class=MsoNormal style='margin-bottom:.5pt;line-height:104%'>                <span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>±
+
            esponente             mantissa </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:.7pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Times New Roman","serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>L’ordine di precisione delo standard
+
IEEE754 è dato dal numero di cifre della mantissa. </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Per ottenere una rappresentazione più
+
precisa si usa lo standard IEEE754 a double precision (64 bit) </span><p class=MsoNormal style='margin-bottom:.5pt;line-height:104%'><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>±
+
             esponente             mantissa </span><p class=MsoNormal style='margin-bottom:.5pt;line-height:104%'><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>1
+
             11                           52 </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:.7pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Times New Roman","serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Il metodo di rappresentazione è simile a
+
quello usato per lo standard a single precision, l’unica cosa che varia è il ''bias:
+
''</span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:13.3pt;
+
margin-left:.95pt;text-indent:-.5pt'><span style='font-size:10.0pt;line-height:
+
107%;font-family:"Cambria Math","serif"'>2<sup>11−1 </sup>− 1 =
+
1023</span><span style='font-size:10.0pt;line-height:107%;font-family:"Times New Roman","serif"'></span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:14.15pt;
+
margin-left:1.65pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:147%'><span style='font-size:10.0pt;line-height:147%;
+
font-family:"Arial","sans-serif"'>I valori assunti dall'esponente e dalla</span><a
+
href="https://it.wikipedia.org/wiki/Mantissa"><span style='font-size:10.0pt;
+
line-height:147%;font-family:"Arial","sans-serif";color:black;text-decoration:
+
none'></span></a><a href="https://it.wikipedia.org/wiki/Mantissa"><span
+
style='font-size:10.0pt;line-height:147%;font-family:"Arial","sans-serif";
+
color:black;text-decoration:none'>mantissa</span></a><a
+
href="https://it.wikipedia.org/wiki/Mantissa"><span style='font-size:10.0pt;
+
line-height:147%;font-family:"Arial","sans-serif";color:black;text-decoration:
+
none'></span></a><span style='font-size:10.0pt;line-height:147%;font-family:
+
"Arial","sans-serif"'>determinano l'appartenenza del numero ad una di queste
+
categorie: </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:4.2pt;
+
margin-left:19.15pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>Zeri;
+
</span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:4.2pt;
+
margin-left:19.15pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>Numeri
+
in forma normale; </span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:4.35pt;
+
margin-left:19.15pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>Numeri
+
in forma</span><a href="https://it.wikipedia.org/wiki/Numeri_denormalizzati"><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif";
+
color:black;text-decoration:none'></span></a><a
+
href="https://it.wikipedia.org/wiki/Numeri_denormalizzati"><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif";
+
color:black;text-decoration:none'>denormalizzata</span></a><a
+
href="https://it.wikipedia.org/wiki/Numeri_denormalizzati"><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif";
+
color:black;text-decoration:none'>;</span></a><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Arial","sans-serif"'></span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:4.1pt;
+
margin-left:19.15pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:107%'><span style='font-size:10.0pt;line-height:107%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>Infiniti;
+
</span><p class=MsoNormal style='margin-top:0cm;margin-right:4.8pt;margin-bottom:16.85pt;
+
margin-left:19.15pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt'><span style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>•<span
+
style='font:7.0pt "Times New Roman"'>       </span></span><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Arial","sans-serif"'>NaN
+
(''not a number''). </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:.7pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Arial","sans-serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:10.45pt;
+
margin-left:.7pt'><span style='font-size:10.0pt;line-height:107%;font-family:
+
"Arial","sans-serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:.7pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Arial","sans-serif"'> </span>
+
{| class=TableGrid border=0 cellspacing=0 cellpadding=0 width=428  style='width:321.1pt;margin-left:81.25pt;border-collapse:collapse'
+
|- style='height:45.45pt'<td width=240 style='width:179.7pt;border:solid #AAAAAA 1.0pt;background:
+
#F2F2F2;padding:0cm 5.75pt 13.85pt 4.8pt;height:45.45pt'><p class=MsoNormal align=center style='margin-top:0cm;margin-right:0cm;
+
margin-bottom:0cm;margin-left:.8pt;margin-bottom:.0001pt;text-align:center;
+
line-height:normal'>'''<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Categoria
+
</span>'''<td width=73 style='width:54.4pt;border:solid #AAAAAA 1.0pt;border-left:none;
+
background:#F2F2F2;padding:0cm 5.75pt 13.85pt 4.8pt;height:45.45pt'><p class=MsoNormal align=center style='margin-top:0cm;margin-right:0cm;
+
margin-bottom:0cm;margin-left:.75pt;margin-bottom:.0001pt;text-align:center;
+
line-height:normal'>'''<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Esp.
+
</span>'''<td width=116 style='width:87.05pt;border:solid #AAAAAA 1.0pt;border-left:
+
none;background:#F2F2F2;padding:0cm 5.75pt 13.85pt 4.8pt;height:45.45pt'><p class=MsoNormal align=center style='margin-top:0cm;margin-right:0cm;
+
margin-bottom:0cm;margin-left:.8pt;margin-bottom:.0001pt;text-align:center;
+
line-height:normal'>'''<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Mantissa
+
</span>'''
+
|- style='height:46.3pt'<td width=240 valign=bottom style='width:179.7pt;border:solid #AAAAAA 1.0pt;
+
border-top:none;background:#F2F2F2;padding:0cm 5.75pt 13.85pt 4.8pt;
+
height:46.3pt'><p class=MsoNormal align=center style='margin-top:0cm;margin-right:0cm;
+
margin-bottom:0cm;margin-left:.65pt;margin-bottom:.0001pt;text-align:center;
+
line-height:normal'>'''<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Zeri
+
</span>'''<td width=73 valign=bottom style='width:54.4pt;border-top:none;border-left:
+
none;border-bottom:solid #AAAAAA 1.0pt;border-right:solid #AAAAAA 1.0pt;
+
background:#F9F9F9;padding:0cm 5.75pt 13.85pt 4.8pt;height:46.3pt'><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
+
normal'><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>0 </span><td width=116 valign=bottom style='width:87.05pt;border-top:none;border-left:
+
none;border-bottom:solid #AAAAAA 1.0pt;border-right:solid #AAAAAA 1.0pt;
+
background:#F9F9F9;padding:0cm 5.75pt 13.85pt 4.8pt;height:46.3pt'><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
+
normal'><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>0 </span>
+
|- style='height:46.3pt'<td width=240 valign=bottom style='width:179.7pt;border:solid #AAAAAA 1.0pt;
+
border-top:none;background:#F2F2F2;padding:0cm 5.75pt 13.85pt 4.8pt;
+
height:46.3pt'><p class=MsoNormal align=center style='margin-top:0cm;margin-right:0cm;
+
margin-bottom:0cm;margin-left:.65pt;margin-bottom:.0001pt;text-align:center;
+
line-height:normal'>'''<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Numeri
+
denormalizzati </span>'''<td width=73 valign=bottom style='width:54.4pt;border-top:none;border-left:
+
none;border-bottom:solid #AAAAAA 1.0pt;border-right:solid #AAAAAA 1.0pt;
+
background:#F9F9F9;padding:0cm 5.75pt 13.85pt 4.8pt;height:46.3pt'><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
+
normal'><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>0 </span><td width=116 valign=bottom style='width:87.05pt;border-top:none;border-left:
+
none;border-bottom:solid #AAAAAA 1.0pt;border-right:solid #AAAAAA 1.0pt;
+
background:#F9F9F9;padding:0cm 5.75pt 13.85pt 4.8pt;height:46.3pt'><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
+
normal'><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>non
+
zero </span>
+
|- style='height:46.35pt'<td width=240 valign=bottom style='width:179.7pt;border:solid #AAAAAA 1.0pt;
+
border-top:none;background:#F2F2F2;padding:0cm 5.75pt 13.85pt 4.8pt;
+
height:46.35pt'><p class=MsoNormal align=center style='margin-top:0cm;margin-right:0cm;
+
margin-bottom:0cm;margin-left:.65pt;margin-bottom:.0001pt;text-align:center;
+
line-height:normal'>'''<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Numeri
+
normalizzati </span>'''<td width=73 valign=bottom style='width:54.4pt;border-top:none;border-left:
+
none;border-bottom:double #F9F9F9 6.75pt;border-right:solid #AAAAAA 1.0pt;
+
background:#F9F9F9;padding:0cm 5.75pt 13.85pt 4.8pt;height:46.35pt'><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
+
normal'><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>1-254
+
</span><td width=116 valign=bottom style='width:87.05pt;border-top:none;border-left:
+
none;border-bottom:double #F9F9F9 6.75pt;border-right:solid #AAAAAA 1.0pt;
+
background:#F9F9F9;padding:0cm 5.75pt 13.85pt 4.8pt;height:46.35pt'><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
+
normal'><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>qualunque
+
</span>
+
|- style='height:46.45pt'<td width=240 valign=bottom style='width:179.7pt;border:solid #AAAAAA 1.0pt;
+
border-top:none;background:#F2F2F2;padding:0cm 5.75pt 13.85pt 4.8pt;
+
height:46.45pt'><p class=MsoNormal align=center style='margin-top:0cm;margin-right:0cm;
+
margin-bottom:0cm;margin-left:.9pt;margin-bottom:.0001pt;text-align:center;
+
line-height:normal'>'''<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Infiniti
+
</span>'''<td width=73 valign=bottom style='width:54.4pt;border-top:none;border-left:
+
none;border-bottom:solid #AAAAAA 1.0pt;border-right:solid #AAAAAA 1.0pt;
+
background:#F9F9F9;padding:0cm 5.75pt 13.85pt 4.8pt;height:46.45pt'><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
+
normal'><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>255 </span><td width=116 valign=bottom style='width:87.05pt;border-top:none;border-left:
+
none;border-bottom:solid #AAAAAA 1.0pt;border-right:solid #AAAAAA 1.0pt;
+
background:#F9F9F9;padding:0cm 5.75pt 13.85pt 4.8pt;height:46.45pt'><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
+
normal'><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>0 </span>
+
|- style='height:45.35pt'<td width=240 valign=bottom style='width:179.7pt;border:solid #AAAAAA 1.0pt;
+
border-top:none;background:#F2F2F2;padding:0cm 5.75pt 13.85pt 4.8pt;
+
height:45.35pt'><p class=MsoNormal align=center style='margin-top:0cm;margin-right:0cm;
+
margin-bottom:0cm;margin-left:.6pt;margin-bottom:.0001pt;text-align:center;
+
line-height:normal'>'''<span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Nan
+
(not a number) </span>'''<td width=73 valign=bottom style='width:54.4pt;border-top:none;border-left:
+
none;border-bottom:solid #AAAAAA 1.0pt;border-right:solid #AAAAAA 1.0pt;
+
background:#F9F9F9;padding:0cm 5.75pt 13.85pt 4.8pt;height:45.35pt'><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
+
normal'><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>255 </span><td width=116 valign=bottom style='width:87.05pt;border-top:none;border-left:
+
none;border-bottom:solid #AAAAAA 1.0pt;border-right:solid #AAAAAA 1.0pt;
+
background:#F9F9F9;padding:0cm 5.75pt 13.85pt 4.8pt;height:45.35pt'><p class=MsoNormal style='margin-bottom:0cm;margin-bottom:.0001pt;line-height:
+
normal'><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>non
+
zero </span>
+
|}<p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:.7pt;margin-bottom:.0001pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Times New Roman","serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:1.8pt;
+
margin-left:.7pt'><span style='font-size:10.0pt;line-height:107%;font-family:
+
"Times New Roman","serif"'> </span><h1 style='margin-left:.45pt'>5   Verso il linguaggio C  </h1><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:1.85pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Per specificare il tipo di variabile
+
(tipo di rappresentazione usata per la codifica della variabile) esistono
+
istruzioni dette </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:4.15pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>“specificatori di tipo”:  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>“char
+
a”: carattere = variabile a memorizzata in 1 byte, codificata secondo C.A.2  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>“int
+
b”: intero = variabile b memorizzata in 2 o 4 byte (4 in VisualC++ 6.0),
+
codificata secondo C.A.2  </span><span style='font-size:10.0pt;line-height:
+
104%;font-family:"Segoe UI Symbol","sans-serif"'></span><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Arial","sans-serif"'>             </span><span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>“float
+
c”: single = variabile c memorizzata in 4 byte, codificata secondo IEEE754
+
single p.  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:36.75pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-18.0pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Arial","sans-serif"'>•<span style='font:7.0pt "Times New Roman"'>      
+
</span></span><span style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>“double
+
d”: double = variabile d memorizzata in 8 byte, codificata secondo IEEE754
+
double p.  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:2.0pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Non indicando niente davanti agli
+
specificatori di tipo, si sottintende “signed”. Per specificare che la
+
variabile è senza segno, si scrive “unsigned” davanti agli specificatori di
+
tipo e la codifica avverrà senza segno.  </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Per dimensionare una variabile, esistono
+
gli specificatori “short” e “long” da scrivere davanti agli specificatori di
+
tipo per, rispettivamente, dimezzare o raddoppiare il numero di byte necessari
+
alla rappresentazione.  </span><p class=MsoNormal style='margin-top:0cm;margin-right:10.2pt;margin-bottom:
+
2.25pt;margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;
+
text-indent:-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:
+
104%;font-family:"Times New Roman","serif"'>Per assegnare ad una variabile a il
+
valore n si utilizza l’assegnazione “ a = n ; ” e, a seconda del tipo
+
specificato di variabile, il calcolatore memorizzerà il valore n nel primo
+
pacchetto libero di byte in modo che il primo byte sia multiplo di 4.  </span><p class=MsoNormal style='margin-top:0cm;margin-right:144.8pt;margin-bottom:
+
.5pt;margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;
+
text-indent:-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:
+
104%;font-family:"Times New Roman","serif"'>L’indirizzo di una variabile “a” è
+
indicato con “&a” ed è quindi multiplo di 4.  N.B. la riga di codice a=a+1;
+
non è un’uguaglianza, ma un’assegnazione! </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.5pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'><span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Il calcolatore all’indirizzo &a
+
sovrascriverà al valore della variabile a, che quindi sarà perso, il valore
+
incrementato di 1. </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:29.35pt;
+
margin-left:1.2pt;text-align:justify;text-justify:inter-ideograph;text-indent:
+
-.5pt;line-height:104%'>'''<span style='font-size:10.0pt;line-height:104%;
+
font-family:"Times New Roman","serif"'>Ringraziamenti.</span>'''<span
+
style='font-size:10.0pt;line-height:104%;font-family:"Times New Roman","serif"'>
+
Il presente capitolo è stato scritto anche grazie al prezioso contributo dello
+
studente Donato Mancuso con la successiva revisione del suo collega Pasquale
+
Bonasia.   </span><h1 style='margin-left:.45pt'>Riferimenti  </h1><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.55pt;
+
margin-left:36.0pt;text-indent:-18.0pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Times New Roman","serif"'>1.<span
+
style='font:7.0pt "Times New Roman"'>       </span></span><span
+
style='font-size:9.0pt;line-height:107%;font-family:"Times New Roman","serif"'>Bevilacqua,
+
V.: Dispense Teoria 1 e IEEE 754 In: http://www.vitoantoniobevilacqua.it  </span><span
+
style='font-size:10.0pt;line-height:107%;font-family:"Times New Roman","serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.9pt;
+
margin-left:36.0pt;text-indent:-18.0pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Times New Roman","serif"'>2.<span
+
style='font:7.0pt "Times New Roman"'>       </span></span><u><span
+
style='font-size:9.0pt;line-height:107%;font-family:"Times New Roman","serif"'>http://it.wikipedia.org/wiki/IEEE_754</span></u><span
+
style='font-size:9.0pt;line-height:107%;font-family:"Times New Roman","serif"'></span><span style='font-size:10.0pt;line-height:107%;font-family:"Times New Roman","serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.9pt;
+
margin-left:36.0pt;text-indent:-18.0pt'><span style='font-size:10.0pt;
+
line-height:107%;font-family:"Times New Roman","serif"'>3.<span
+
style='font:7.0pt "Times New Roman"'>       </span></span><u><span
+
style='font-size:9.0pt;line-height:107%;font-family:"Times New Roman","serif"'>http://it.wikipedia.org/wiki/Ordine_dei_byte</span></u><span
+
style='font-size:9.0pt;line-height:107%;font-family:"Times New Roman","serif"'></span><span style='font-size:10.0pt;line-height:107%;font-family:"Times New Roman","serif"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:12.05pt;
+
margin-left:.7pt'>'''<span style='font-size:8.0pt;line-height:107%;font-family:
+
"Times New Roman","serif"'>Appendice: Codice in linguaggio C (per ora solo di
+
test)  </span>'''<p class=MsoNormal style='margin-top:0cm;margin-right:76.9pt;margin-bottom:
+
.15pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:navy'>#include</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'><stdio.h></span><span style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New"'></span><p class=MsoNormal style='margin-top:0cm;margin-right:76.9pt;margin-bottom:
+
.15pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:navy'>#include</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'><conio.h></span><span style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:silver'></span><span style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:green'>/*</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>non</span><span style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:green'>ANSI</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>C</span><span style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:green'>*/</span><span style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New"'></span><p class=MsoNormal style='margin-top:0cm;margin-right:249.75pt;margin-bottom:
+
.15pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:green'>/*#include</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New";color:green'><math.h></span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'> 
+
</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:green'>per</span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:silver'></span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>usare</span><span lang=EN-US style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:silver'></span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:green'>la</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New";color:green'>funzione</span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:green'>pow*/</span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New"'></span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:olive'>int</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>main() { </span><span lang=EN-US style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:silver'>    </span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:olive'>unsigned</span><span lang=EN-US style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:silver'></span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:olive'>char</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>byte[</span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:navy'>4</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>];
+
</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:silver'>    </span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:olive'>unsigned</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New";color:olive'>char</span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New"'>*c; </span><span lang=EN-US style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:silver'>    </span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:olive'>char</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>bit[</span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:navy'>9</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>];
+
</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:silver'>    </span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:olive'>int</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>i,j; </span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:silver'>    </span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:olive'>float</span><span lang=EN-US style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:silver'></span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>a; </span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'>    </span><span lang=EN-US style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:olive'>float</span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New"'>*p=NULL; </span><p class=MsoNormal style='margin-top:0cm;margin-right:441.75pt;margin-bottom:
+
.2pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'> </span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'>    </span><span style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>a=</span><span style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:navy'>0</span><span style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New"'>; </span><p class=MsoNormal style='margin-top:0cm;margin-right:163.35pt;margin-bottom:
+
.15pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>   
+
</span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>printf(</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:green'>"Le</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>dimensioni</span><span style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:green'>in</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>byte</span><span style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:green'>di</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>variabili</span><span style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:green'>\n"</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>); </span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>    </span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>printf(</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:green'>"char,</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>int,</span><span style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:green'>double</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>e</span><span style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:green'>float</span><span style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:green'>valgono</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>\n"</span><span style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>); </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.15pt;
+
margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:silver'>    </span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>printf(</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>"%d</span><span lang=EN-US style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:silver'></span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:green'>%d</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New";color:green'>%d</span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:green'>%d\n"</span><span lang=EN-US style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New"'>,</span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:olive'>sizeof</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>(</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:olive'>char</span><span lang=EN-US style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New"'>),</span><span lang=EN-US style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:olive'>sizeof</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>(</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:olive'>int</span><span lang=EN-US style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New"'>),</span><span lang=EN-US style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:olive'>sizeof</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>(</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:olive'>float</span><span lang=EN-US style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New"'>),</span><span lang=EN-US style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:olive'>sizeof</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>(</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:olive'>double</span><span lang=EN-US style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New"'>)); </span><p class=MsoNormal style='margin-top:0cm;margin-right:451.35pt;margin-bottom:
+
.15pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'> </span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'>    </span><span style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New";color:olive'>do</span><span style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New"'></span><span style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:silver'>    </span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>{ </span><p class=MsoNormal style='margin-top:0cm;margin-right:264.1pt;margin-bottom:
+
.2pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>       
+
</span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>printf(</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:green'>"inserisci</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>a</span><span style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:green'>=</span><span style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:green'>"</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>); </span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>        </span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>scanf(</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:green'>"%f"</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>,&a); </span><p class=MsoNormal style='margin-top:0cm;margin-right:76.9pt;margin-bottom:
+
.15pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>       
+
</span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>/*a=(float)pow(2,</span><span style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:silver'></span><span style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:green'>-2);utile</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>per</span><span style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:green'>trovare</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>il</span><span style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:green'>range</span><span style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:green'>di</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>rappresentazione*/</span><span style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New"'></span><span style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:silver'>        </span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>p=&a; </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.15pt;
+
margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:silver'>        </span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>c=(</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:olive'>unsigned</span><span lang=EN-US style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:silver'></span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:olive'>char</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>*)p; </span><p class=MsoNormal style='margin-top:0cm;margin-right:211.35pt;margin-bottom:
+
.2pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>       
+
</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New"'>printf(</span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:green'>"%d</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New";color:green'>%d</span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:green'>%d</span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:silver'></span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>%d\n"</span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New"'>,*(c+</span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:navy'>3</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>),*(c+</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:navy'>2</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>),*(c+</span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:navy'>1</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>),*c);
+
</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:silver'>        </span><span lang=EN-US style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New"'>printf(</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>"\n"</span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New"'>); </span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>        </span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:olive'>for</span><span lang=EN-US style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New"'>(i=</span><span lang=EN-US style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:navy'>0</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>;i<</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:navy'>4</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>;i++) </span><p class=MsoNormal style='margin-top:0cm;margin-right:264.1pt;margin-bottom:
+
.2pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>       
+
</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New"'>{ </span><p class=MsoNormal style='margin-top:0cm;margin-right:316.9pt;margin-bottom:
+
.2pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>           
+
</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New"'>byte[i]=*(c+</span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:navy'>3</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>-i);
+
</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:silver'>            </span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>j=</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:navy'>0</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>; </span><p class=MsoNormal style='margin-top:0cm;margin-right:264.1pt;margin-bottom:
+
.2pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>           
+
</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:olive'>while</span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:silver'></span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>(byte[i]></span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:navy'>0</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>) </span><p class=MsoNormal style='margin-top:0cm;margin-right:264.1pt;margin-bottom:
+
.2pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>           
+
</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New"'>{ </span><p class=MsoNormal style='margin-top:0cm;margin-right:312.15pt;margin-bottom:
+
.2pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>               
+
</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New"'>bit[j]=byte[i]%</span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:navy'>2</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>;
+
</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:silver'>                </span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>byte[i]=</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'></span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>byte[i]/</span><span lang=EN-US style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:navy'>2</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>;
+
</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:silver'>                </span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>j=j+</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:navy'>1</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>; </span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:silver'>            </span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>}
+
</span><p class=MsoNormal style='margin-top:0cm;margin-right:264.1pt;margin-bottom:
+
.2pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>           
+
</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New";color:olive'>for</span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New"'>(;j<</span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:navy'>8</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>;bit[j++]=</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:navy'>0</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>); </span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:silver'>            </span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:olive'>for</span><span lang=EN-US style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New"'>(j=</span><span lang=EN-US style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:navy'>7</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>;j>=</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:navy'>0</span><span lang=EN-US style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>;j--) </span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:silver'>                </span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>printf(</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>"%d"</span><span lang=EN-US style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New"'>,bit[j]); </span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>            </span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>printf(</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>"</span><span lang=EN-US style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:silver'></span><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:green'>"</span><span
+
lang=EN-US style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>);
+
</span><p class=MsoNormal style='margin-top:0cm;margin-right:316.95pt;margin-bottom:
+
.15pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span lang=EN-US
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>       
+
</span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>}
+
</span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:silver'>        </span><span style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>printf(</span><span style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:green'>"\n</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>\n"</span><span style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>); </span><span style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New";color:silver'>        </span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>printf(</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:green'>"altro</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:green'>numero?\n"</span><span style='font-size:8.0pt;line-height:
+
103%;font-family:"Courier New"'>); </span><p class=MsoNormal style='margin-top:0cm;margin-right:456.15pt;margin-bottom:
+
.2pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'> </span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>   
+
</span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>}
+
</span><p class=MsoNormal style='margin-top:0cm;margin-right:264.1pt;margin-bottom:
+
.2pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'>   
+
</span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:olive'>while</span><span style='font-size:8.0pt;line-height:103%;
+
font-family:"Courier New"'>(getch()!=</span><span style='font-size:8.0pt;
+
line-height:103%;font-family:"Courier New";color:green'>'n'</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>); </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:0cm;
+
margin-left:.7pt;margin-bottom:.0001pt'><span style='font-size:8.0pt;
+
line-height:107%;font-family:"Courier New"'> </span><p class=MsoNormal style='margin-top:0cm;margin-right:0cm;margin-bottom:.15pt;
+
margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span style='font-size:
+
8.0pt;line-height:103%;font-family:"Courier New";color:silver'>    </span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:olive'>return</span><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New";color:silver'></span><span style='font-size:8.0pt;line-height:103%;font-family:"Courier New";
+
color:navy'>0</span><span style='font-size:8.0pt;line-height:103%;font-family:
+
"Courier New"'>; </span><p class=MsoNormal style='margin-top:0cm;margin-right:264.1pt;margin-bottom:
+
.2pt;margin-left:.45pt;text-indent:-.5pt;line-height:103%'><span
+
style='font-size:8.0pt;line-height:103%;font-family:"Courier New"'>} </span></div></body></html>
+

Versione delle 13:17, 1 ott 2016

La codifica binaria della informazione'''' Vitoantonio Bevilacqua    bevilacqua@poliba.it 'Sommario. Il presente paragrafo si riferisce alle prime due lezioni del corso di Fondamenti di Informatica e Laboratorio di Informatica.    Parole chiave: Codifica Binaria, Memoria RAM, Complemento a 2, IEEE 754   a singola e doppia precisione.  1   Introduzione  Il fine principale degli argomenti trattati in queste iniziali lezioni consiste nell'illustrare in quale maniera l'informazione, per adesso soltanto numerica, viene memorizzata nella memoria RAM (Random Access Memory) di un sistema di calcolo rispettando standard condivisi, per poi essere elaborata attraverso un linguaggio di programmazione. In particolare si tratteranno: la codifica binaria, la codifica esadecimale, le conversioni di base, il concetto di errore di una codifica, la codifica di numeri interi con e senza segno in CA2 (complemento a 2), la codifica di numeri reali in singola e doppia precisione secondo lo standard IEEE 754, gli effetti sulla dichiarazione delle variabili signed e unsigned di tipo char ed int, e delle variabili float e double in linguaggio C.  2   La memoria di lavoro  La memoria RAM (Random Access Memory) è la memoria di lavoro (elaborazione) di un sistema di calcolo; per semplicità essa può essere rappresentata come una tabella organizzata in righe, ciascuna delle quali (per ora chiamata word) viene suddivisa in 4 colonne o blocchi, da ora in poi chiamati byte, costituiti da una sequenza di 8 bit (binary digit) ovvero 8 cifre che possono assumere soltanto valori 0 o 1.   In generale, ogni programma di elaborazione si occupa della gestione delle informazioni per unità elementari corrispondenti alla dimensione dei byte, senza necessariamente scendere al livello di dettaglio dei singoli bit, per questo motivo si dice che la unità minima indirizzabile (ovvero dotata di un indirizzo in memoria corrispondente alla posizione in memoria RAM) è il singolo byte. Il modo più diffuso di numerare i byte, iniziando sempre dal numero progressi 0, è da destra verso a sinistra (“little Endian”), laddove il verso dall’alto verso il basso è ovviamente relativo a come più avanti si dirà essere partizionata la intera memoria RAM.  3   Le regole per le trasformazioni di base  Dato un numero, le basi del sistema di numerazione che si usano per leggere tale numero sono la base 2 (binaria), 8 (ottale), 16 (esadecimale); assegnata una base del sistema di numerazione, le cifre sono date da 0 fino a numero base – 1. Dopo la cifra 9, si aggiungono A, B, C, D, E, F per formare la base di un sistema esadecimale.    Assegnato un numero codificato in base 2, si decodifica facilmente in base 10; esempio della codifica chiamata “in binario puro”:   (1010.101)2 = (1 x 23+ 0 x 22+1 x 21+ 0 x 20 + 1 x·2-1+ 0 x 2-2 + 1 x·2-3)10=(10.625)10  Codifica binaria di un numero: per l’operazione inversa, si utilizzano due algoritmi rispettivamente per la parte intera e decimale del numero:    3.1   Algoritmo di Horner - divisioni successive  Si prende il numero intero, si mette in colonna a sinistra, lo si divide per 2, riportando quoziente sotto il dividendo mentre il resto accanto al dividendo, e così via fino a raggiungere il quoziente 0. La parte intera del numero in binario è la sequenza dei resti, presa dal basso verso l’alto.  3.2   Algoritmo di Horner - moltiplicazioni successive  Si prende il numero decimale, si mette in colonna a sinistra, lo si moltiplica per 2, riportando:  1.     Se il prodotto è ≥1, accanto al primo fattore 1 e sotto il complemento del prodotto 2.     Se il prodotto è