Chapter 11
The Unavoidable Math Chapter
IN THIS CHAPTER
Using the ++ and -- operators
Making the modulus useful
Employing various operator shortcuts
Working with various math functions
Creating random numbers
Understanding the order of precedence
One of the reasons I shunned computers in my early life was that I feared the math. Eventually, I learned that math doesn't play a central role in programming. On one hand, you need to know some math, especially when a program involves complex calculations. On the other hand, it’s the computer that does the math — you just punch in the formula.
In the programming universe, math is necessary but painless. Most programs involve some form of simple math. Graphics programming uses a lot of math. And games wouldn’t be interesting if it weren’t for random numbers. All this stuff is math. I believe that you’ll find it more interesting than dreadful. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access