Retain precision with double in Java

前端 未结 22 3139
情歌与酒
情歌与酒 2020-11-21 05:15
public class doublePrecision {
    public static void main(String[] args) {

        double total = 0;
        total += 5.6;
        total += 5.8;
        System.out         


        
22条回答
  •  逝去的感伤
    2020-11-21 06:09

    You're running up against the precision limitation of type double.

    Java.Math has some arbitrary-precision arithmetic facilities.

提交回复
热议问题