Python ceil()関数

503 ワード

説明
Ceil(x)関数は、x以上の最小整数(上向き整数)を返します.
Ceil()メソッドの構文:
import math   #    math   
 
print ("math.ceil(-45.17) : ", math.ceil(-45.17))
print ("math.ceil(100.12) : ", math.ceil(100.12))
print ("math.ceil(100.72) : ", math.ceil(100.72))
print ("math.ceil(math.pi) : ", math.ceil(math.pi))

上記のインスタンスの実行後の出力結果は、次のとおりです.
math.ceil(-45.17) :  -45
math.ceil(100.12) :  101
math.ceil(100.72) :  101
math.ceil(math.pi) :  4