Open In App

Scala Float ceil() method with example

Improve
Improve
Like Article
Like
Save
Share
Report

The ceil() method is utilized to returns number which is greater than or equal to the given number.

Method Definition: def ceil: Float

Return Type: It returns a number which is greater than or equal to the given number.

Example #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)
      
    }


Output:

6.0

Example #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)
      
    }


Output:

-3.0


Last Updated : 29 Oct, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads