Unit5 Number System
Unit5 Number System
Significance of a digit refers to its weight that is determined by its absolute and place
value. In a decimal number system, the most significant digit (MSD) is the leftmost,
while the least significant digit (LSD) is the rightmost digit. For a number like 7085,
Table 5.2 shows that 5 is the least significant having a place of 5 while 7 is the most
significant with place value of 7000.
Place value 103 =1000 102 = 100 101 =10 100=1
Decimal digit 7 0 8 5
Weight 7000 0 80 5
To get the decimal number equivalent to 7245 we add: 3584 + 128 + 32 + 5 = 3749
Thus; 72458 = 374910.
Hexadecimal Number System
Hexadecimal is a base 16 number system consisting of 16 digits that range from 0 to
9, and A to F. The letters A to F are used to represent numbers 10 to 15 as shown in
Table 5.5. Always remember to indicate the base of a hexadecimal number using the
subscript 16 e.g. 4F916.
Base 10 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Base 16 0 1 2 3 4 5 6 7 8 9 A B C D E F
Table 5.5. Hexadecimal digits
1 Division-by-Base Method
In division-by-base method, a decimal number is repeatedly divided by the base until
the dividend is indivisible by 2. In every division, write down the remainder on the
right of the dividend. Read the sequence of 0s and 1s bottom-ups that represents the
binary number. For example, to convert 4510 to binary form, proceed as follow:
2 45
22 R1
11 R0
5 R 1 Thus: 4510=1011012
2R1
1R0
0 R1×
Explanation
Divide 45 by 2. We get 22 remainder 1.
Next divide 22 by 2. We get 11 remainder 0.
Continue dividing until the number is indivisible by 2. In this case, 1 is not
divisible hence we write 0 remainder 1.
Read the remainder digits as 0s and 1s bottom up.
Read the binary digits from left to right. This gives us 011110111.
Thus: 24710 = 0111101112.
Table 5.11 demonstrates how to use place value method to convert 107 10 to binary
form. First, write the place values up to 128, and then calculate the difference from left
to right. If the difference is > =0, insert 1 otherwise insert 0 as shown in Table 5.11.
128 64 32 16 8 4 2 1
107–128 (107–64) (43–32) (11–16) (11–8) (3–4) (3–2) (1–1)
0 1 1 0 1 0 1 1
Table 5.11: Place value method
Thus: 10710=11010112
Explanation
Divide the number by 16 and write down the quotient and the remainder. Note the
remainder can be a digit between 0 and F.
Place value 25 24 23 22 21 20
Binary digits 1 0 1 1 0 1
Table 5.12: Binary to decimal conversion
B 11 1011
C 12 1100
D 13 1101
E 14 1110
F 15 1111
For example, to convert 110100012 to hexadecimal form, group the bits into sets of 4
starting from right to left as follows: as shown in Table 5.16:
Binary 1101 0001
Hexadecimal D 1
Table 5.16: Binary to hexadecimal conversion
If a binary number does not have an exact set of 4 bits after grouping such as
1100100001, proceed as follows:
Split the number into sets of 4 bits starting from right to left. In our case, we get
three complete sets and one incomplete one:
11 0010 0001
Because the leftmost set has two bits, add two zeros to it on the left to get:
0011 0010 0001
Using the binary equivalents in Table 5.17, place each the equivalent
hexadecimal digit under each of the set of bits.
Binary digits 0011 0010 0001
Hexadecimal 3 2 1
Table 5.17: Grouping bits to represent a hexadecimal digit
From left to right, multiply each digit by its place value as shown below:
64 × 5 =320
8×1=
1×2=+2
330
Thus: 5128= 33010
16 514
16 32 R 2
2R0
0R2
Demand digit 10 9
In mathematics, a number with integer and fractional parts such as 87.25 is known
as a real number. In computing, a real number is referred to as floating point
number. The fractional part has a value that is less than 1 written as 1/x or 0.x. For
example, 87.25 has a fractional part 0.25 that may also be written as 1/4. The weight
of a floating-point number increases from right to left as shown in Table 5.23:
Place value 101 100 • 10–1 10–2 10–3
Decimal digit 8 7 • 5 3 7
Decimal value 80 7 • 0.5 0.03 0.007
Table 5.23: Decimal fraction
In computing, the same approach is used to represent fractional binary numbers. For
example, the fractional binary number 11.110112 may be represented as shown in
Table 5.24.
For example, to convert a number like 87.25 to binary form, first convert the integer
part using one of the methods discussed earlier. Then, convert the fractional part as
follows:
Start by multiplying the fractional part by 2 and write the partial product. For
example, 0.25 × 2 = 0.5.
Take the fractional part of the previous partial product and multiply it by 2. In our
case: 0.50 × 2 = 1.000.
Repeat until the fractional part on the right of decimal point of the partial product
is 0 or starts recurring. For example, in step 2 above, the fractional part is 000
hence we stop.
Read downwards the 0s and 1s on the left of the decimal point of partial products
as shown below:
read this digits
0.25 × 2 = 0.50
87.25 = 1010111.01
0.50 × 2 = 1.00
0.375 × 2 = 0.750
0.750 × 2 = 1.500
0.500 × 2 = 1.000 (stop because the part on the right is zero)
Read the digits on the left of decimal point downwards as shown by the arrow. In
this case, the digits are 0.011.
Combine the integer and fractional parts to get: 111+0.011= 111.0112
Thus: 7.37510 = 111.0112
In this example, we demonstrate how to convert a decimal number 0.40 that returns a
recurring binary fraction. We proceed as follows:
read downwards
0.40 × 2 = 0.80
0.80 × 2 = 1.60
0.60 × 2 = 1.20
1.20 × 2 = 0.40
0.40 × 2 = 0.80 (stop because the fraction starts repeating the first step)
Thus: 0.4010 = 0.01102
Next, convert the bits on the right of the decimal point to decimal form using
corresponding place values from left to right as shown below:
0.50 × 0= 0.000
0.25 × 1= 0.250
0.125 × 1= 0.125
0.375
Ones complement
One’s complement is a temporary step to finding twos complement of a binary
number. To convert a binary number to ones, complement, we invert 0 bits to 1s and
vice versa. For example, the one’s complement of 1001110 2 may be expressed as a
unary operation as follows:
~(1001110) = 0110001; where ~ stands for negation.
Two’s complement
Two’s complement is another method used to represent negative numbers in binary
form. Two’s complement of a number is obtained by getting the one’s complement
then adding 1 bit.
For example, to find the two’s complement of the binary number 1001110 2, proceed
as follows:
Convert 1001110 to one’s complement using unary operator (~) :
~(1001110) = 0110001;
Add 1 bit to one’s complement to get the two’s complement:
0110001 + 1 = 0110010
Thus: Two’s complement of 1001110 = 0110010.
Taking another example, let us convert the decimal number 45 to binary form and
express its negative value using twos complement.
The problem requires that you pad (insert) 0 bits to the left of the most significant bit
until the number has 8 bit. To get the 2s complement, proceed as follows:
4510 to 8-bit binary form i.e 001011012.
Convert the binary number to one’s complement as follows:
~(00101101) = 11010010.
Add 1 to one’s compliment number as follows:
11010010 + 1 = 11010011.
Binary addition
The four rules applied in binary additions are:
0+0=0
0+1=1
1+0=1
1 + 1 = 0 (write 0, and carry 1 to the next significant bit).
111
011
Start the add operation with the least significant digits on the right.
12 + 12 = 102 (write 0, and then carry 1)
Add the carry over digit from the previous step to the second least significant bit
to get:
12 + 12 + 12 = 112 (write 1, and then carry 1)
Finally, add the most significant bits, plus the carry-over from the previous step
to get:
12 + 0 + 12 = 102, (write 10 because to this is the leftmost)
Thus: 1112 + 0112 = 10102
Binary subtraction
The four rules applied in binary subtraction are:
0–0=0
1–0=1
1–1=0
0 – 1 = 1 (borrow 1 from the next more significant bit)
Therefore, the result shows that the difference between 5 and 3 is 00000001; but this is not true
because the answer should be 00000010.
To get the correct answer, add the overflow bit back to the difference. Thus, the correct
difference is:
00000001 + 1 = 00000010.
The bit in brackets is an overflow hence it should be ignored. Therefore, the correct difference is
00000010.
Binary Multiplication
The pen-and-paper method of binary multiplication is quite similar to that used in decimal numbers
only that the multipliers are 0s and 1s. In binary multiplications, the four rules applied from right to
left are:
0x0=0
1x0=0
1x0=0
1x1=1 (no carry over or borrowing)
For example, to perform binary multiplication 1011 x 101, proceed as follows:
1011
×101 Add the partial products we get 1101112
1011
0000
+1011
110111
Explanation
Multiply the first multiplication with each digit of the second multiplication.
Shift the partial products to the left.
Add the partial products as follows: 1011 + 0000 +
1011 = 1101112
Binary Division
Binary division is a shift and subtract operation. In each step, the dividend is grouped into bits which
are divisible by the divisor, and then subtracted. For example, to perform division of 10101 2 ÷ 112
proceed as follows: