Lesson 03 - Number Systems
Lesson 03 - Number Systems
Number System
When typing letters or words using the computer, these words or letters are represented by the computer as
numbers it can understand. While this group of numbers that the computer can understand is called a
'Number System' the limited number of numerals in the number system called digits. The value of these
numbers (numerals) depends on the position they occupy within the number. While the concept of number
system was present in the 'Abacus ' considered as the first calculating machine of the world, it has progressed
up to the computer of today. The number system used for the representation of data in the computer is as
follows;
Computer represents data in two signal states. There are two Voltage levels for these two symbols. One is
named as the high voltage level and the other is named as low voltage level. ''0'' and ''1'' digits respectively
represent these low and high voltage levels in a circuit. Thus, ''1'' and ''0'' status are equal to the “On” and
“Off” states of an electronic circuit. Any data in the world can be represented on the computer using these
two digits.
Most and Least Significant Positional Value of a Number.
There are two seperate methods to find the most and least significant values of decimal numbers and whole
numbers. When a whole number is read from left to right, the number in the right most end is the least
significant positional value and the number in the left most end which is not 0 is the most significant positional
value. In decimal numbers, the value in the right extreme after the decimal point which is not 0 becomes the
least significant positional value and the number in the left extreme of the decimal point which is not 0
becomes the most significant positional value.
You can use the same method used for the decimal number system to find the most and least significant
positional digits of binary, octal and hexadecimal numbers.
Only the Binary Number System is used to find the most significant bit (MSB) and the least significant bit(LSB).
There are two ways to find this using decimal numbers and whole numbers. In a whole number, read from left
to right, the value in the right extreme is the least significant bit and the value in the left extreme which is not
0 is the most significant bit. In binary decimal numbers, the value in the right extreme of the decimal point
which is not 0 is the least significant bit and the value in the left extreme of the decimal point which is not 0 is
the most significant bit.
Conversions between number systems.
Decimal
Into
Binary
Binary
To
Decimal
Decimal
To Octal
Octal To
Decimal
Decimal
To Hexa
Decimal
Hexa
Decimal
To
Decimal
Octal To
Binary
Binary
To Octal
Hexa
decimal
To
Binary
Binary
To Hexa
Decimal
Octal To
Hexa
Decimal
Hexa
Decimal
To Octal
Sign-Magnitude
The sign and magnitude method is commonly an 8 bit system that uses the most significant bit (MSB) to
indicate a positive or a negative value. By convention, a ‘0’ in this position indicates that the number given by
the remaining 7 bits is positive, and a most significant bit of ‘1’ indicates that the number is negative. This
interpretation makes it possible to create a value of negative zero.
One’s Complement
In one's complement, positive numbers are represented as usual in regular binary. However, negative
numbers are represented differently. To negate a number, replace all zeros with ones, and ones with zeros -
flip the bits. Thus, 12 would be 00001100, and -12 would be 11110011. As in signed magnitude, the leftmost
bit (most significant bit-MSB) indicates the sign (1 is negative, 0 is positive). To compute the value of a
negative number, flip the bits and translate as before.
When representing positive and negative numbers in 8-bit ones complement binary form, the positive
numbers are the same as in signed binary notation.
The ones complement system still has two ways of writing 010 (000000002 = +010 and 111111112 = −010);
Two’s Complement.
A single set of bits is used. To form a negative number, start with a positive number, complement each bit and
add one. This interpretation includes one more negative value than positive values (to accommodate zero).
Addition using 2's complement
1. Show how the computation 15+(-5) is done in 8-bit two's complement arithmetic. Explain how you deal
with the carry generated in the most significant bit.
15 -> 000011112
5-> 000001012
000011112(15)
+111110112(-5)
000010102
2. Explain how the positive and negative numbers in two's complement can be converted into decimal
numbers.
If MSB is 0 - >positive
Convert to decimal
If MSB is 1 ->negetive
In calculations involving fixed point numbers that have a fixed number of digits after the decimal point.
Floating point
There are several ways to represent floating point number but IEEE 754 is the most efficient in most cases.
IEEE 754 has 3 basic components:
sign = 0
biased exponent
127 + 6 = 133
Normalised mantisa = 010101001 , we will add 0's to complete the 23 bits
01010100100000000000000
0 10000101 we added 0's to complete the
23 bits
Ex2 : -10.625 is represented in single precision floating point as below.
1.010101x23
3+127 = 13010
100000102
Sign = 1
1 10000010 01010100000000000000000
Advantage Disadvantage
Fixed Point Representation Performance good. No need to rely Limited range of values can
on additional hardware or represent
software logic
Floating point representation Greater range of numbers is More storage space needed.
represented. Varying degrees of Slower processing times. Lack of
precision. precision
Competency level 3.2: Analyses how characters are represented in computers
This coding system was used in the early stages of computing. In this system one digit is represented by 4 bits.
This is used only to represent decimal numbers. Sixteen symbols (24 = 16) can be represented in this system.
The table 3.15 shows the BCD codes for the 10 digits from 0 to 9.
Normally uses 8 bits (1 byte) to store each character. However, the 8th bit is used as a check digit, meaning
that only 7 bits are available to store each character. This gives ASCII the ability to store a total of 27 = 128
different values . The 7 bit ASCII code was originally proposed by the American National Standard Institute
(ANSI). (IBM personal computers use ASCII).
EBCDIC – Extended Binary Coded Decimal Interchange Code
We can write only 128 characters using ASCII system, but the EBCDIC code system allows the use of 256
characters. Here, one symbol can be written with a binary number which consists of 8 bits. Hence, 256
characters can be represented using this system. This system was used in IBM main frame computers. The
table below shows that there are different EBCDIC codes for the 26 different capital letters and 26 different
EBCDIC codes for the 26 simple letters in this system.
UNICODE – Though 128 characters can be used in the ASCII system and 256 characters can be used in the
EBCDIC system for data representation. For example, these systems cannot be used for Sinhala, Japanese,
Chinese and Tamil languages as there are more than 256 characters. Hence Unicode system was designed
according to a standard to represent 65536 different symbols of 16 bits.
Competency level 3.3: Uses basic arithmetic and logic operations on binary numbers
Example :- Find 101012 AND 111002, 101012 OR 111002, 101012 XOR 111002