Open In App

Scala Float isNaN() method with example

Improve
Improve
Like Article
Like
Save
Share
Report

The isNaN() method is utilized to return true if this Float value or the specified float value is Not-a-Number (NaN), or false otherwise.

Method Definition: (Float_Number).isNaN

Return Type: It returns true if this Float value or the specified float value is Not-a-Number (NaN), or false otherwise.

Example #1:




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


Output:

true

Example #2:




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


Output:

false


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