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