要获取正弦为浮点值参数的角度,代码如下-
using System; public class Demo { public static void Main() { float val1 = 0.1f; float val2 = 8.9f; Console.WriteLine("Angle (val1) = "+(MathF.Asin(val1))); Console.WriteLine("Angle (val2) = "+(MathF.Asin(val2))); } }
输出结果
这将产生以下输出-
Angle (val1) = 0.1001674 Angle (val2) = NaN
让我们看另一个例子-
using System; public class Demo { public static void Main() { float val1 = 1.2f; float val2 = 45.5f; Console.WriteLine("Angle (val1) = "+(MathF.Asin(val1))); Console.WriteLine("Angle (val2) = "+(MathF.Asin(val2))); } }
输出结果
这将产生以下输出-
Angle (val1) = NaN Angle (val2) = NaN