🖊️

Signed Integer Representations

TypeQuiz 1 Material

Notes

We will NOT ask you to do arithmetic or conversions on sign-magnitude or 1's complement numbers

Unsigned Integer

Unsigned Integer is a 32-bit datum that encodes a nonnegative integer in the range [0 to 4294967295].

Binary to Decimal Conversion

Binary Addition and Subtraction

Carry in if the bit value is > 1. Borrow if < 0.

Signed Integer

Signed Integer is a 32-bit datum that encodes an integer in the range [-2147483648 to 2147483647] —> Can represent negative numbers.

Signed Magnitude

Flip the leading 0 to 1 to represent the negative sign.

1's Complement

Flip all the bits to represent the corresponding negative number.

  • n=n-n=\backsim n

2's Complement

Flip all the bits + 1 to represent the corresponding negative number

n=n+1-n=\backsim n + 1

Sign Extension

Fractional Binary Numbers

8421.5.25.125.0625
10101100

11011100=10.75101101_{\land}1100=10.75_{10}

Questions & Answers

Conversions

In 6-bit binary, what’s the range of possible values you can represent with:

In n-bit binary, what’s the range of possible values you can represent with:

On a conceptual level, why do we prefer 2’s complement over the other signed representations?

How does one compute the additive inverse of a two’s complement number?

Take the boolean NOT of each bit and add 1