Download presentation
Presentation is loading. Please wait.
1
Binary & Decimal numbers
2
3185 = 3*1000 + 1*100 + 8*10 + 5*1 = 3*10 3 + 1*10 2 + 8*10 1 + 5*10 0 Decimal system: Ten digits: 0,1,2,3,…,9 Example:
3
10110 1*(2 4 ) + 0*(2 3 ) + 1*(2 2 ) + 1*(2 1 ) + 0*(2 0 ) Binary system: Two digits: 0,1 Example:
4
Byte and Bit 00001011 Bit: (binary digit) either 0 or 1 Byte: an ordered collection of 8 bits MSB (Most significant bit) LSB (Least significant bit)
5
*27*27 *26*26 *25*25 *24*24 *23*23 *22*222 *21*21 *20*20 Binary to Decimal 00001011 0*(2 7 )0*(2 6 )0*(2 5 )0*(2 4 )1*(2 3 )0*(2 2 )1*(2 1 )1*(2 0 ) 2 3 + 2 1 + 2 0 = 11
6
Decimal to Binary 251 [25%2=1] 12 [25/2=12] 0 [12%2=0] 6 [12/2=6] 0 [6%2=0] 3 [6/2=2] 1 [3%2=1] 1 [3/2=1] 1 [1%2=1] 0 [1/2=0] Right Left 25 (decimal) = 11001 (binary) 1 23 5 7 9 4 6 8 10
7
Overflow 11111111 The highest number represented by 8 bits is 255 (why?). What happens when we add 1 to it? 100000000 The bit is lost !
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.