I was writing test cases in which i saw following behaviour. If some one can describe this in layman terms. Adding tag IEEE 754.
70D * 1.1 = 77.0 50D * 1.1 = 55.00000000000001 ?
I was writing test cases in which i saw following behaviour. If some one can describe this in layman terms. Adding tag IEEE 754.
70D * 1.1 = 77.0 50D * 1.1 = 55.00000000000001 ?
Double value has precision problem, you can use java.math.BigDecimal
to get accurate result:
System.out.println(new BigDecimal("50").multiply(new BigDecimal("1.1"))); // 55.00