- 舍棄小數部分
>>> math.trunc(12.533222)
12
>>> round(12.2544)
12
- 按給定小數位數四舍五入
>>> round(12.2544, 3)
12.254
- 向上取整
>>> math.ceil(12.4584)
13
- 向下取整
>>> math.floor(12.4584)
12
>>> math.trunc(12.533222)
12
>>> round(12.2544)
12
>>> round(12.2544, 3)
12.254
>>> math.ceil(12.4584)
13
>>> math.floor(12.4584)
12
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。