📜  带有示例的 Scala Float toRadians() 方法

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

带有示例的 Scala Float toRadians() 方法

toRadians()方法用于将以度为单位的角度转换为以弧度为单位的大致等效角度。

示例 #1:

// Scala program of Float toRadians()
// method
  
// Creating object
object GfG
{ 
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying toRadians method
        val result = (56).toRadians
          
          
        // Displays output
        println(result)
      
    }
} 
输出:
0.9773844

示例 #2:

// Scala program of Float toRadians()
// method
  
// Creating object
object GfG
{ 
  
    // Main method
    def main(args:Array[String])
    {
      
        // Applying toRadians method
        val result = (180).toRadians
          
          
        // Displays output
        println(result)
      
    }
} 
输出:
3.1415927