Professional Documents
Culture Documents
3-Number System and Binary Representation
3-Number System and Binary Representation
INFORMATION AND
COMMUNICATION
TECHNOLOGY
Dr Samabia Tehsin
5
BYTE
◦ Computer memory is organized into groups of eight bits
◦ Each eight bit group is called a byte
Binary Systems 6
BITS AS NUMBERS
◦ Denotes all numbers with combinations of 0s and 1s
◦ Decimal numbers automatically converted to binary
◦ Binary number processing hidden from user
Decimal Binary Decimal Binary
0 0000 5 0101
1 0001 6 0110
2 0010 7 0111
3 0011 8 1000
4 0100 9 1001
7
BITS AS CODES
8
◦ The main difference between Unicode and ASCII is that Unicode
is the IT standard that represents letters of English, Arabic,
Greek (and many more languages), mathematical symbols,
historical scripts, etc whereas ASCII is limited to few characters
such as uppercase and lowercase letters, symbols, and digits(0-
9).
◦ Unicode is also known as Universal Character Set. American
Standard Code for Information Interchange is the full form of
ASCII.
INTRODUCTION TO INFORMATION AND COMMUNICATION TECHNOLOGY 9
WHY COMPUTERS USE BINARY
◦ They can be represented with a transistor that is
relatively easy to fabricate (in silicon)
◦ Millions of them can be put in a tiny chip
◦ Unambiguous signal (Either 1 or 0)
◦ This provides noise immunity
Binary Systems 10
Binary Numbers
(234.26) 6 2 6 2 3 61 4 60 2 6 1 6 6 2 (94.5)10
1
(45.4)8 4 8 5 8 4 8 (39.5)10
1 0
RADIX NUMBER SYSTEM
◦ Base – 2 (binary numbers)
◦0 1
◦ Base – 8 (octal numbers)
◦0 1 2 3 4 5 6 7
◦ Base – 16 (hexadecimal numbers)
◦0 1 2 3 4 5 6 7 8 9AB C D E F
Binary Systems 15
Radix Operations
Binary Systems 17
Conversion From one radix to another
◦ From decimal to base-r
◦ Separate the number into an integer part and a fraction part
◦ For the integer part
◦ Divide the number and all successive quotients by r
◦ Accumulate the remainders
165
4 0.6875 x 2 = 1 + 0.3750
23
2 0.3750 x 2 = 0 + 0.7500
3
3 0.7500 x 2 = 1 + 0.5000
0
0.5000 x 2 = 1 + 0.0000
Binary Systems 19
CONVERSION FROM ONE RADIX TO
ANOTHER
◦ From binary to octal
◦ Divide into groups of 3 bits
◦ Example
◦ 11001101001000.1011011 = 31510.554
◦ From octal to binary
◦ Replace each octal digit with three bits
◦ Example
◦ 75643.5704 = 111101110100011.101111000100
Binary Systems 20
CONVERSION FROM ONE RADIX TO
ANOTHER
◦ From binary to hexadecimal
◦ Divide into groups of 4 bits
◦ Example
◦ 11001101001000.1011011 = 3348.B6
◦ From hexadecimal to binary
◦ Replace each digit with four bits bits
◦ Example
◦ 7BA3.BC4 = 111101110100011.101111000100
Binary Systems 21
Complements
◦ They are used to simplify the subtraction operation
◦ Two types (for each base-r system)
◦ Diminishing radix complement (r-1 complement)
◦ Radix complement (r complement)
(r 1) N
n r-1 complement
r Nn r complement
9’S AND 10’S COMPLEMENTS
◦ 9’s complement of 674653
◦ 999999-674653 = 325346
◦ 9’s complement of 023421
◦ 999999-023421 = 976578
◦ 10’s complement of 674653
◦ 325346+1 = 325347
◦ 10’s complement of 023421
◦ 976578+1=976579
Binary Systems 23
1’S AND 2’S COMPLEMENTS
◦ 1’s complement of 10111001
◦ 11111111 – 10111001 = 01000110
◦ Simply replace 1’s and 0’s
◦ 1’s complement of 10100010
◦ 01011101
◦ 2’s complement of 10111001
◦ 01000110 + 1 = 01000111
◦ Add 1 to 1’s complement
◦ 2’s complement of 10100010
◦ 01011101 + 1 = 01011110
Binary Systems 24
SUBTRACTION WITH COMPLEMENTS OF
UNSIGNED
◦M – N
◦ Add M to r’s complement of N
◦ Sum = M+(rn – N) = M – N+ rn
◦ If M > N, Sum will have an end carry rn , discard it
◦ If M<N, Sum will not have an end carry and
◦ Sum = rn – (N – M) (r’s complement of N – M)
◦ So M – N = – (r’s complement of Sum)
Binary Systems 25
SUBTRACTION WITH COMPLEMENTS
OF UNSIGNED
65438 - 5623
65438
10’s complement of 05623 +94377
159815
Discard end carry 105 -100000
Answer 59815
Binary Systems 26
SUBTRACTION WITH COMPLEMENTS
OF UNSIGNED
◦ 5623 - 65438
05623
10’s complement of 65438 +34562
40185
There is no end carry =>
-(10’s complement of 40185)
-59815
Binary Systems 27
SUBTRACTION WITH COMPLEMENTS
OF UNSIGNED
◦ 10110010 - 10011111
10110010
2’s complement of 10011111 +01100001
100010011
Discard end carry 2^8 -100000000
Answer 000010011
Binary Systems 28
SUBTRACTION WITH COMPLEMENTS
OF UNSIGNED
◦ 10011111 -10110010
10011111
2’s complement of 10110010 +01001110
11101101
There is no end carry =>
-(2’s complement of 11101101)
Answer = -00010011
Binary Systems 29
SIGNED BINARY NUMBERS
◦ Unsigned representation can be used for positive
integers
◦ How about negative integers?
◦ Everything must be represented in binary numbers
◦ Computers cannot use – or + signs
Binary Systems 30
NEGATIVE BINARY NUMBERS
Binary Systems 33
TWO’S COMPLEMENT
◦ Find one’s complement
◦ Add 1
◦ Example (-6)
◦ First represent 6 in binary format (00000110)
◦ One’s complement (11111001)
◦ Two’s complement (11111010)
Binary Systems 34
ARITHMETIC ADDITION
◦ Usually represented by 2’s complement
Discard
+5 00000101 -5 11111011
+11 00001011 +11 00001011
+16 00010000 +6 100000110
+5 00000101 -5 11111011
-11 11110101 -11 11110101
-6 11111010 -16 111110000
Binary Systems 35
Discard
CREDITS & ACKNOWLEDGEMENTS
◦ Digital Planet: Tomorrow’s Technology and You, Pearson Education, Inc. publishing as Prentice Hall
◦ Digital Logic Design by Dr. Fenghui Yao, Tennessee State University, Department of Computer Science, Nashville, TN