如何使用 C# 转换弧度中的三角函数角?


要换算弧度中的三角函数角,乘以 Math.PI/180。这会转换度到弧度。

以下是代码:

例子

using System;

class Program {
   static void Main() {
      Console.WriteLine(Math.Cos(45));

      double res = Math.Cos(Math.PI * 45 / 180.0);
      Console.WriteLine(res);

   }
}

在上面,我们使用下面这个公式换算:

Math.PI * angle / 180.0

更新时间:2020 年 6 月 21 日

3K+ 浏览量

开启你的 职业生涯

完成课程获取认证

开始
广告