in reply to Re^5: &1 is no faster than %2 when checking for oddness. Oh well.
in thread &1 is no faster than %2 when checking for oddness. Oh well.
f you know you are summing 1 .. N then don't - use the formula.
See above. Tanktalus used the example of sum 1 .. a big number; I simply continued with his example.
The example is simply a placeholder for any operation that could lead to the accumulation of a number larger than a 32-bit integer can hold. Another example might be
sum @array;
where the numbers in the array total to more than 2**32, but for which there is no way to predict a formula to substitute for the accumulation.
Ie. Out of context, your point is well taken. In context, it is irrelavent, as it demonstrates the limitations of the chosen example, not the point that was being made.
|
|---|