解决浮点数计算误差 用户1832929600214 2023-05-04 121 阅读1分钟 解决浮点数计算误差 1.num.toFixed(a)(截数:a::::位(变为字符串)) 2.(1).Math.pow(10,n)(10的n(:::::保留几位小数||)次方) (2).num*(1) (3).Math.round(四舍五入)*(2) (4).(3)/(1) (Math.round(num * Math.pow(10, n)) / Math.pow(10, n))