0

Why do I get 0.6100000000000001 when I should get 0.61 ? I know the get I know the decimal format to fix it. I just want the explanation for why it happens.

public class Mid2009{
    public static void main (String args []){
        double d1 = 1.03;
        double d2 = 0.42;
        double d3 = d1-d2;
        System.out.println(d3);
    }
}
Alexis C.
  • 87,500
  • 20
  • 164
  • 172

0 Answers0