3 Representing Numbers HOF 2.pdf

# 3 Representing Numbers HOF 2.pdf - Conversions between...

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

EECS 1520 – Week 3.2 September 21, 2017 page 1 Conversions between Decimal and Binary Binary to Decimal Technique - use the definition of a number in a positional number system with base 2 - evaluate the definition formula (“the formula”) using decimal arithmetic Example 543210 position = corresponding power of 2 |||||| 101011 = 1 × 2 5 + 0 × 2 4 + 1 × 2 3 + 0 × 2 2 + 1 × 2 1 + 1 × 2 0 = 43 (decimal) d 5 d 4 d 3 d 2 d 1 d 0 generalize: Octal to Decimal, Hexadecimal to Decimal, any base to Decimal

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

View Full Document
EECS 1520 – Week 3.2 September 21, 2017 page 2 Decimal to Binary Technique - repeatedly divide by 2 - remainder is the next digit - binary number is developed right to left Example 173 ÷ 2 86 1 1 86 ÷ 2 43 0 01 43 ÷ 2 21 1 101 21 ÷ 2 10 1 1101 10 ÷ 2 5 0 01101 5 ÷ 2 2 1 101101 2 ÷ 2 1 0 0101101 1 ÷ 2 0 1 10101101 generalize: Decimal to Octal, Decimal to Hexadecimal, Decimal to any base
EECS 1520 – Week 3.2 September 21, 2017 page 3 What is going on in the repeated division by 2? Example 43 ÷ 2 21 1 1 21 ÷ 2 10 1 11 10 ÷ 2 5 0 011 5 ÷ 2 2 1 1011 2 ÷ 2 1 0 01011 1 ÷ 2 0 1 101011 43 (decimal) = 1 × 2 5 + 0 × 2 4 + 1 × 2 3 + 0 × 2 2 + 1 × 2 1 + 1 × 2 0 43 ÷ 2 produces a quotient of 21, with a remainder of 1 43 ÷ 2 = 1 × 2 4 + 0 × 2 3 + 1 × 2 2 + 0 × 2 1 + 1 × 2 0 + 1 × 2 - 1 21 (decimal) = 1 × 2 4 + 0 × 2 3 + 1 × 2 2 + 0 × 2 1 + 1 × 2 0 21 ÷ 2 produces a quotient of 10, with a remainder of 1 21 ÷ 2 = 1 × 2 3 + 0 × 2 2 + 1 × 2 1 + 0 × 2 0 + 1 × 2 - 1

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

View Full Document
EECS 1520 – Week 3.2 September 21, 2017 page 4 10 (decimal) = 1 × 2 3 + 0 × 2 2 + 1 × 2 1 + 0 × 2 0 10 ÷ 2 produces a quotient of 5, with a remainder of 0 10 ÷ 2 = 1 × 2 2 + 0 × 2 1 + 1 × 2 0 + 0 × 2 - 1 5 (decimal) = 1 × 2 2 + 0 × 2 1 + 1 × 2 0 5 ÷ 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern