整数化とか

正の数

>>> 10 / 3
3.3333333333333335
>>> int(10 / 3)
3
>>> 10 // 3
3
>>> math.trunc(10 / 3)
3
>>> round(10 / 3)
3
>>> math.floor(10 / 3)
3
>>> math.ceil(10 / 3)
4

負の数

>>> -10 / 3
-3.3333333333333335
>>> int(-10 / 3)
-3
>>> -10 // 3
-4
>>> math.trunc(-10 / 3)
-3
>>> round(-10 / 3)
-3
>>> math.floor(-10 / 3)
-4
>>> math.ceil(-10 / 3)
-3
タイトルとURLをコピーしました