安卓 關於Float

方法1:用Math.round計算,這裏返回的數字格式的.spa 1 2 3 4 float  price=89.89; int  itemNum=3; float  totalPrice=price*itemNum; float  num=(float)(Math.round(totalPrice*100)/100);//若是要求精確4位就*10000而後/10000  方法2:用Decimal
相關文章
相關標籤/搜索