斯卡拉短/(x:双):双
简而言之,一个 16 位有符号整数(相当于 Java 的 short 原始类型)是 scala.AnyVal 的子类型。 /(x: Int) 方法用于返回 x 对指定的 Double 值的商运算的结果。
Method Definition: def /(x: Double): Double
Return Type: It returns quotient with value and x.
示例 #1:
// Scala program of Short /(x: Double)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Short /(x: Double) function
val result = (998.toShort)./(22:Double)
// Displays output
println(result)
}
}
输出:
45.36363636363637
示例 #2:
// Scala program of Short /(x: Double)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Short /(x: Double) function
val result = (-111.toShort)./(47:Double)
// Displays output
println(result)
}
}
输出:
-2.3617021276595747