📜  Scala Double <=(x: Short) 方法

📅  最后修改于: 2022-05-13 01:54:51.191000             🧑  作者: Mango

Scala Double <=(x: Short) 方法

在 Scala 中,Double 是一个 64 位浮点数,相当于 Java 的 double 基本类型。如果该值小于或等于 x,则使用<=(x: Short)方法返回 true,否则返回 false。

示例 #1:

// Scala program to explain the working 
// of Double <=(x: Short) method
   
// Creating object
object GfG
{ 
   
    // Main method
    def main(args:Array[String])
    {
       
        // Applying <=(x: Short) function
        val result = (12.00123.toDouble).<=(15:Short)
           
        // Displays output
        println(result)
       
    }
} 
输出:
true

示例 #2:

// Scala program to explain the working 
// of Double <=(x: Short) method
   
// Creating object
object GfG
{ 
   
    // Main method
    def main(args:Array[String])
    {
       
        // Applying <=(x: Short) function
        val result = (75.00123.toDouble).<=(9:Short)
           
        // Displays output
        println(result)
       
    }
}
输出:
false