将浮点数限制为两位小数 - Limiting floats to two decimal points

问题:

I want a to be rounded to 13.95 . 我但愿将a舍入为13.95 html

>>> a
13.949999999999999
>>> round(a, 2)
13.949999999999999

The round function does not work the way I expected. round功能不能按我预期的方式工做。 python


解决方案:

参考一: https://stackoom.com/question/1uWa/将浮点数限制为两位小数
参考二: https://oldbug.net/q/1uWa/Limiting-floats-to-two-decimal-points
相关文章
相关标签/搜索