大数据运算解决精度丢失问题

BigInteger

解决大数据运算精度丢失问题

//大数据封装为BigInteger对象

          BigInteger big1 = new BigInteger("12345678909876543210");

          BigInteger big2 = new BigInteger("98765432101234567890");

          //add实现加法运算

          BigInteger bigAdd = big1.add(big2);

          //subtract实现减法运算

          BigInteger bigSub = big1.subtract(big2);

          //multiply实现乘法运算

扫描二维码关注公众号,回复: 5450101 查看本文章

          BigInteger bigMul = big1.multiply(big2);

          //divide实现除法运算

          BigInteger bigDiv = big2.divide(big1);

猜你喜欢

转载自www.cnblogs.com/hhthtt/p/10488143.html