目录

static double toDegrees(double angrad)

描述 (Description)

java.lang.StrictMath.toDegrees()方法将以弧度为单位的角度转换为以度为单位测量的近似等效角度。 从弧度到度数的转换通常是不精确的,用户不应期望cos(toRadians(90.0))完全等于0.0。

声明 (Declaration)

以下是java.lang.StrictMath.toDegrees()方法的声明

public static double toDegrees(double angrad)

参数 (Parameters)

angrad - 这是一个角度,以弧度表示

返回值 (Return Value)

此方法以度为单位返回角度angrad的测量值。

异常 (Exception)

NA

例子 (Example)

以下示例显示了java.lang.StrictMath.toDegrees()方法的用法。

package com.iowiki;
import java.lang.*;
public class StrictMathDemo {
   public static void main(String[] args) {
      double d1 = 1.5707963267948966 , d2 = 0.0;
      /* converts an angle in radians to an approximately equivalent angle
         in degree.*/
      double degreeValue = StrictMath.toDegrees(d1); 
      System.out.println("Degree value of d1 : " + degreeValue);
      degreeValue = StrictMath.toDegrees(d2); 
      System.out.println("Degree value of d2 : " + degreeValue);
   }
}

让我们编译并运行上面的程序,这将产生以下结果 -

Degree value of angel d1 : 90.0
Degree value of angel d2 : 0.0
↑回到顶部↑
WIKI教程 @2018