0% found this document useful (0 votes)
10 views24 pages

Intro Week4

Uploaded by

alknh3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views24 pages

Intro Week4

Uploaded by

alknh3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

INTRODUCTION TO COMPUTER ENGINEERING

WEEK-4
DR. İDRIS KAHRAMAN
NUMBER SYSTEMS
WHY WE NEED?
REPRESENTİNG DATA

 External representation: (for people) to use data easily, data must be


represented (visually, graphically, ...) on paper or on some other directly
useable media.

 Internal representation: (for computing machines) to support storage


and computation, data must be represented as a sequence of 0's and 1's.
WHY DO WE NEED VARIOUS NUMBER SYSTEMS IN COMPUTER SCIENCE?

 Computers cannot understand human languages. So, to process commands and instructions given by
programmers, they use different systems typically known as number systems.
 The most widely used number systems are:
Binary
Octal
Decimal
Hexadecimal

 All of these are equally important. In the article below, you will learn what these numbers are and some of their
applications.
REPRESENTING NUMERIC DATA (EXTERNALLY)
POSİTİONAL NOTATİON

 For representing data externally, the most commonly used number systems:

Number System Radix (base) Digits used


Decimal 10 0123456789
Binary 2 01
Octal 8 01234567
Hexadecimal 16 0123456789
ABCDEF
BINARY SYSTEM

 Binary system aka Base-2 number system is used by computers to operate. All the data stored in a computer consists of
binary numbers. It is the most widely used system.
 Binary consists of two units 0 and 1, known as bit. Individually the 0 bit means NO (False) while 1 bit means YES (True).
 These bits are combined in a group of 8 bits, to represent multiple characters and values. One byte can represent 256
values depending on its arrangement of bit units.
 Binaries are stored in computer data as “Machine code”. This way its CPU can execute programs set by the computer
scientists.
 Usage area
 It can be used to represent pixels of an image.
 It also used to represent On and OFF in a circuit.
 True and False statements.
OCTAL NUMBER SYSTEM

 Base-8 is a number system that has 8 as the radix. The 8 digits used in this system are 0, 1, 2, 3, 4, 5, 6,
7. All of these representations can be arranged variously to make more octal representations.
 The octal number system is a little confusing and needs the practice to understand it completely. An
Octal number is usually expressed with 8 as subscript e.g..
 Computers cannot read octal numbers directly. That’s why they are converted into binary first.
 In octal numbers, digits above 7 are represented differently. For example, 8 is represented as 10 which
is actually 1 + 0, not the decimal 10. To clarify it even more.
 Usage area
 In UNIX
 Computing graphics
 File Protection
OCTAL ENCODING

Bit pattern Octal


representation
000 0
001 1
010 2
011 3
100 4
101 5
110 6
111 7
DECIMAL SYSTEM

 The decimal system aka the Base-10 system is the number system with which almost every human is familiarized.
Even an uneducated person can understand this system.
 The reason is that we use it in daily life in finance, counting e.t.c. The numbers used in the denary system are 0,
1, 2, 3, 4, 5, 6, 7, 8, 9.
 In the denary system, the significance of each number increases by 10 times as we move from right to left. E.g in
the number 56, 5 is 10 times more valuable than the number 6.
 Usage area
 Finance
 Calendar
 Counting
HEXADECIMAL SYSTEM

 The last and the most complex number system is the hexadecimal system. It is difficult to learn as compared to other
number systems.
 This number system makes several things convenient such as the representation of bytes. Only 2 hexadecimal numbers
are required to represent an 8-bit byte of binary numbers.
 It is also known as base-16 and the digits and alphabets used in this system are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
 The alphabet A represents decimal number 10, B represents decimal number 11, and so on.
 Usage area
 Memory locations
 De-bugging
 Color Coding: In web development and graphic design, colors are represented in RGB format, usually in hexadecimal. For example,
the color white is represented as #FFFFFF and the color black as #000000.
 IpV6
 Memory Addressing: Used to represent the memory addresses of computers because it offers a more compact representation than
the binary number system. One hexadecimal digit corresponds to four binary digits.
HEXADECIMAL NOTATION

 The hexadecimal system is a counting system using base 16 (c.f.


decimal, which uses base 10 -see later notes)
 Hexadecimal notation = a shorthand notation for streams of bits.
 Stream = a long string of bits.
 Long bit streams are difficult to make sense of.
 The lengths of most bit streams used in a machine are multiples of four.
 Hexadecimal notation is more compact.
 Less error-prone to manually read, copy, or write
DECODING THE BINARY REPRESENTATION

Decoding the
binary
representation
100101
BINARY REPRESENTATION OF A POSITIVE INTEGER
BINARY REPRESENTATION OF 13
THE BINARY ADDITION FACTS
DECIMAL ADDITION

Addition in base 10: • We start with a carry value


1 8 0 9 of 0.
+ 0 3 2 3 • Whenever the sum gets
2 1 3 2 larger than 9, we add 1 to
• • (carry) the carry.
• The carry is added at the
next position.
BINARY ADDITION

Addition in base 2:
1 1 0 1 • We start with a carry value of
+ 0 1 0 1 0.
10 0 1 0 • Whenever the sum gets
• • • (carry) larger than 1, we add 1 to
the carry.
• The carry is added at the next
position.
FRACTIONS IN BINARY

 Decoding the
binary
representation
101.101
DECIMAL TO BINARY
DECIMAL TO OCTAL-HEXADECIMAL
TO DECIMAL
BINARY TO DECIMAL
TO BINARY
OCTAL TO HEXADECIMAL / HEXADECIMAL TO OCTAL

You might also like