0% found this document useful (0 votes)
27 views35 pages

Lec 2 NumberSystems I

This document discusses number systems and provides examples of converting between decimal and binary numbers. It explains that computers use binary and numbers are represented by strings of 0s and 1s. Decimal is the base-10 system we use in everyday life, while binary is base-2 using only 0s and 1s. The document shows how to convert a decimal number to binary using repeated division by 2 and vice versa by multiplying place values. Applications of both systems are also covered.

Uploaded by

ilyhafa
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)
27 views35 pages

Lec 2 NumberSystems I

This document discusses number systems and provides examples of converting between decimal and binary numbers. It explains that computers use binary and numbers are represented by strings of 0s and 1s. Decimal is the base-10 system we use in everyday life, while binary is base-2 using only 0s and 1s. The document shows how to convert a decimal number to binary using repeated division by 2 and vice versa by multiplying place values. Applications of both systems are also covered.

Uploaded by

ilyhafa
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/ 35

Lecture 02: Number Systems

Instructor: Mehwish Ghafoor


[email protected]
Number Systems
• Computers understand machine language.
• Every letter, symbol etc. that we write in the instructions given to computer, it gets
converted into machine language.
• This machine language comprises of numbers.

• Number systems can be classified into its sub-types based on the base of
that system.
• Base of a number system plays crucial role in understanding the number system and
to convert it from one sub-type to other sub-type.

2
Number Systems

Base is identified based on To find the value of digit in a


the number of digits in particular number system, three
components are required:
that number system.
For a number to exist in a given base, it can - The digit itself.
only contain the digits in that base, which - Position of the digit in a particular number.
range from 0 up to (but not including) the
base. - Base of the number system.

3
Classification of Number Systems

• Base is defined as the total number of digits available in


the number system.
• What bases can these numbers be in? 122, 198, 178
4
Decimal system
• The number system that we use in our day-to-day life is the decimal number
system.

• Decimal number system has base 10 as it uses 10 digits from 0 to 9.

• In decimal number system, the successive positions from right to left


represent units, tens, hundreds, thousands and so on.

• Each position represents a specific power of the base (10).

5
Decimal System: Positional Notation

642 in base 10 positional notation is:

6 x 102 = 6 x 100 = 600


+ 4 x 101 = 4 x 10 = 40
+ 2 x 100 = 2 x 1 = 2 = 642 in base 10

6
Decimal System: Positional Notation

642 in base 10 positional notation is:

6 x 102 = 6 x 100 = 600


+ 4 x 101 = 4 x 10 = 40
+ 2 x 100 = 2 x 1 = 2 = 642 in base 10

The power indicates


This number is in the position of
base 10 the number
7
Decimal System: Positional Notation
• The decimal number 1234 consists of:
o digit 4 in the units position,
o 3 in the tens position,
o 2 in the hundreds position,
o 1 in the thousands position, and its value can be written
as
(1×1000) + (2×100) + (3×10) + (4×l)
=(1×10 ) + (2×10 ) + (3×10 ) + (4×l0 )
3 2 1 0

=1000 + 200 + 30 + 1
= 1234

8
Decimal system

9
Applications of Decimal Number System
Daily Counting and Arithmetic:
• The decimal system is the most common way of counting and performing
arithmetic operations in our everyday lives.
• It's used for tasks like counting money, keeping track of quantities, and
performing calculations.
Measurement Units:
• Decimal numbers are used to represent measurement units, such as length,
weight, volume, and time.
• These measurements play a crucial role in fields like construction, science,
engineering, and cooking.

10
Applications of Decimal Number System
Currency and Finance:
• The decimal system is used to represent currency values, making it possible to
handle transactions, accounting, and financial calculations.
Education and Mathematics:
• The decimal system is fundamental to teaching and learning mathematics,
providing a clear way to explain place value and mathematical operations.
Scientific Notation:
• Decimal numbers are often used in scientific notation, where numbers are
expressed as a product of a decimal value and a power of 10.
• This notation simplifies representation of very large or very small numbers
encountered in fields like astronomy and physics.

11
Applications of Decimal Number System
Digital Clocks and Watches:
• Digital time displays use decimal digits to represent hours, minutes, and
seconds.
• This allows for precise timekeeping and ease of reading.
Calendars and Dates:
• The decimal system helps represent dates and time in months, days, and
years.
• It's used to manage schedules, appointments, and events.

12
Applications of Decimal Number System
Public Transportation:
• Timetables, schedules, and ticket prices are often represented using
decimal numbers for easy comprehension by the general public.
Commercial Transactions:
• Decimal numbers play a role in pricing, discounts, taxes, and other
financial aspects of buying and selling goods and services.
Medicine and Dosage:
• Decimal numbers are used to prescribe and administer medicine,
calculate dosages, and manage patient records.

13
Binary Number System
• Uses two digits, 0 and 1.

• Also called base 2 number system

• First position (from right) in a binary number represents a power of the


base (2). Example: 20

• Last position in a binary number represents an x power of the base (2).


Example: 2x where x represents the last position.

14
Converting Binary to Decimal
Example
Binary Number: 101012
Calculating Decimal Equivalent

Step Binary Number Decimal Number


4 3 2 1 0
Step 1 101012 ((1 × 2 ) + (0 × 2 ) + (1 × 2 ) + (0 × 2 ) + (1 × 2 ))10
Step 2 101012 (16 + 0 + 4 + 0 + 1)10
Step 3 101012 2110

Note: (10101)2 can also be written as 10101

15
Converting Binary to Decimal
What is the decimal equivalent of the binary number (1101110)2?

1 x 26 = 1 x 64 = 64
+ 1 x 25 = 1 x 32 = 32
+ 0 x 24 = 0 x 16 =0
+ 1 x 23 = 1x8 =8
+ 1 x 22 = 1x4 =4
+ 1 x 21 = 1x2 =2
+ 0 x 2º = 0x1 =0
= 110 in base 10

16
Converting Binary to Decimal
• Can you figure the decimal values for
these binary values?
• 11
• 101
• 110
• 1111
• 11011

17
Converting Binary to Decimal

• Here are the answers:


• 11 is 3 in base ten
• 101 is (5)10
• 110 is (6)10
• 1111 is (15)10
• 11011 is (27)10

18
Converting Decimal to Binary
• Convert decimal numbers to binary by repeated division by 2 and
noting remainders.
• Example: Convert 27 to binary:
• 27 ÷ 2 = 13 remainder 1, 2 27
• 13 ÷ 2 = 6 remainder 1, 2 13- 1
• 6 ÷ 2 = 3 remainder 0, 2 6 -1
• 3 ÷ 2 = 1 remainder 1. 2 3 -0
• 1 ÷ 2 = 0 remainder 1. 2 1- 1
• So, 27 in binary is 11011. 0 -1

19
Example
• Can you figure the binary values for these decimal values?
• 42
• 78
• 135

20
78 135
42
2 39 0 2 67 1
2 21 0
2 19 1 2 33 1
2 10 1
2 9 1 2 16 1
2 5 0
2 4 1 2 8 0
2 2 1
2 2 0 2 4 0
2 1 0
2 1 0 2 2 0
0 1
0 1 2 1 0
0 1

Binary: 101010 Binary: 1001110 Binary: 10000111

21
Example: To Do
• Decimal to Binary
• 89
• 31
• Binary to Decimal
• 1011
• 10001
• 1100

22
Example
• Decimal to Binary
• 89 -> 1011001
• 31 -> 11111
• Binary to Decimal
• 1011 -> 11
• 10001 -> 17
• 1100 -> 12

23
Applications of Binary System
• Binary in Computing:
• Computers use binary as their fundamental language due to the
simple representation of on/off states in electronic circuits.
• All data in computers, including text, images, and sound, are
ultimately represented in binary.
• Binary Arithmetic:
• Addition and subtraction in binary are similar to decimal, but with
carry and borrow rules.
• Multiplication and division are often more complex in binary,
involving shifts and bitwise operations.

24
Applications of Binary System
• Real-world Applications:
• Binary-coded information in barcodes, QR codes, and identification
numbers.
• Digital display technologies using segments that can be turned on/off (e.g.,
7-segment displays).
• Communication systems relying on binary signals for data transmission.
• Advantages of Binary:
• Simplicity of representation using only two symbols.
• Well-suited to electronic circuitry, where on/off states are easily
distinguishable.
• Easy conversion between binary and other number systems using powers
of 2.
25
Applications of Binary System
• Challenges:
• Longer representation compared to decimal for the
same values.
• Human readability can be challenging for longer
binary numbers.
• Performing manual arithmetic operations can be
more complex.

26
Octal Number System
• Uses eight digits, 0,1,2,3,4,5,6,7.

• Also called base 8 number system

• First position (from right) in an octal number represents a 0 power of the


base (8). Example: 80

• Last position in an octal number represents an x power of the base (8).


Example: 8x where x represents the last position.

27
Octal to Decimal
Example
Octal Number − 125708
Calculating Decimal Equivalent −

Step Octal Number Decimal Number


4 3 2
Step 1 125708 ((1 × 8 ) + (2 × 8 ) + (5 × 8 ) + (7
1 0
× 8 ) + (0 × 8 ))
Step 2 125708 (4096 + 1024 + 320 + 56 +0)
Step 3 125708 (5496)10

Note: (12570)8 can also be written as 12570.

28
Octal to Decimal
• Can you figure the decimal values for these octal values?
• 156
• 270
• 1164
• 2105

29
Octal to Decimal
• Here are the answers:
• 156 is (110)10
• 270 is (184)10
• 1164 is (628)10
• 2105 is (1093)10

30
Bases Higher than 10
How are digits in bases higher than 10 represented?

With distinct symbols for 10 and above.

Base 16 has 16 digits:


0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, and F

31
Hexadecimal Number System
• Uses 10 digits and 6 letters
• Letters represents numbers starting from 10:
• A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
• Also called base 16 number system.
• First position in a hexadecimal number represents a 0 power of the base
(16). Example 160.
• Last position in a hexadecimal number represents an x power of the base
(16). Example 16x where x represents the last position.

32
Hexadecimal to Decimal
Example −
Hexadecimal Number: 19FDE16
Calculating Decimal Equivalent −
.
Step Hexadecimal Number Decimal Number
4 3 2
Step 1 19FDE16 ((1 × 16 ) + (9 × 16 ) + (F × 16 )
1 0
+ (D × 16 ) + (E × 16 ))
4 3 2
Step 2 19FDE16 ((1 × 16 ) + (9 × 16 ) + (15 × 16 )
1 0
+ (13 × 16 ) + (14 × 16 ))
Step 3 19FDE16 (65536 + 36864 + 3840 + 208 +
14)
Step 4 19FDE16 (106462)10

Note − 19FDE16 is normally written as 19FDE

33
Hexadecimal to Decimal
• Can you figure the decimal value for these
hexadecimal values?
• 2A
• 15F
• A7C
• 11BE
• A10D

34
Hexadecimal to Decimal
• Here are the answers:
• 2A is 42 in base 10
• 15F is (351)10
• A7C is (2684)10
• 11BE is (4542)10
• A10D is (41229)10

35

You might also like