Scala Float %(x: Double) 方法与示例
当给定的浮点值除以双精度值时, %(x: Double)方法用于返回余数。
Method Definition: (Float_Value).%(Double_Value)
Return Type: It returns the remainder when the given float value is divided by the double value.
示例 #1:
// Scala program of Float %(x: Double)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying %(x: Double) function
val result = (7.0).%(3)
// Displays output
println(result)
}
}
输出:
1.0
示例 #2:
// Scala program of Float %(x: Double)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying %(x: Double) function
val result = (65.0).%(65)
// Displays output
println(result)
}
}
输出:
0.0