【发布时间】:2017-05-09 22:36:23
【问题描述】:
Math.floor(1.23456789 * 1e8) / 1e8)
返回:
1.23456788
考虑到这一点很奇怪:
Math.floor(1.23456789 * 1e9) / 1e9)
返回:
1.23456789
还有
Math.floor(1.23456799 * 1e8) / 1e8)
返回:
1.23456799
知道为什么会发生这种情况以及如何避免吗?
【问题讨论】:
标签: java decimalformat