1
public class Main{

        public static void main(String[] args){
            double value = 0.12;
            double sum = value + value + value;
            System.out.println(sum);
        }
}

output: 0.036000000000000004

why output is not 0.036 ? How I am getting the trailing 4 after a bunch of zeros ?

Enam Ahmed Shahaz
  • 195
  • 1
  • 2
  • 10

0 Answers0