Scala Double *(x: Long) 方法
在 Scala 中,Double 是一个 64 位浮点数,相当于 Java 的 double 基本类型。 *(x: Long)方法用于返回指定的 Double 值和 Long 值的乘积。
Method Definition – def *(x: Long)
Returns – Returns the product of this value and x.
示例 #1:
// Scala program to explain working of
// Double *(x: Long) method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying *(x: Long) function
val result = (13.00210.toDouble).*(5:Long)
// Displays output
println(result)
}
}
输出:
65.01050000000001
示例 #2:
// Scala program to explain working of
// Double *(x: Long) method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying *(x: Long) function
val result = (15.004450.toDouble).*(5:Long)
// Displays output
println(result)
}
}
输出:
75.02225