 <p>Adding numbers from smallest to largest will have a lower rounding error. If you compare the result with higher precision, you can see smaller to larger is closer.</p> <pre><code>double sum = 0; for (int i = 1; i &lt;= 5000; i++) { sum += 1.0 / i; } System.out.println("From largest to smallest " + sum); double sum2 = 0; for (int i = 5000; i &gt;= 1; i--) { sum2 += 1.0 / i; } System.out.println("From smallest to largest " + sum2); BigDecimal sum3 = BigDecimal.ZERO; for (int i = 5000; i &gt;= 1; i--) { sum3 = sum3.add(BigDecimal.ONE.divide(BigDecimal.valueOf(i), 30, BigDecimal.ROUND_HALF_UP)); } System.out.println("BigDecimal " + sum3); </code></pre> <p>prints</p> <pre><code>From largest to smallest 9.094508852984404 From smallest to largest 9.09450885298443 BigDecimal 9.094508852984436967261245533401 </code></pre>