Java教程

Java Math toDegrees()

Java Math toDegrees()

Java Math toDegrees() 方法将以弧度为单位的指定角度转换为度数。
toDegrees() 方法的语法是:
Math.toDegrees(double angle)
这里, toDegrees() 是一个静态方法。因此,我们使用类名访问该方法, Math

toDegrees() 参数

toDegrees() 方法接受一个参数。
angle-要转换为度数的角度弧度

toDegrees() 返回值

返回以度为单位的角度
注意: 从弧度到度的转换是近似的。然而,它通常是不准确的。

示例: Java Math.toDegrees()

class Main {
  public static void main(String[] args) {
    // create variables
    double angle1 = 0.52;
    double angle2 = 0.79;
    System.out.println(Math.toDegrees(angle1));  // 29.79380534680281
    System.out.println(Math.toDegrees(angle2));  // 45.26366581533504
  }
}

推荐教程

Math.toRadians()
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4