Java Math三角函数的使用--数值转换

原创
2015/01/01 17:44
阅读数 273
public class MathDemo {

   public static void main(String[] args) {

      // get two double numbers numbers
      double x = 45;
      double y = -180;

      // convert them to radians
      x = Math.toRadians(x);
      y = Math.toRadians(y);

      // print the trigonometric sine for these doubles
      System.out.println("Math.sin(" + x + ")=" + Math.sin(x));
      System.out.println("Math.sin(" + y + ")=" + Math.sin(y));

   }
}


展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部