Precision sum of doubles
It has a bug: very small numbers are completely ignored:

sum({0.1, 0.0000001}) -&gt; 0.1


If technical limitations do not allow you to change this behaviour, you should:


Document it in a comment as a know limitation
Put a condition in the loop if x &lt; min_tolerance {fail}, to adhere to fail fast fail loudly, instead of silently failing.