ECNG2013 Number Systems The Most Common Number System Is The Base Ten or Decimal Number System
ECNG2013 Number Systems The Most Common Number System Is The Base Ten or Decimal Number System
LECTURE
Number Systems
The most common number system is the base ten or decimal number system.
Therefore to interpret a string of decimal digits, we mentally multiply each digit by
its place value.
e.g 5049 (5 10 3 ) (0 10 2 ) (4 101 ) (9 10 0 )
In computer science, base two notation or binary notation is of special importance
because the signals used in modern electronics are always one of only two states.
Therefore a base two representation of a positive integer x is a string consisting of
digits 0 or 1.
e.g 1001011 which has decimal equivalence
(1 2 0 ) (1 21 ) (1 2 3 ) (1 2 6 ) 1 2 8 64 75
Operations with binary numbers
+
0
1
0
0
1
1
1
10
Numbers are added and subtracted in the usual column by column fashion
In addition, sometimes there is a 1 to carry to the next column.
Example
Calculate (a ) 11011 2 1110 2
11011 2
(a)
1110 2
1010012
and
(b)
11011 2
1110 2
1101 2
In (a), the second column from the right gives 1 + 1 = 10, so there is a 1 to carry to
the third column. Similar operations have to carried out from the third to the fourth,
the fourth to the fifth and the fifth to the sixth column.
X
0
1
0
0
0
1
0
1
Long multiplication and long division in binary are straightforward using the above
multiplication table.
Example
Solve ( a ) 11010 2 10112
and
Solution
(a)
11010
1011
11010
11010
11010
100011110
101 11101
(b)
101
100
0
1001
101
100
Octal (base 8)
The algorithms to convert from octal to binary and vice-versa are relatively simple
In converting from octal to binary, we simply replace each octal digit by its 3-bit
binary representation.
Note however that leading zeros must be inserted if an octal digit is less than 4
1
4 . 7
001 100 . 111
Hexadecimal
In mathematics and computer science, hexadecimal is a numeral system with a
base of 16. It uses 16 distinct symbols: the symbols 0 9 to represent the values
zero to nine, and A, B, C, D, E, F to represent values ten to fifteen.
Each hexadecimal digit represents four binary digits (bits). It is therefore relatively
compact and easy to express values in base 2 and vice-versa
Example
Convert B 2.5 D 616 to binary
Solution
B
1011
2
0010
.
.
5
D
6
0101
1101
0110