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

Info icon 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
Image of page 1

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

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
Image of page 2
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
Image of page 3

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

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
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '13
  • Lockhart
  • molecular biology, Binary numeral system, Positional notation, representative