(Chapter 1) Number system, Signed and Unsigned numbers, binary addition, logical shift
(Chapter 1) Number system, Signed and Unsigned numbers, binary addition, logical shift
In Ordinary level syllabus, only integer (positive and negative whole numbers) calculation is included for
numbers.
There are three number system that you need to be familiar with. They are:
- Binary - is a base 2 system where the distinct digits are 0 and 1. The value gets increased by
multiple of 2 to the left-hand side. The right most bit will have a multiple of 20 and will keep
growing as 21, 22 and so on. So, the place value for each digit from right to left will be 1, 2, 4 and so
on.
- Denary - is a base10 system where the distinct digits are 0 to 9. The value gets increased by multiple
of 10 to the left-hand side. The right most digit will have a multiple of 100 and will keep growing as
101, 102 and so on. So, the place value for each digit from right to left will be 1, 10, 100 and so on.
- Hexadecimal - is a base16 system where the distinct digits are (0 to 9 and A to F). The value gets
increased by multiple of 16 to the left-hand side. The right most digit will have a multiple of 160 and
will keep growing as 161, 162 and so on. So, the place value for each digit from right to left will be 1,
16, 256 and so on.
You need to know the process to convert from one number system to another number system
- Denary to Binary
- Binary to Denary
- Binary to Hexadecimal
- Hexadecimal to Binary
- Denary to Hexadecimal
- Hexadecimal to Denary
Denary to Binary:
Process 1:
- Use successive division by 2 and get the remainder until quotient becomes 0.
- Then from the bottom, pick the remainder up the order and place them from left to right.
- Then fill up the number of bits as per the question required. Suppose a result for a denary numer has
appeared in 6 bits and in the question it is given to represent in 8 bits, then add two 0s to the left.
Process 2:
- Write down the place value (using multiple of 2, which starts 20 from right) for each binary number
from right to left such as 1, 2, 4, 8, 16, 32, 64 etc. depending on the value that you are looking for
- Place 1 below each of the place value that are required to make up that value you are looking for and
add them up
Binary to Denary:
- Write down the place value (using multiple of 2, which starts 20 from right) for each binary number
from right to left such as 1, 2, 4, 8, 16, 32, 64 etc.
- Add up all the place values for each 1’s and the result is the denary number of the binary number
Page 1 of 5
Binary to Hexadecimal:
- Starting from the right-hand side, make groups of 4 bits. That means each group will have exactly 4
bits
- If the last group has less than 4 bits, then add 0s to the left to make group of 4 bits
- For each group, get the equivalent denary number
- Replace the hexadecimal digit for each denary number
- Put the values together
Hexadecimal to Binary:
- Convert each hexadecimal digit to equivalent 4 bits number
- Put the values together
Denary to Hexadecimal:
- The process is known as successive division by 16.
- However you have to go for long division by 16 and get the integer remainder. The first remainder
will be the right-most hexadecimal digit.
- Then go for long division again for the left over quotient. Using long division, divide the number by
16 again and get the integer remainder. It will become second digit from the right.
- In this way continue the long division by 16 until the quotient becomes 0.
Hexadecimal to Denary:
- Use the place value (multiple of 16, which starts with 160) for each hexadecimal digit from the right-
hand side. That means the place values for the hexadecimal number from the right will be 1, 16, 256,
4096 etc.
- Multiply the hexadecimal digit with the place value. Remember, if Hexadecimal digits are A to F
then the values will be replaced by 10 to 15 respectively.
- Add up the values together to get the denary number
Page 2 of 5
- MSB: Most significant bit refers to the leftmost bit in a binary number representation that has the
highest positional value. If the MSB is 0 (zero) then it means the number is a positive number and if
the MSB is 1 then the number is a negative number
- LSB: Least significant bit refers to the rightmost bit in a binary number representation that has the
lowest positional value
Process of conversion of positive denary number into binary number in Two’s complement:
- It is the same as normal denary to binary representation where the MSB will definitely be a 0 (zero)
Process of converting a binary number into denary which is represented in Two’s complement
method when the MSB is 0 (zero):
- Since the MSB is 0 (zero), just add the place values for the bits which are having 1
Method 1 when the MSB is 1 (You can use this method when you do not need to show your working):
- place value for the MSB will be negative place value and the rest of the bits will be having positive
place values
- Add up the place values for each 1’s including the MSB place value (which will be negative). The
result will be a negative denary number
Method 2 when the MSB is 1 (You have to use this method when it is written to show your working):
- Invert (flip) / toggle every bit (This is known as one’s complement). Every 1 becomes 0 and every 0
becomes 1
- Add 1 to the right most bit and the result are the representation in two's complement of the negative
number
- Since the number started with 1 that is why it will be a negative representation of the denary number.
So, do not forget to add a minus (-) sign before the number.
Number of values that can be represented in n bits in signed / two’s complement form is:
2n where n = number of bits. That means if n is 8 then 28 = 256 different values can be represented in 8 bit
This is to be noted that you are normally asked to show your working for binary addition. In that case you
must show sum and carry part (carry of 1’s) clearly. Binary addition will be given only for positive numbers.
Page 4 of 5
Shifting of Binary numbers
Logical shifting in binary: This means shifting the position of bits to the left or to the right from its current
position. There are two types of logical shift: Logical shift left and Logical shift right.
Logical shift left: Bits from the right (LSB) starts to shift its position and moves towards left. For each left
shift the value from the left (MSB) of a register drops off and since the right most bit (LSB) gets empty that
is why the LSB will be filled up with 0 (zero) no matter what value has been dropped off.
Effect of left shift: The value gets multiplied by 2 for each left shift usually. That means if there is a left
shift of 2 bits then the value will be multiplied by 4.
Exception: When there is a loss of a bit of 1 to the left side then the result will be different which means the
multiplication pattern will not be followed. It will be a different value which should be mentioned.
Logical shift right: Bits from the left (MSB) starts to shift its position and moves towards right. For each
right shift the value from the right (LSB) of a register drops off and since the left most bit (MSB) gets empty
that is why the MSB will be filled up with 0 (zero) no matter what value has been dropped off.
Effect of right shift: The value gets divided by 2 for each right shift usually. That means if there is a right
shift of 2 bits then the value will be divided by 4.
Exception: When there is a loss of a bit of 1 to the right side then the result will be different which means
the division pattern will not be followed. In this case there will be loss of precision (accuracy) which means
fraction of values will be lost as it will be mentioned that the register could only hold onto integer values.
Page 5 of 5