0% found this document useful (0 votes)
19 views12 pages

Ch1 - Number System - Part2 Decimal To Binary VV

The document discusses binary numbers and how to convert between binary and decimal. It explains that binary only uses the digits 0 and 1 and defines the base-2 system. It then provides examples of how to determine the value of place values in binary numbers and how to convert binary numbers to decimal through addition. Finally, it discusses two methods for converting a decimal number to binary - dividing the decimal by 2 and recording remainders or subtracting out the largest power of 2 at each step.

Uploaded by

geranof579
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)
19 views12 pages

Ch1 - Number System - Part2 Decimal To Binary VV

The document discusses binary numbers and how to convert between binary and decimal. It explains that binary only uses the digits 0 and 1 and defines the base-2 system. It then provides examples of how to determine the value of place values in binary numbers and how to convert binary numbers to decimal through addition. Finally, it discusses two methods for converting a decimal number to binary - dividing the decimal by 2 and recording remainders or subtracting out the largest power of 2 at each step.

Uploaded by

geranof579
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/ 12

 So in a computer, the only possible digits we can use to

encode data are {0,1}


 The numbering system that uses this set of digits is the
base 2 system (also called the Binary Numbering
System)

 We can apply all the principles of the base 10 system to


the base 2 system

Position weights 24 23 22 21 20
digits 1 0 1 1
 How is a positive integer represented in binary?
 Let’s analyze the binary number 110:
110 = (1 x 22) + (1 x 21) + (0 x 20)
= (1 x 4) + (1 x 2) + (0 x 1)

Position weights 22 21 20
Number digits 1 1 0
0 x20 = 0 +
1 x21 = 2 +
1 x 22 = 4
6

 So a count of SIX is represented in binary as 110


 To convert a base 2 (binary) number to base
10 (decimal):
 Add all the values (positional weights)
where a one digit occurs
 Positions where a zero digit occurs do
NOT add to the value, and can be
ignored
Example: Convert binary 100101 to decimal
(written 1 0 0 1 0 12 ) =
1*20 1
0*21 0
1*22 4
0*23 0
0*24 0
1*25 +32
3710
 Example #2: 101112

positional powers of 2: 2 4 23 22 2 1 20
decimal positional value: 16 8 4 2 1

binary number: 1 0 1 1 1

16 +0+ 4 + 2 + 1 = 2310
 Example #3: 1100102

positional powers of 2: 25 24 23 22 21 20
decimal positional value: 32 16 8 4 2 1

binary number: 1 1 0 0 1 0

32+16 +0+0 +2 + 0 = 5010


1) Start with your number (call it N) in base 10
2) Divide N by 2 and record the remainder
3) If (quotient = 0) then stop
else make the quotient your new N, and go back to step 2
The remainders comprise your answer, starting with the last
remainder as your first (leftmost) digit.

In other words, divide the decimal number by 2 until you reach


zero, and then collect the remainders in reverse.
Divide decimal number by 2 until you reach zero, and then
collect the remainders in reverse.
Example 1: 2210 = 101102
2 ) 22 Rem:
2 ) 11 0
2) 5 1
2) 2 1
2) 1 0
0 1
Example 2: 5610 = 1110002

2 ) 56 Rem:
2 ) 28 0
2 ) 14 0
2) 7 0
2) 3 1
2) 1 1
0 1
Subtract out largest power of 2 possible
(without going below zero), repeating until you
reach 0.
 Place a 1 in each position where you COULD subtract the value
 Place a 0 in each position that you could NOT subtract out the value
without going below zero.
Example 1: 2110

21 26 25 24 23 22 21 20
64 32 16 8 4 2 1
- 16
5 1 0 1 0 1
- 4
1
- 1 Answer: 2110 = 101012
0
Example 2: 5610

56 2 6 | 2 5 2 4 2 3 22 2 1 2 0
- 32 64| 32 16 8 4 2 1
24 |1 1 1 0 0 0
- 16
8
- 8 Answer: 5610 = 1110002
0

You might also like