float summation bug !(?)
in
Programming Questions
•
2 months ago
the following program
shows this console output:
0.0;1.0
0.1;1.1
0.2;1.2
0.3;1.3000001
0.4;1.4000001
0.5;1.5000001
0.6;1.6000001
0.70000005;1.7000002
0.8000001;1.8000002
0.9000001;1.9000002
Where do the "0.000000X" values come from?
- float i, x = 0.9;
- for (i = 0; i < 1; i += 0.1) {print(i);print(";");println(x += 0.1);}
shows this console output:
0.0;1.0
0.1;1.1
0.2;1.2
0.3;1.3000001
0.4;1.4000001
0.5;1.5000001
0.6;1.6000001
0.70000005;1.7000002
0.8000001;1.8000002
0.9000001;1.9000002
Where do the "0.000000X" values come from?
1