Chapter 1 Number conversions student version

# Chapter 1 Number conversions student version - EC262 Topic...

This preview shows pages 1–4. Sign up to view the full content.

1 EC262 Topic 1. Number Conversions Decimal Integers and Decimal Notation The decimal number system has 10 digits (0, 1, 2, 3,…8, 9). Since it is based on 10 distinct symbols, we say the base is 10. In decimal notation, we write a number as a string of these ten digits. To interpret a decimal number, we multiply each digit by the power of 10 associated with that digit’s position. Example: Consider the decimal number: 6349. This number is: 6 3 4 9 = Why do we use the decimal system, as opposed to, say, a system based on nine or thirteen digits? The Binary Number System The binary number system has two digits (0 and 1). Since it is based on 2 distinct symbols, we say the base is 2. Just as with decimal notation, we write a number as a string of digits, but now each digit is 0 or 1. To interpret a binary number, we multiply each digit by the power of 2 associated with that digit’s position. Example: Consider the binary number 1011. This number is: 1 0 1 1 = Since we know and love the decimal system, why do we need to care about binary? And why is that? Bottom line: You need to be able to readily shift between binary and decimal number representations. Converting a binary number to a decimal number To convert a binary number to a decimal number, write the binary number as a sum of powers of 2. Example: Express the binary number 1011 as a decimal number. Note: We must be careful that the base is understood. When we say “11” as the answer to the example above, we mean the number 11 in base 10, not the number 11 in base 2. If the base is not clear from the context, it can be made explicit by including the base as a subscript as in: 1011 11 2 10 = Example: Express the binary number 110110 as a decimal number.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Converting a decimal integer to a binary number Method 1. Express the decimal number as a sum of powers of 2. To do this: i. Find the highest power of two less than or equal to the decimal number. The binary representation will have a one in this position. ii. Now subtract this power of two from the original decimal number. iii. If this new decimal number is zero, we’re done. Otherwise return to step i. above. Example: Convert the decimal number 78 to binary. Think to yourself: Self, what is the largest power of 2 that is less than or equal to 78. So, the binary representation of 78 will have ____________ ___________ ____________ ___________ __________ _________ ________ 6 2 64 = 5 2 32 = 4 2 16 = 3 28 = 2 24 = 1 22 = 0 21 = What is the largest power of 2 that is less than or equal to Answer: ____________ ___________ ____________ ___________ __________ _________ ________ 6 2 64 = 5 2 32 = 4 2 16 = 3 = 2 = 1 = 0 = What is the largest power of 2 that is less than or equal to Answer: ____________ ___________ ____________ ___________ __________ _________ ________ 6 2 64 = 5 2 32 = 4 2 16 = 3 = 2 = 1 = 0 = Now, subtracting 4 from our number 6 gives 642 −= . Thus, 2 is now the number we are working with. What is the largest power of 2 that is less than or equal to 2? ____________ ___________ ____________ ___________ __________ _________ ________ 6 2 64 = 5 2 32 = 4 2 16 = 3 = 2 = 1 = 0 = Now, subtracting 2 from our number 2 gives 0, so we are done. Filling in the zeros, we have our answer: The decimal number 78 in binary is ____________ ___________ ____________ ___________ __________ _________ ________ 6 2 64 = 5 2 32 = 4 2 16 = 3 = 2 = 1 = 0 =
3 Example: Convert the decimal number 201 to binary.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 12

Chapter 1 Number conversions student version - EC262 Topic...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online