java.lang.Math.toDegrees(double angrad)%uA0转换以弧度为单位,以度数测量的近似相等的角的角度。从弧度到度的转换通常是不精确的 用户应该不期待 cos(toRadians(90.0)),恰好等于0.0。
声明
以下是java.lang.Math.toDegrees()方法的声明
public static double toDegrees(double angrad)
参数
-
angrad%uA0-- 角度,以弧度为单位。
返回值
此方法返回测量的度角angrad。
异常
-
NA
例子
下面的例子显示lang.Math.toDegrees()方法的使用。
package com.yiibai import java.lang.* public class MathDemo { public static void main(String[] args) { // get two double numbers numbers double x = 45 double y = -180 // convert them in degrees x = Math.toDegrees(x) y = Math.toDegrees(y) // print the hyperbolic tangent of these doubles System.out.println("Math.tanh(" + x + ")=" + Math.tanh(x)) System.out.println("Math.tanh(" + y + ")=" + Math.tanh(y)) } }
让我们来编译和运行上面的程序,这将产生以下结果:
Math.tanh(2578.3100780887044)=1.0 Math.tanh(-10313.240312354817)=-1.0