math.ceiling()
时间: 2024-05-27 17:11:12 浏览: 122
取整函数-12.04.14.pdf
math.ceil() is a function in the math module of Python that returns the smallest integer greater than or equal to a given value. It takes one argument, which is a numeric value (integer or float), and returns an integer value.
For example, math.ceil(4.2) returns 5, math.ceil(5.9) returns 6, math.ceil(-4.2) returns -4, and math.ceil(-5.9) returns -5.
This function is commonly used in mathematical operations where we need to round up a value to the nearest integer.
阅读全文