Sobes.tech
Junior — Senior

Problem of loss of precision when summing fractional numbers

livecode

Task condition

Find and explain why a rounding error occurs when accumulating small fractional values.

double total = 0d;
for (var i = 0; i < 10; i++) {
    total += 0.1d;
}