0% found this document useful (0 votes)
6 views46 pages

Understanding Computer Number Systems

The document provides an overview of computer and data representation, focusing on various number systems including decimal, binary, octal, and hexadecimal. It explains the structure of these systems, their positional values, and methods for converting between them. Additionally, it covers Binary Coded Decimal (BCD) and its advantages for decimal calculations.

Uploaded by

nitch06
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)
6 views46 pages

Understanding Computer Number Systems

The document provides an overview of computer and data representation, focusing on various number systems including decimal, binary, octal, and hexadecimal. It explains the structure of these systems, their positional values, and methods for converting between them. Additionally, it covers Binary Coded Decimal (BCD) and its advantages for decimal calculations.

Uploaded by

nitch06
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

Computer and

Data
Representation
By: SHERWIN M. CAACBAY, MIT
ROVINA S. GUIYAB, MIT
Learning Objectives
01 Define the number system and identify
unit, number, base/radix, positional
notation, and most and least significant
digits as they relate to decimal, binary,
octal, and hexadecimal number systems.

Recognize different types of number


02 systems as they relate to computers

Convert values from decimal, binary, octal,


03 hexadecimal, and binary-coded decimal
number systems to each other and back to
the other systems.
D ATA
REPRESENTATION
✓ refers to the form in which data is
stored, processed, and transmitted.

✓ also refers to the internal method used


to represent various type of data
stored on a computer.
N U M B E R
S Y S T E M
✓ is the system of naming or ✓ It is the mathematical notation for
representing numbers. representing numbers of a given
✓ There are various types of number set by using digits or other
systems in math like binary, symbols in a consistent manner.
decimal, octal, etc. ✓ It provides a unique
✓ A number system is defined as a representation of every number
system of writing for expressing and represents the arithmetic and
numbers. algebraic structure of the figures.
D E C I M A L 01
S Y S T E M
✓ The term ‘decimal’ comes from the ✓ The number system that we use in
Latin word for ten. In the decimal our day-to-day life is the decimal
system, there are ten different number system.
numbers that enter the digit box:
“0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, ✓ Decimal number system has base
“8”, “9” 10 as it uses 10 digits from 0 to 9.
D E C I M A L 01
S Y S T E M
✓ In decimal number system, the ✓ For example, the decimal number
successive positions to the left of 1234 consists of the digit 4 in the
the decimal point represent units, units position, 3 in the tens
tens, hundreds, thousands, and position, 2 in the hundreds
so on. position, and 1 in the thousands
position.
✓ Each position represents a
specific power of the base (10).
D E C I M A L 01
S Y S T E M
✓ In decimal number system, the ✓ For example, the decimal number
successive positions to the left of 1234 consists of the digit 4 in the
the decimal point represent units, units position, 3 in the tens
tens, hundreds, thousands, and position, 2 in the hundreds
so on. position, and 1 in the thousands
position.
✓ Each position represents a
specific power of the base (10).
D E C I M A L 01
S Y S T E M
(1 x 103) + (2 x 102)+ (3 x 101)+ (4 x 100) The weightage of each position can
(1 x 1000) + (2 x 100)+ (3 x 10)+ (4 x 1) be represented as follows −
1000 + 200 + 30 + 4
1234
B I N A R Y 02
S Y S T E M
✓ Binary number system is also ✓ In any binary number, the rightmost
positional value system, where digit is called least significant bit
each digit has a value expressed (LSB) and leftmost digit is called
in powers of 2, as displayed here. most significant bit (MSB).
B I N A R Y 02
S Y S T E M
✓ Computer memory is measured in 1 byte (B) = 8 bits
terms of how many bits it can 1 Kilobyte (KB) = 1024 bytes
store. Here is a chart for memory 1 Megabyte (MB) = 1024 KB
capacity conversion. 1 Gigabyte (GB) = 1024 MB
1 Terabyte (TB) = 1024 GB
1 Exabyte (EB) = 1024 TB
1 Zettabyte = 1024 EB
1 Yottabyte (YB) = 1024 ZB
B I N A R Y 02
S Y S T E M
✓ In the binary system, there can be ✓ On is represented as 1 and off as
only two choices for this number. 0, though 0 is not actually no
signal but signal at a lower voltage.
✓ The easiest way to vary Each binary digit is also called a
instructions through electric bit.
signals is two-state system – on
and off.
O C T A L 03
S Y S T E M
✓ Octal maybe considered ✓ Octal number system is also a
“shorthand” for binary numbers. positional value system with
Three binary bits may represent where each digit has its value
each octal digit. expressed in powers of 8, as
shown here –
✓ Octal number system has eight
digits – 0, 1, 2, 3, 4, 5, 6 and 7.
O C TA L SYSTEM
Binary Octal
000 0
001 1
010 2
011 3
100 4
101 5
110 6
111 7
HEXADECIMAL 04
S Y S T E M
✓ has 16 symbols – 0 to 9 and A to ✓ Hexadecimal number system is
F where A is equal to 10, B is also a positional value system
equal to 11 and so on till F. with where each digit has its
value expressed in powers of 16,
as shown here −
HEXADECIMAL SYSTEM
HEXADECIMAL DECIMAL OCTAL BINARY
0 0 0 0000
1 1 1 0001
2 2 2 0010
3 3 3 0011
4 4 4 0100
5 5 5 0101
6 6 6 0110
7 7 7 0111
8 8 10 1000
9 9 11 1001
A 10 12 1010
B 11 13 1011
C 12 14 1100
D 13 15 1101
E 14 16 1110
F 15 17 1111
C O N V E R T I N G
D E C I M A L TO B I N A RY
Remainder
1234/2 = 617 0
617/2 = 308 1
308/2 = 154 0
154/2 = 77 0
77/2 = 38 1
38/2 = 19 0
19/2 = 9 1
9/2 = 4 1
4/2 = 2 0
2/2 = 1 0
1/2 = 0 1 Stop when the quotient is 0

Answer = 10011010010(base 2)
C O N V E R T I N G
D E C I M A L T O O C TA L
1234/8 = 154 2
154/8 = 19 2
19/8 = 2 3
2/8 = 0 2 Stop when the quotient
is 0

Answer = 2322 (base 8)


C O N V E R T I N G
DECIMAL TO HEXADECIMAL
1234/16 = 77 2
77/16 = 4 13 (D)
4/16 = 0 4 Stop when the quotient is 0

Answer = 4D2 (base 16)


C O N V E R T I N G
B I N A RY TO D E C I M A L
To convert a binary number (base 2) to a decimal (base
10), write the binary number in expanded notation, then
simplify. To write the number in expanded form, multiply
each digit by the value of its respected place value, and
then add the product.
Binary Place Value 32 16 8 4 2 1
Binary exponential 25 24 23 22 21 20
place values
C O N V E R T I N G
B I N A RY TO D E C I M A L
101102 = 1 * 24 + 0 * 23 + 1 * 22 + 1 * 21 + 0 * 20
=1 * 16 + 0 * 8 + 1 * 4 + 1 * 2 + 0 * 1
= 16 + 0 + 4 + 2 + 0
= 2210
C O N V E R T I N G
B I N A R Y T O O C TA L
To convert a binary Starting from the least significant bit,
01 make groups of three bits.
number to octal number,
these steps are followed
If there are one or two bits less in
02 making the groups, 0s can be added
after the most significant bit

03 Convert each group into its equivalent


octal number
C O N V E R T I N G
B I N A R Y T O O C TA L
1. Given a binary number 2. Convert 011000111101010:
such a 001010011100 can be
translated to: 011 000 111 101 010
3 0 7 5 2 base 8
001 010 011 100
1 2 3 4base 8
C O N V E R T I N G
BINARY TO HEXADECIMAL
To convert a binary Starting from the least significant bit,
01 make groups of four bits.
number to hexadecimal
number, these steps are
If there are one or two bits less in
followed: 02 making the groups, 0s can be added
after the most significant bit.
C O N V E R T I N G
BINARY TO HEXADECIMAL
1. Convert 1101101101012 2. Convert 011000111101010 2

1101 1011 0101 0011 0001 1110 1010


D B 5 base 16 3 1 E A base 16
C O N V E R T I N G
O C TA L T O B I N A R Y
It is also easy to covert Convert the decimal number to its 3bit
from an integer octal
01 binary equivalent.
number to binary. This is
Combine the 3 bit sections by
accomplished by: 02 removing the spaces.
C O N V E R T I N G
O C TA L T O B I N A R Y
Given an octal number such
5 6 7 1 2
as 56712 each of five digits
101 110 111 001 010
may be translated into three
binary bits as follows:
567128 = 1011101110010102
C O N V E R T I N G
O C TA L T O D E C I M A L
To convert from Octal to Using the value from the
Decimal, multiply the previous example, 567128 we
value in each position by could expect to obtain the
its octal weight and add decimal value 2401010.
each value.
C O N V E R T I N G
O C TA L T O D E C I M A L
Solution:
5*84 6*83 7*82 1*81 2*80
5*4096 6*512 7*64 1*8 2*1

20480 3072 448 8 2

Answer= 24,010 (base 10)


C O N V E R T I N G
OCTAL TO HEXADECIMAL
01 Convert first to binary 5 6 7 1 2
101 110 111 001 010
02 After that, get the binary
value and group it by four 0101 1101 1100 1010
5 13 12 10
to get the hexadecimal
value 567128 = 5DCA16
C O N V E R T I N G
HEXADECIMAL TO BINARY
It is also easy to convert Convert the Hexadecimal number to
from an integer
01 its binary equivalent
hexadecimal number to
Combine the 4-bit sections by
binary. This is 02 removing the spaces.
accomplished by:
Example: 0AFB2 will be written:
A F B 2
1010 1111 1011 0010
C O N V E R T I N G
HEXADECIMAL TO DECIMAL
To convert from hexadecimal, Using the value from previous
multiply the value in each example, 0AFB2
position by its hexadecimal
A*163 F*162 B*161 2*160
weight and add each value. 10* 4096 15*256 11*16 2*1
40960 3840 176 2
Answer = 40960 + 3840 + 176 + 2 → 44978
C O N V E R T I N G
HEXADECIMAL TO OCTAL
You need to convert first
01 the hexadecimal value to
0 A F B 2
0000 1010 1111 1011 0010
binary.
Separate them into three 001 010 111 110 110 010
02 1 2 7 6 6 2
binary bits to get the octal
value 0AFB216 = 1276628
BINARY CODED
DECIMAL (BCD)
✓ is an encoding for decimal ✓ Its main virtue is that it
numbers in which each allows easy conversion
digit is represented by its to decimal digits for
own binary sequence. printing or display and
faster decimal
calculations.
BINARY CODED
DECIMAL (BCD)
✓ In BCD, a digit is usually ✓ To BCD – encode a
represented by four bits decimal number using the
which, in general, common encoding, each
represent the values/ digits/ decimal digit is stored in a
characters 0-9. four – bit nibble.

Decimal: 0 1 2 3 4 5 6 7 8 9
BCD: 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001
D E C I M A L TO ( B C D )
C O N V E R S I O N
✓ So for example, 35710 (Three Hundred and Fifty Seven)
in decimal would be presented in Binary Coded Decimal
as:
35710 = 0011 0101 0111 (BCD)
DECIMAL TO BCD
C O N V E R S I O N
✓ Using the above table, convert the following decimal
(denary) numbers: 8510, 57210 and 857910 into their BCD
equivalents.

8510 = 1000 0101 (BCD)


57210 = 0101 0111 0010 (BCD)
857910 = 1000 0101 0111 1001 (BCD)
BCD TO DECIMAL
C O N V E R S I O N
✓ The conversion from binary coded decimal to decimal is
the exact opposite of the above. Simply divide the binary
number into groups of four digits, starting with the least
significant digit and then write the decimal digit
represented by each 4-bit group.
BCD TO DECIMAL
C O N V E R S I O N
✓ Convert the following binary numbers: 10012 and
10001112 into their decimal equivalents.

10012 = 1001BCD = 910

10001112 = 0100 0111BCD = 4710


ASCII CODE
✓ American Standard Code for ✓ The original ASCII standard
Information Interchange, or ASCII defines different characters
code. within seven bits – seven digits
that indicate either a 0 or a 1.
✓ is a standard used to represent
characters on electronic devices. ✓ The ASCII characters can be
divided into several groups.
ASCII CHARACTERS
Control Characters (0–31 & 127): Control
characters are not printable characters. They are
01 used to send commands to the PC or the printer and
are based on telex technology. With these characters,
you can set line breaks or tabs. Today, they are
mostly out of use.
Special Characters (32–47 / 58–64 / 91–96 / 123–
02 126): Special characters include all printable
characters that are neither letters nor numbers.
These include punctuation or technical, mathematical
characters.
ASCII CHARACTERS
Numbers (30–39): These numbers include
03 the ten Arabic numerals from 0-9.

Letters (65–90 / 97–122): Letters are divided


04 into two blocks, with the first group containing
the uppercase letters and the second group
containing the lowercase.
ASCII CHARACTERS
Symbol ASCII
ñ (énye, n with tilde) alt + 164
■ (black square) alt + 254
² or 3 (superscript two, square and alt + 252 and alt +253
cube)
° (degree symbol) alt + 248
'(apostrophe, single quote alt + 39
µ (letter Mu, micro, micron) alt + 230
© (copyright symbol) alt + 184
® (registered trademark) alt + 169
½ (one half) alt + 171
¼ alt + 172
¾ alt + 243
ƒ alt + 159
± alt + 241
× alt + 158
÷ alt + 246
ASCII CHARACTERS
For example: Since computer can only read a binary
number, lets convert and get the binary equivalent of
enye(ñ) with the given ascii code alt + 164. Let’s go back to
our previous decimal to binary conversion. Using the value
we could expect to obtain the decimal value 1010 0100 for
binary and A4 in Hexadecimal value
ASCII CONVERSION
Remainder
164/2 = 82 0
82/2 = 41 0
41/2 = 20 1
20/2 = 10 0
10/2 = 5 0
5/2 = 2 1
2/2 = 1 0
1/2 = 0 1 Stop when the quotient is 0
Answer = 1010 0100 (base 2)
ASCII CODE
CHARACTERS
The complete alphanumeric
code typically includes −

✓ 26 upper case letters


✓ 26 lower case letters
✓ 10 digits
✓ 7 punctuation marks
✓ 20 to 40 special characters
REFERENCES

✓ “[Link]
_number_system.htm
✓ [Link]
knowledge/basics-of-computers/number-systems/
✓ [Link]

You might also like