- #1
- 2,813
- 492
If I have a bunch of sorted numbers spanning a large range of magnitudes, is it better to add them up from smallest to largest or from largest to smallest, or something else?
Let's say I'm summing an array A, which is sorted from large to small. Which gives a more accurate result:
sum1 = 0
for i=0,length(A)-1
sum1 += A
end
sum2 = 0
for i=length(A)-1,0
sum2 += A
end
Let's say I'm summing an array A, which is sorted from large to small. Which gives a more accurate result:
sum1 = 0
for i=0,length(A)-1
sum1 += A
end
sum2 = 0
for i=length(A)-1,0
sum2 += A
end