1.3 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	Exercices
Binary
- 
\( \) 
- 
4095 
- 
100000 (2) = 32 (10) 
- 
000010 (2) = 2 (10) 
- 
111111 (2) = 63 (10) 
- 
010101 (2) = 21 (10) 
- 
64 (10) = 0100 0000 (2) 
- 
7 (10) = 0000 0100 (2) 
- 
192 (10) = 1100 0000 (2) 
- 
3073 (10) = 0110 0000 0001 (2) 
- 
0x1010 = 4112 
- 
0x10A0 = 4256 
- 
0xBABE = 47806 
- 
020 = 16 
- 
072 = 58 
- 
sur papier = 0xCAFE 
- 
sur papier = 02001 
- 
0xCAFE = 1100 1010 1111 1110 
- 
0xCAFE = 0145376 
- 
072 = 111010 
- 
./algo_q21.py 
Complement a 2
- 
\( -2^11 → 2^11-1 \) 
- 
17 = 0001 0001 
- 
-17 = 1110 1101 
- 
255 = 1111 1111 (Imposible car pas dans l'interval) 
- 
-128 = 1000 0000 
- 
-73 = 10110111 
- 
01001111 
- 00000001 = 01010000
- 
- 10010110 = 01101010
 
- 
01001111 + 01000001 --------- = 10010000 (Overflow, le nombre n'est pas dans la range de nombre accesible sur 8 bits en ca2) 
- 
00000001 - 00000010 ---------- = 11111111 
- 
00001001 x 00000110 ---------- 000010010 
- 0000100100
= 0000110110
- 
10000001 - 10000010 ---------- = 11111111 
- 
- 10000000 = 011111111 (Imposible a representer sur 8 bits)
 
- 
00010100 / 00000101 ---------- 00000100 
- 
00010111 / 00001001 ---------- 00000010 (reste 101)