|
|
|
|
|
by kevinastock
4957 days ago
|
|
The faster version looks like it might not be numerically stable; if sum(l_quantity) is greater than the maximum value that can be represented it would overflow and give meaningless results. Given the arrays mentioned by the average function, it could also be maintaining a heap and adding the numbers from smallest to largest for more stability. |
|
"the numeric average function uses an array of two numerics to keep track of the current sum and count."