带有示例的 Scala Float toRadians() 方法
toRadians()方法用于将以度为单位的角度转换为以弧度为单位的大致等效角度。
Method Definition: (Number).toRadians
Return Type: It returns the converted value of radians.
示例 #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