目录 ← 首页
CS61C

Summary

And in Summary\dots

  • We represent “things” in computers as particular bit patterns:
    • With NN bits, you can represent at most 2N2^N things.
  • Today, we discussed five different encodings for integers:
    • Unsigned integers
    • Signed integers:
      • Sign-Magnitude
      • Ones’ Complement
      • Two’s Complement
    • Bias Encoding
  • Computer architects make design decisions to make HW simple
    • Unsigned and Two’s complement are C standard. Learn them!!
  • Integer overflow: The result of an arithmetic operation is outside the representable range of integers.
    • Numbers have infinite digits, but computers have finite precision. This can lead to arithmetic errors. More later!

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.

Textbook Readings

P&H: 2.4

Additional References

Dan Garcia’s Binary Slides, Fall 2025

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

Exercises

Check your knowledge!

Conceptual Review

Short Exercises