Docsity

Number Systems: Binary, Decimal, Hexadecimal, Octal and Floating Point Representation, Slides of Digital Logic Design and Programming

Partial preview of the text

Download Number Systems: Binary, Decimal, Hexadecimal, Octal and Floating Point Representation and more Slides Digital Logic Design and Programming in PDF only on Docsity!

Lecture No. 3

Number Systems

Recap

 Number System Conversion  Sum-of-Weights for converting to decimal  Repeated division for converting from decimal

 Binary Arithmetic  Similar to Decimal Arithmetic  Multiplying by a constant by shifting left  Dividing by a constant by shifting right

2’s Complement form

 1’s complement form

 2’s complement form

Binary number 01101 (13)

1’s complement 10010

  • 1

2’s complement 10011 (-13)

Addition and Subtraction with 2’s Complement

Addition and Subtraction 2’complement vs. Signed

Range of Numbers

 Unsigned  Positive Numbers Only (0 to 7)  3-bit

 Signed Magnitude  Positive & Negative Numbers (-7 to 7)  4-bit

 2’s Complement  Positive & Negative Numbers (-8 to 7)  4-bit

Range and Overflow

Range of Binary Numbers

 Processors can handle 64-bit unsigned binary values.

 Maximum unsigned decimal number is 18.446 x 10 18

 How to represent larger numbers?

 How to represent very small numbers?

 How to represent numbers with integer part and fraction part?

Floating Point Format

 15 digit decimal number format

 Sign digit 1

 Exponent digits 2

 Mantissa digits 12

 6918.3125 = 6.9183125 x 10 3

 Magnitude 69183125

 Exponent 3

Floating Point Format

 Normalized form 0.69183125 x 10^4

 Magnitude 69183125

 Exponent 4

  • 0 4 6 9 1 8 3 1 2 5 0 0 0 0

 Max Number 0.999,999,999,999 x 10^99  No negative exponent

Floating Point Format

 Zero?

 Infinity (∞)?

+/- (^) x x 0 0 0 0 0 0 0 0 0 0 0 0

Floating Point Format

 Allow 10 48 → 98 10 -49^ → 1

 Exponent 99 → ∞  Exponent 0 → 0

 Decrease Bias to 49

 1049 → 98 10 -48^ → 1

 Exponent 99 → ∞  Exponent 0 → 0

Floating Point Numbers

  • 1011 -
  • 1101 -
  • 11000 -
    • 1011 -5 0101 +
    • 1100 -4 0100 +
  • 10111 -9 1001 +
  • +1.101 x 2 5 S=0 Exponent=
  • Mantissa
  • -1.01011 x 2-126 S=1 Exponent=
    • Mantissa
  • 0 S=0 Exponent=
    • Mantissa
  • ∞ S=0 Exponent=
  • Mantissa

Hexadecimal Number System

 Base 16

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

 Representing Binary in compact form

 1101100000110 2 = 1B06 H