The isInfinity() method is utilized to return true if the specified Float value is infinite otherwise return false.
Method Definition: (Number).isInfinity
Return Type: It returns true if the specified Float value is infinite otherwise return false.
Example #1:
// Scala program of Float isInfinity() // method // Creating object object GfG
{ // Main method
def main(args : Array[String])
{
// Applying isInfinity method
val result = ( 5.4 ).isInfinity
// Displays output
println(result)
}
} |
Output:
false
Example #2:
// Scala program of Float isInfinity() // method // Creating object object GfG
{ // Main method
def main(args : Array[String])
{
// Applying isInfinity method
val result = ( 7 / 3 ).isInfinity
// Displays output
println(result)
}
} |
Output:
false