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

OK.

That algorithm could be improved (for accuracy, not speed) by replacing sums of the smallest number with multiplications as I suppose that multiplication of more than 3 identical numbers or more is loosing less precision than multiple additions.

For example:

[4, 3, 7, 7, 8] could be calculated as:

  (3+4) => [7, 7, 7, 8]
  (7*3) => [21, 8]
  (8+21) => 29



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

Search: