Scala Float ceil() 方法与示例
ceil()方法用于返回大于或等于给定数字的数字。
Method Definition: def ceil: Float
Return Type: It returns a number which is greater than or equal to the given number.
示例 #1:
// Scala program of Float ceil()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying ceil method
val result = (5.4).ceil
// Displays output
println(result)
}
}
输出:
6.0
示例 #2:
// Scala program of Float ceil()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying ceil method
val result = (-3.8).ceil
// Displays output
println(result)
}
}
输出:
-3.0