System.out.println output for decimal numbers
I am trying to understand below output
System.out.println(4.0-3.2);
output 0.7999999999999998
while it was expected to be 0.8
on the other hand
System.out.println(4.0+3.2);
- 7.2
System.out.println(2.0*0.2);
returns 0.4
why such a long value in caseSystem.out.println(4.0-3.2);
Could you please explain?
+3
source to share
No one has answered this question yet
See similar questions:
or similar: