http://blog.csdn.net/yuhua3272004/article/details/3075436 使用java.math.BigDecimal工具类实现 java保留两位小数问题: 方式一(四舍五入形式保留两位小数,注意模式ROUND_HALF_UP): 四舍五入 double f = 111231.5585; BigDecimal b = new BigDecimal(f); double f1 = b.setScale
将N*N乘法转化为(N*n1)+(N*n2)....(N*nn) 乘完后在补充小数点 public static char[] Quadrature(string a, string b) { ] { ' }; List<int> bu = new List<int>(); List<int> au = new List<int>(); int adot = a.Length; int bdot = b.Length; ; i >= ; i--) {
import java.math.BigDecimal; public class Kewai{ public static void main(String[] args) { double f = 3.1415927; BigDecimal b = new BigDecimal(f); double f1 = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); System.out.println(f1); } }