7 The sums behind the screen

This chapter covers

  • How computers perform arithmetic
  • Building larger programs from small parts
  • Processing computer data such as lists

Almost everything discussed in this book—images, typefaces, encoding, laying out paragraphs—involves computer arithmetic in some form. In this chapter, we take a step back and try to answer a more fundamental question: How do computers calculate and programmers program? In this chapter, we’ll look at the mathematics behind simple calculations, including arithmetic operations, functions, and data structures such as lists.

7.1 Simple calculations

How do we calculate the answer to 1+2×3? In our heads perhaps or on paper. But how do we decide which operation to do first (the ...

Get How Computers Make Books now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.