Open In App

Scala Float isPosInfinity() method with example

The isPosInfinity() method is utilized to return true if the Float value or the specified float value is positive infinity number, or false otherwise.

Method Definition: (Float_Number).isPosInfinity



Return Type: It returns true if the Float value or the specified float value is positive infinity number, or false otherwise.

Example #1:




// Scala program of Float isPosInfinity()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying isPosInfinity method
        val result = (7.965).isPosInfinity
          
        // Displays output
        println(result)
      
    }

Output:

false

Example #2:




// Scala program of Float isPosInfinity()
// method
  
// Creating object
object GfG
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying isPosInfinity method
        val result = (0.0/0.0).isPosInfinity
          
        // Displays output
        println(result)
      
    }

Output:
false

Article Tags :