I found something "interesting" (or rather annoying).
If I run the following code:
double a1 = 1.0D, a2 = 0.64D, a3 = a1 + a2, a4 = 1.64D;
System.out.println("a1 = " + a1);
System.out.println("a2 = " + a2);
System.out.println("a3 = " + a3);
System.out.println("a4 = " + a4);
I get the following output:
a1 = 1.0
a2 = 0.64
a3 = 1.6400000000000001
a4 = 1.64
What the hell is happening here?
Where comes that 0.0000000000000001 value from in the sum of the two doubles? It occured with Sun JDK 1.5.0 build7.
Recent comments
1 year 43 weeks ago
3 years 12 weeks ago
3 years 13 weeks ago
3 years 14 weeks ago
3 years 15 weeks ago
3 years 22 weeks ago
3 years 22 weeks ago
3 years 22 weeks ago
3 years 22 weeks ago
3 years 23 weeks ago