Luc3 Comp
Luc3 Comp
Number Systems
A number is a mathematical value used for counting and measuring
objects, and for performing arithmetic calculations. Numbers have
various categories like natural numbers, whole numbers, rational and
irrational numbers, and so on. Similarly, there are various types of
number systems that have different properties, like the binary number
system, the octal number system, the decimal number system, and the
hexadecimal number system.
There are different types of number systems in which the four main types
are:
24
Lecturer : Najat Shyaa Jasim Subject : Computer Science
The binary number system uses only two digits: 0 and 1. The numbers in
this system have a base of 2. Digits 0 and 1 are called bits and 8 bits
together make a byte. The data in computers is stored in terms of bits and
bytes. The binary number system does not deal with other numbers such
as 2,3,4,5 and so on. For example: 100012, 1111012, 10101012 are some
examples of numbers in the binary number system.
Hence, in this system, the rightmost position is units (20) position, the
second position from the rights 2’s (21) position, and proceeding in this
way, we have 4’s (22) position, 8’s (23) position, 16’s (24) position, and so
on.
25
Lecturer : Najat Shyaa Jasim Subject : Computer Science
The octal number system uses eight digits: 0,1,2,3,4,5,6 and 7 with the
base of 8. The advantage of this system is that it has lesser digits when
compared to several other systems, hence, there would be fewer
computational errors. Digits like 8 and 9 are not included in the octal
number system. Just as the binary, the octal number system is used in
minicomputers but with digits from 0 to 7. For example: 358, 238,
1418 are some examples of numbers in the octal number system.
The decimal number system uses ten digits: 0,1,2,3,4,5,6,7,8 and 9 with
the base number as 10. The decimal number system is the system that we
generally use to represent numbers in real life. If any number is
represented without a base, it means that its base is 10. For example:
72310, 3210, 425710 are some examples of numbers in the decimal number
system.
26
Lecturer : Najat Shyaa Jasim Subject : Computer Science
For example: 7B316, 6F16, 4B2A16 are some examples of numbers in the
hexadecimal number system.
27
Lecturer : Najat Shyaa Jasim Subject : Computer Science
CONVERSIONS
OTHER To DECIMAL :
The following steps are sued to convert a number in any other base to a
base 10 (decimal) number
Step 2 : Multiply the obtained column values (in Step 1) by the digits in
the corresponding columns.
1- BINARY TO DECIMAL
28
Lecturer : Najat Shyaa Jasim Subject : Computer Science
Example 3:
= 16 + 0 + 4 + 0 + 1
= 21
2- OCTAL TO DECIMAL
Example 2
1024 + 0 + 40 + 7
= 1071
29
Lecturer : Najat Shyaa Jasim Subject : Computer Science
3-HEXADECIMAL TO DECIMAL
3840+64+12=391610
Example 2
Hence, 1AF16=43110
30
Lecturer : Najat Shyaa Jasim Subject : Computer Science
DECIMAL TO OTHER
1-DECIMAL TO BINARY:
31
Lecturer : Najat Shyaa Jasim Subject : Computer Science
2-DECIMAL TO OCTAL :
32
Lecturer : Najat Shyaa Jasim Subject : Computer Science
3-DECIMAL TO HEXADECIMAL :
33