Week 3 · Unit 1 Number systems (3): binary to decimal and decimal to binary · 3 lessons
3
First and last remainder: LSB, MSB and checking back
ICT Secondary 3 Term 1, Unit 1, Topic 1: pp. 14–17
GoalName the first and last bit of a binary number and check an answer by converting back.
New words
LSB · least significant bit: the bit on the right, worth only 1MSB · most significant bit: the bit on the left, with the largest place valuecheck · a second calculation that confirms an answer
Explanation
In a binary number the bit on the right is the least significant bit (LSB): it is worth only 1, and it is the first remainder of the divisions. The bit on the left is the most significant bit (MSB): it has the largest place value and it is the last remainder. Without leading zeros the MSB is always 1. The LSB tells us whether the number is even or odd, because every other place value (2, 4, 8 …) is even: a binary number is even when its LSB is 0 and odd when its LSB is 1. Always check a conversion by going back. A second way to find the bits is to subtract place values: for each place, from the largest down, write 1 if the place value fits in what is left and subtract it, otherwise write 0. For 77 the steps are in the table, and they give (1001101)₂. Check: 64 + 8 + 4 + 1 = 77.
Place value
64
32
16
8
4
2
1
Number left
77
13
13
13
5
1
1
Fits?
yes
no
no
yes
yes
no
yes
Bit
1
0
0
1
1
0
1
Worked examples
Reading order
Bits
Value
Equals 100?
top to bottom
0010011
19
no
bottom to top
1100100
100
yes
Mona converts 100 and reads the remainders from top to bottom: 0010011. Going back, 16 + 2 + 1 = 19, not 100, so the check catches the mistake. From bottom to top the bits are 1100100 and 64 + 32 + 4 = 100.
Binary
LSB
Decimal
Even or odd?
1011010
0
90
even
1011011
1
91
odd
The binary numbers 1011010 and 1011011 differ only in the LSB. With LSB 0 the number is 64 + 16 + 8 + 2 = 90, which is even; with LSB 1 it is 91, which is odd.
The ready functions decbin and bindec do the same conversions, so they are good for checking a hand answer, not for replacing it. This program prints the binary form of 77 and the decimal value of 1001101.
Class activity
Choose a decimal number between 20 and 60. Convert it to binary twice, once by repeated division by 2 and once by subtracting place values. Compare the answers, name the LSB and the MSB, and check by converting back.
Practice
1
What are the LSB and the MSB of 10011?
The LSB is the right-hand bit, 1; the MSB is the left-hand bit, 1.
2
Is (110100)₂ even or odd? How can you tell without converting?
Even: its LSB is 0. (It is 32 + 16 + 4 = 52.)
3
Convert 53 to binary by subtracting place values, then check back.
32 fits (1), 16 fits (1), 8 does not (0), 4 fits (1), 2 does not (0), 1 fits (1): 110101. Check: 32 + 16 + 4 + 1 = 53.
4
What is the place value of the MSB of an 8-bit number?