Java has random errors?


it prints out normally (0.01, 0.02...) but on the sixth console log it prints out 0.060000000000000005 and by the end it spits out 9.999999999999831 as if it is randomly adding bits incorrectly. I just found this curious because it makes me wonder whether it is a fault in my computer, the way java handles floats or a problem coming from code academy. Every time I run it it has the same mistakes which gives me a feeling it may be due to some sort of simplifying that codecademy is doing.

var count = 0

while (count < 10){
    count += 0.01;


check it


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.