Scala Double %(x: Short)方法
在Scala中,Double是一个64位浮点数,它相当于Java的double原始类型。%(x: Short)方法用于返回给定Double值除以Short值的余数。
方法定义 – def %(x: Short)
返回值 – 返回此值除以x的余数。
示例#1:
// Scala程序解释工作方式
// of Double %(x: Short) method
// 创建对象
object GfG
{
// 主方法
def main(args:Array[String])
{
// 应用%(x: Short)函数
val result = (16.00215.toDouble ).%(13:Short)
// 显示输出
println(result)
}
}
3.0021500000000003```
示例#2:
// Scala程序解释工作方式
// of Double %(x: Short) method
// 创建对象
object GfG
{
// Main方法
def main(args:Array[String])
{
// 使用%(x: Short)函数
val result = (6.01225.toDouble ).%(13:Short)
// 显示输出
println(result)
}
}
6.01225
更多Scala相关文章,请阅读:Scala 教程
极客教程