Get the angle whose sine is float value argument in C#

CsharpServer Side ProgrammingProgramming

To get the angle whose sine is float value argument, the code is as follows −

Example

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)));
   }
}

Output

This will produce the following output −

Angle (val1) = 0.1001674
Angle (val2) = NaN

Example

Let us see another example −

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)));
   }
}

Output

This will produce the following output −

Angle (val1) = NaN
Angle (val2) = NaN
raja
Published on 11-Dec-2019 11:26:02
Advertisements