📜  Scala Float %(x: Double) 方法与示例

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

Scala Float %(x: Double) 方法与示例

当给定的浮点值除以双精度值时, %(x: Double)方法用于返回余数。

示例 #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