Hacker News new | past | comments | ask | show | jobs | submit login

That costs a sort, better to use the Kahan summation formula https://en.wikipedia.org/wiki/Kahan_summation_algorithm



Look at the accuracy comment, it's faster but less accurate than sorting first.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: