带有示例的 Scala Float isInfinity() 方法
如果指定的浮点值是无限的,则使用isInfinity()方法返回 true,否则返回 false。
Method Definition: (Number).isInfinity
Return Type: It returns true if the specified Float value is infinite otherwise return false.
示例 #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)
}
}
输出:
false
示例 #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)
}
}
输出:
false