Reduce number of math operations for SquareOfSums

Oversimplifying the derivation actually resulted in more work for the
machine. Execute the squared operation with a temporary storage
variable.