0% found this document useful (0 votes)
14 views27 pages

Number Systems

The document provides an overview of various number systems, including decimal, binary, octal, and hexadecimal, explaining their bases and representations. It details how to convert between these systems and introduces scientific notation and ASCII code for character representation. Additionally, it discusses the significance of bits in determining the size of character sets, including Extended ASCII and Unicode.

Uploaded by

Yash Soni
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)
14 views27 pages

Number Systems

The document provides an overview of various number systems, including decimal, binary, octal, and hexadecimal, explaining their bases and representations. It details how to convert between these systems and introduces scientific notation and ASCII code for character representation. Additionally, it discusses the significance of bits in determining the size of character sets, including Extended ASCII and Unicode.

Uploaded by

Yash Soni
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/ 27

Number Systems

Decimal and Binary


Representation
o The number system we normally use is the decimal
system.
o It uses 10 as the base.
o But a number system can use any base.
o Computers work with the binary system (base 2).
o Other systems used with computers are octal (base 8)
and hexadecimal (base 16).
The Decimal System
The first eight columns of the decimal system

107 106 105 104 103 102 101 100

10,000,000 1,000,000 100,000 10,000 1,000 100 10 1

hundred-
ten-millions millions ten-thousands thousands hundreds tens ones
thousands
Expanded Notation
• The ten digits that are used in the decimal system are 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
• Any number in the decimal system can be written as a sum of each digit multiplied by the
value of its column. This is called expanded notation.
• The number 6,825 in the decimal system actually means:
5*100 = 5*1 = 5
+ 2*101 = 2*10 = 20
+ 8*102 = 8*100 = 800
+ 6*103 = 6*1,000 = 6,000
6,825
Therefore, 6,825 can be expressed as: 6*103 + 8*102 + 2*101 + 5*100
The Binary System

The first eight columns of the binary system

Power of 2 27 26 25 24 23 22 21 20

Decimal value 128 64 32 16 8 4 2 1

Binary representation
Converting the Decimal Number 2910 to Binary
• Use the table

Power of 2 25 24 23 22 21 20
Decimal value 32 16 8 4 2 1
Binary representation 0 1 1 1 0 1
Converting the Decimal Number 17210 to Binary
• Use the table

Power of 2 27 26 25 24 23 22 21 20
Decimal value 128 64 32 16 8 4 2 1
Binary
1 0 1 0 1 1 0 0
representation
Converting Binary to Decimal
• To convert a binary number back to decimal, just add the value of each
binary column.
Convert the binary number 10112 to decimal
o

Power of 2 27 26 25 24 23 22 21 20
Decimal value 128 64 32 16 8 4 2 1
Binary
representation
Convert the Binary Number 101010102 to Decimal

• -
The Hexadecimal System
• The hexadecimal system uses a base of 16.
• The hexadecimal system makes it easier for humans to read binary
notation.
The Hexadecimal System

The first five columns of the hexadecimal system

Hexadecimal
column
164 163 162 161 160

16*16*16*16 16*16*16 16*16 16 1

Decimal equivalent 65,536 4,096 256 16 1


Hexadecimal Digits
o Hexadecimal digits are 0 through 9 and A through F
• 1010 is represented as A16
• 1110 is represented as B16
• 1210 is represented as C16
• 1310 is represented as D16
• 1410 is represented as E16
• 1510 is represented as F16
Converting the Hexadecimal Number 123D16 to Decimal
• -

Power of 16 163 162 161 160


Decimal value 4096 256 16 1
Hexadecimal representation 1 2 3 D
Converting the Hexadecimal Number 123D16 to Decimal
• In expanded notation, this hexadecimal number is:
(1*4096) + (2*256) + (3*16) + (D*1)
• D in hexadecimal is 13 in decimal, so:
4096 + 512 + 48 + 13 = 4669
• Therefore, 123D16 = 466910

Power of 16 163 162 161 160


Decimal value 4096 256 16 1
Hexadecimal representation 1 2 3 D
Using Hexadecimal Notation

Decimal Binary Hexadecimal Decimal Binary Hexadecimal


0 0000 0 8 1000 8
1 0001 1 9 1001 9
2 0010 2 10 1010 A
3 0011 3 11 1011 B
4 0100 4 12 1100 C
5 0101 5 13 1101 D
6 0110 6 14 1110 E
7 0111 7 15 1111 F
Using Hexadecimal Notation
• It is common to write a long binary number in hexadecimal notation.
• Convert the following binary number to hexadecimal notation:
11101010000011112
Using Hexadecimal Notation
• It is common to write a long binary number in hexadecimal notation.
• The 15 hexadecimal digits represent all combinations of a 4-bit binary number.
• Convert the following binary number to hexadecimal notation:
11101010000011112
1. Separate the binary number into sets of 4 digits:
1110 1010 0000 1111
2. Refer to the table, if necessary, to make the conversions
11102 = E16
10102 = A16
00002 = 016
11112 = F16
• Therefore, 11101010000011112 is EA0F16
Integers Representation

Store the decimal integer 510 in an 8- Store the decimal integer 92810 in a 16-
bit memory location: bit memory location:

Unsigned Binary Integers

Store the decimal integer 510 in an 8- Store the decimal integer 92810 in a 16-
bit memory location: bit memory location:

• Convert 510 to binary: 1012 • Convert 92810 to binary:


11101000002
• Add five 0s to the left to make 8 bits:
• Add six 0s to the left to make 16 bits:
000001012
00000011101000002
Scientific Notation
• Computers are used for many scientific applications which often use very large or
very small numbers.
• Example: the distance from Earth to our nearest star is 24,698,100,000,000
miles. We would need a 49-digit binary number to represent this in a computer.
• Example: The diameter of an atom would require at least a 30-digit binary
number.
• Humans deal with these almost-impossible-to-read numbers with scientific
notation.
Examples of Scientific Notation
In scientific notation, a given number is written as a number between 1
and 9 multiplied by the appropriate power of 10.
Examples:
• 680,000 =
• 1,502,000,000 =
• 8,938,000,000,000 =
• 0.068 =
• 0.00001502 =
• 0.000000000008938 =
Examples of Scientific Notation
In scientific notation, a given number is written as a number between 1
and 9 multiplied by the appropriate power of 10.
Examples:
• 680,000 = 6.8×105
• 1,502,000,000 = 1.502×109
• 8,938,000,000,000 = 8.938×1012
• 0.068 = 6.8×10–2
• 0.00001502 = 1.502×10–5
• 0.000000000008938 = 8.938×10–12
ASCII Code

 A programming language uses a scheme to associate each character with a number.


 The standard is the American Standard Code for Information Interchange (ASCII
code).
 All data, including characters, are stored in the computer’s memory in binary form.
 It is pronounced “askey.”
 Each character is associated with a number from 0 to 127.
Examples:
Uppercase A is 65
Uppercase Z is 90
Digits have codes from 48 (“0”) to 57 (“9”)
Character Sets
One well known character set is For example, the
ASCII (“American Standard Code symbol ‘@’ is 64 as an
for Information Interchange”): integer, and hence
1000000 in binary.
Number of bits vs number of possible characters
It is important that you understand how many different integers can be
represented by a given number of bits. This in turn gives us the size of the
character set.
Recall that bits allows us to
represent different integer values.

 Bits per Character set size Character set


character name
7 ASCII
8 Extended ASCII
16 or 32 UnicodeTM
Extended ASCII
By going from 7 bits ( possible characters) to 8 bits ( ), we double
the number of available characters!
UnicodeTM
This still excludes a lot of symbols you might expect…
Unicode contains pretty much every symbol you might contemplate existing,
including Braille, a variety of international alphabets, all standard mathematics
symbols. Even chess symbols!

You might also like