1

The loop

double d=1.00d;
for (int i=0; i<=3; i++)
    System.out.println(d+i*0.2);

is giving 1.2000001 (don't recall how many 0-s after the decimal, isn't regularly happening) sometimes.

What's the best way to get aroun this glitch? i'd ecpect to have 1.20 when i hits 1.

TIA

user3880721
  • 613
  • 6
  • 16

0 Answers0