Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

1And in Summary\dots

Meta takeaway: We make design decisions to make the hardware simple. We threw out sign magnitude and ones’ complement because the hardware would be hard. But here’s a secret: it’s the same hardware for mathematics on unsigned and two’s complement numbers. The only difference is how you calculate overflow.

2Textbook Readings

P&H: 2.4

3Additional References

Dan Garcia’s Binary Slides, Fall 2025

Amazing Illustrations by Ketrina (Yim) Thompson: CS Illustrated Number Rep Handouts

4Exercises

Check your knowledge!

4.1Conceptual Review

Solution to Exercise 1 #

A bit is the smallest unit of digital information and it can be either 0 of 1. There are 4 bits in a nibble and 8 bits in a byte.

Solution to Exercise 2 #

When the result of an arithmetic operation is outside the range of what is representable by given number of bits.

Solution to Exercise 3 #
  • Unsigned: [0,2n1][0, 2^n-1]

  • Sign-Magnitude: [(2n11),2n11][-(2^{n-1} - 1), 2^{n-1} - 1]

  • One’s complement: [(2n11),2n11][-(2^{n-1} - 1), 2^{n-1} - 1]

  • Two’s complement: [2n1,2n11][-2^{n-1}, 2^{n-1} - 1]

  • Bias: [0+[0+bias,2n1+, 2^n-1+bias]]

Solution to Exercise 4 #
  • Unsigned: 1

  • Sign-Magnitude: 2

  • One’s complement: 2

  • Two’s complement: 1

  • Bias: 1 or 0 (depending on bias)

4.2Short Exercises

Solution to Exercise 5 #

True. The same bits can be interpreted in many different ways with the exact same bits! The bits can represent anything from an unsigned number to a signed number or even, as we will cover later, a program. It is all dependent on its agreed upon interpretation.

Solution to Exercise 6 #

False. In Two’s Complement, the MSB is always 1 for a negative number. This means EVERY negative number in Two’s Complement, when converted to unsigned, will be larger than the positive numbers.

Solution to Exercise 7 #

False. Our current representation formats has a major limitation; we can only represent and do arithmetic with integers. To successfully represent fractional values as well as numbers with extremely high magnitude beyond our current boundaries, we need another representation format.

Solution to Exercise 8 #

C.

Solution to Exercise 9 #

7 bits. (116)10=(116)_{10} = 0b111 0100 or log21166.85log{_2}{116} \approx 6.85 which we round to 7 bits.