blog icon indicating copy to clipboard operation
blog copied to clipboard

toFixed 精度问题(银行家舍入法)

Open nmsn opened this issue 2 years ago • 1 comments

使用 toFixed 保留小数时存在这样的现象

1.35.toFixed(1) // 1.4 正确
1.335.toFixed(2) // 1.33  错误

nmsn avatar Nov 24 '22 14:11 nmsn