Game Development Reference
In-Depth Information
12 - Cartesian Coordinates
Figure 12-9: Trick 2 - Subtracting a positive and negative number.
Trick 3: The Commutative Property of Addition
A third trick is to remember that when you add two numbers like 6 and 4, it doesn't
matter what order they are in. (This is called the commutative property of addition.)
That means that 6 + 4 and 4 + 6 both equal the same value, 10. If you count the boxes in the
figure below, you can see that it doesn't matter what order you have the numbers for
addition.
Figure 12-10: Trick 3 - The commutative property of addition.
Say you are adding a negative number and a positive number, like -6 + 8. Because you
are adding numbers, you can swap the order of the numbers without changing the answer. -
6 + 8 is the same as 8 + -6. But when you look at 8 + -6, you see that the minus sign can eat
the plus sign to its left, and the problem becomes 8 - 6 = 2. But this means that -6 + 8 is
also 2! We've rearranged the problem to have the same answer, but made it easier for us to
solve without using a calculator or the computer.
Search WWH ::




Custom Search