Arithmetic with doubleTag(s): String/Number
You may find that
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)));
mail_outline
Send comment, question or suggestion to howto@rgagnon.com
Send comment, question or suggestion to howto@rgagnon.com