当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Scala Float isPosInfinity()用法及代码示例


如果Float值或指定的float值是无穷大正数,则使用isPosInfinity()方法返回true,否则返回false。

函数定义: (Float_Number).isPosInfinity

返回类型: It returns true if the Float value or the specified float value is positive infinity number, or false otherwise.



范例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) 
      
    } 
} 
输出:
false

范例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) 
      
    } 
} 
输出:
false


相关用法


注:本文由纯净天空筛选整理自Kanchan_Ray大神的英文原创作品 Scala Float isPosInfinity() method with example。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。