java in Long accuracy problems

. 1,
String. Price = "19.90"; 19.99 //
int totalFee = (int) (new new the BigDecimal (. Price) .multiply (new new the BigDecimal ( "100"))) doubleValue in ();.
Int totalFee2 = (int) (Double. parseDouble (. price) * 100);
System.out.println (totalFee); 1990 //
System.out.println (totalFee2); // 1989
Double bigdecimal process is not the same and
2,
Long L = 112630689643634688L;
18 is bit Long, Long type to be returned to the front end, the front end parsed value inconsistent.
Solution:
In the Long type of response objects inside the field to add a comment:

 

 

 

 

Guess you like

Origin www.cnblogs.com/longyao/p/11719884.html