WHY PRE-DIVISION OF SQUARE TABLE ENTRIES WORK The formula we use for multiplication is: 4ab = (a + b)^2 - (a - b)^2 Which can be rewritten as: ab = (a + b)^2 / 4 - (a - b)^2 / 4 All squares are stored in a lookup table so the idea is to pre-divide table entries by 4 to avoid unnecessary math. However, such operation on integer values is suspicious because we might potentially lose precision. The explanation why it works is as follows: 1) If (a + b) is even then (a - b) is even too. If (a + b) is odd then (a - b) is odd too. So, our problem actually splits into two cases. We either subtract squares of even numbers or squares of odd numbers. 2) All even numbers can be written as 2n and their squares as 4n^2. Thus, division by 4 leaves no remainder. 3) All odd numbers can be written as (2n + 1) and their squares as (2n + 1)^2 = 4n^2 + 4n + 1 = 4(n^2 + n + 1/4). Thus, division by 4 leaves a remainder of 1/4. 4) The final expression for even numbers is: (a + b)^2 - (a - b)^2 And for odd numbers: (a + b)^2 + 1/4 - ((a - b)^2 + 1/4) = (a + b)^2 - (a - b)^2 The result is the same for both cases. Hence, it is absolutely safe to use pre-divided table entries. Many thanks to David Revelj for pointing this out and providing the mathematical proof.