ceil()
是 julia 中的一个内置函数,用于返回大于或等于指定值x的最近整数值。
Syntax: ceil(x)
Parameters:
- x: Specified value.
Returns: It returns the nearest integral value greater than or equal to the specified value x.
示例 1:
# Julia program to illustrate
# the use of ceil method
# Getting the nearest integral value
# greater than or equal to the
# specified value x.
println(ceil(5))
println(ceil(5.9))
println(ceil(5.5))
输出:
5
6.0
6.0
示例 2:
# Julia program to illustrate
# the use of ceil method
# Getting the nearest integral value
# greater than or equal to the
# specified value x.
println(ceil(2))
println(ceil(2.1))
println(ceil(2.4))
println(ceil(2.5))
println(ceil(2.6))
println(ceil(2.9))
输出:
2
3.0
3.0
3.0
3.0
3.0