Java StrictMath toRadians()方法

java.lang.StrictMath.toRadians() 方法转换为度,以弧度为单位的大约相当于角的角度。从角度到弧度的转换通常是不精确的。

1 语法

public static double toRadians(double angdeg)

2 参数

angdeg : 这是一个角度,单位为度。

3 返回值

此方法返回角度angdeg的测量弧度。

4 示例 

package com.yiidian;

/**
 * 一点教程网: http://www.yiidian.com
 */
/**
 * Java StrictMath toRadians()方法
 */
import java.lang.*;

public class StrictMathDemo {

  public static void main(String[] args) {
  
    double d1 = 60, d2 = 0.0;

    /* converts an angle in degrees to an 
    approximately equivalent angle measured in radians. */

    double radianValue = StrictMath.toRadians(d1); 
    System.out.println("value in radian of " + d1 + " = " + radianValue);
        
    radianValue = StrictMath.toRadians(d2); 
    System.out.println("value in radian of " + d2 + " = " + radianValue);
  }
}

输出结果为:

value in radian of 60.0 = 1.0471975511965976
value in radian of 0.0 = 0.0

 

热门文章

优秀文章