📜  Scala Float ceil() 方法与示例

📅  最后修改于: 2022-05-13 01:54:24.008000             🧑  作者: Mango

Scala Float ceil() 方法与示例

ceil()方法用于返回大于或等于给定数字的数字。

示例 #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