3_ INTEGERp4

5
REPRESENTING INTEGER DATA UNSIGNED BINARY AND BINARY-CODED DECIMAL BCD: binary-coded decimal Each decimal digit individually converted to binary – Requires 4 bits per digit 8-bit location hold 2 BCD digits — 00 to 99 68 10 01101000 BCD Hexa: 4 bits can hold 16 values, 0 to F A to F not used in BCD

description

3_ INTEGERp4

Transcript of 3_ INTEGERp4

  • 1REPRESENTING INTEGER DATA

    UNSIGNED BINARY ANDBINARY-CODED DECIMAL

    BCD: binary-coded decimal

    Each decimal digit individually converted to binary Requires 4 bits per digit 8-bit location hold 2 BCD digits 00 to 99

    6810 01101000BCD Hexa: 4 bits can hold 16 values, 0 to F A to F not used in BCD

  • 2SIGN-AND-MAGNITUDE REPRESENTATION

    Nines Decimal Representation Examples 9s complement 9s compl. Repr. For: 3-digit nb 467?

    999467532

    4-digit nb 467?9999467

    9532

    Sign-and-magnitude value 9990?99999990

    9 9990 represents the value 9

  • 3Figure 4.6 Addition as a counting process Figure 4.7 Addition with wraparound

    Figure 4.8 Addition with modulus crossing

    Ones complement

  • 4Add in 1s complement

    Overflow

    Overflow sign of result sign both operands

    Tens complement scale

  • 5Examples

    10s complement of 247 is 1000 247 = 75317 is 1000 017 = 983

    Sign and magnitude of 777Begins with a 7 ( 5) negative1000 777 = 223The sign-magnitude value is 223

    Alternative 10s comp = 9s comp + 1

    Twos complement

    2s complement = 1s complement+1

    Examples of 2s complement