Computer Number Systems Workbook
Computer Number Systems Workbook
Computer Number Systems Workbook
Boolean Algebra
Computer Number Systems
We all know and understand the decimal number system. Computers, on the other hand, make
use of the binary number system, where all data is stored in the computer as 0s and 1s. These 0s
and 1s can be stored as memory, where the size varies according to the kind of computer used
(microcomputers store 8 or 16 binary digits where large computers store as many as 128 binary
digits).
We usually don’t enter data using the binary number systems because it’s too time consuming
(too many 0s and 1s). Data is more likely entered into a computer by either the decimal, octal or
hexadecimal number systems. Octal and hexadecimal number systems are used most often
because they are more closely related to the binary system than is the decimal system.
We will use subscripts to denote the base we are working in. For example, the number 11 in the
binary system would be 112 , in the octal system 118 , in the decimal system 1110 (we will see
why it’s base 10 next). Let’s see how all these numbers are related.
The 2 is in the ones position and the base 10 is raised to the power of 0; the 3 is in the 10s position
and the base 10 is raised to the power of 1; the 0 in the 100s position and the base 10 is raised
to the power of 2; the 7 in the 1000s position and the base 10 is raised to the power of 3. We can
take each digit in the number, and depending on its position, multiply it by a factor of base 10.
So, every number in the decimal number system can be written as numbers from 0 to 9 times
multiples of 10.
Module: Computer Number Systems and Boolean Algebra
a) 110102
b) 100011012
a) 1110 b) 3410
2
Module: Computer Number Systems and Boolean Algebra
a) 10258
b) 4328
a) 18910 b) 37610
3
Module: Computer Number Systems and Boolean Algebra
a) 𝐶𝐶2916
b) 12𝐴𝐴𝐴𝐴16
a) 132410 b) 176310
4
Module: Computer Number Systems and Boolean Algebra
Since many 0s and 1s are needed to represent larger numbers in the binary number system, when
we convert from binary to octal number systems, the number of digits required is reduced by a
factor of 3 (because one octal digit equals 3 bits). That is, all octal digits, 0 through 7, can be
represented by 3 bits.
0 = 000 4 = 100
1 = 001 5 = 101
2 = 010 6 = 110
3 = 011 7 = 111
a) 1101111000012 b) 1000.10112
a) 4178 b) 3628
5
Module: Computer Number Systems and Boolean Algebra
0 = 0000 8 = 1000
1 = 0001 9 = 1001
2 = 0010 𝐴𝐴 = 1010
3 = 0011 𝐵𝐵 = 1011
4 = 0100 𝐶𝐶 = 1100
5 = 0101 𝐷𝐷 = 1101
6 = 0110 𝐸𝐸 = 1110
7 = 0111 𝐹𝐹 = 1111
a) 1101100110112 b) 1000.10112
a) 𝐶𝐶0𝐷𝐷16 b) 𝐹𝐹2316
6
Module: Computer Number Systems and Boolean Algebra
7
Module: Computer Number Systems and Boolean Algebra
ADDITION
Adding Decimal Numbers
If we add the following decimal numbers 23 and 45, we have
23 + 45 =?
2 3
4 5
6 8
So 23 + 45 = 68.
carry 1 1
6 4
8 7
1 (15) (11)
(subtract value of carry/base) 10 10
1 5 1
We “subtract value of carry/base” since the numbers (15) and (11) are greater than 9 (since we
are using the decimal system of base 10).
8
Module: Computer Number Systems and Boolean Algebra
9
Module: Computer Number Systems and Boolean Algebra
SUBTRACTION
Subtracting Decimal Numbers
If we subtract the following decimal numbers 64 and 47, we have
borrowed 5
6 4
4 7
1 (-3)
(add value of carry/base) 10
1 7
We “add value of carry/base” since the numbers (-3) is less than 9 (since we are using the
decimal system of base 10).
10
Module: Computer Number Systems and Boolean Algebra
11
Module: Computer Number Systems and Boolean Algebra
12
Module: Computer Number Systems and Boolean Algebra
One’s Complement
The one’s complement of a binary number is a way of allowing the computer to do an addition
of two binary numbers (using the complement method) instead of a subtraction. The
complement of a binary number is found by subtracting a binary number made up of all 1s by the
number at hand.
1 1 1 1 1 1 1 1
1 0 1 1 0 0 1 0
0 1 0 0 1 1 0 1
Notice the one’s complement of a binary number is actually just changing the 0s to 1s and the
1s to 0s. Therefore, the one’s complement of 0111102 is 1000012 .
The computer is easily able to perform this “switch” by a circuit called an inverter.
Now, instead of subtracting, for example, 10110011 − 01101101, we would ADD 10110011
by the one’s complement of the second number 01101101.
Example: Find the difference between the following binary numbers using the one’s
complement method:
a) 10110011 − 01101101
b) 11011000 − 10110011
13
Module: Computer Number Systems and Boolean Algebra
Two’s Complement
It turns out that computers actually subtract by using the two’s complement method.
The two’s complement method is a way of bypassing the carry created by adding with the one’s
complement. To find the two’s complement of a binary number, we add 1 to the one’s
complement. For example, the one’s complement of 10011101 is 01100010. The two’s
complement adds that number to 1.
0 1 1 0 0 0 1 0
0 1 1 0 0 0 1 1
Example: Find the difference between the following binary numbers using the two’s
complement method:
a) 01100111 − 01001010
b) 01011011 − 00110110
14