Loading

JavaScript 中的 toFixed() 并非银行家舍入法

1.3335.toFixed(3);  // 1.333
1.33335.toFixed(4);  //1.3334

无论是用奇数进位法,还是偶数进位法,都无法正确的解释 js 中 toFixed() 方法。

相关阅读: 为什么我说 Math.round 和 toFixed 既不是四舍五入,也不是银行家舍入法? - 知乎

posted @ 2021-07-07 20:22  xtyuns  阅读(120)  评论(0编辑  收藏  举报