| Real'sHowTo |
|
|
Custom Search
|
| Real'sHowTo |
|
|
Custom Search
|
System.out.println( 1.33 - 1.3 ); // output : 0.030000000000000027
The easiest way to solve this limitation is to the BigDecimal class :
import java.math.BigDecimal; ... System.out.println (BigDecimal.valueOf(1.33).subtract(BigDecimal.valueOf(1.3)));
Written and compiled by Réal Gagnon ©1998-2013
[ home ]