The Math.Asin() method in C# is used to return the angle whose sine is the specified number. The number is a double value argument.
Syntax
Following is the syntax −
public static double Asin (double val);
Above, Val is a number representing a sine. The value of Val must be greater than or equal to -1, but less than or equal to 1.
Example
Let us now see an example to implement Math.Asin() method −
using System;
public class Demo {
public static void Main(){
double val1 = -0.0;
double val2 = Double.PositiveInfinity;
double val3 = Double.NaN;
Console.WriteLine("Return value of {0} : {1}", val1, Math.Asin(val1));
Console.WriteLine("Return value of {0} : {1}", val2, Math.Asin(val2));
Console.WriteLine("Return value of {0} : {1}", val2, Math.Asin(val3));
}
}Output
This will produce the following output −
Return value of 0 : 0 Return value of ∞ : NaN Return value of ∞ : NaN
Example
Let us see another example to implement Math.Asin() method −
using System;
public class Demo {
public static void Main(){
double val1 = Double.NegativeInfinity;
double val2 = 2;
Console.WriteLine("Return value of {0} : {1}", val1, Math.Asin(val1));
Console.WriteLine("Return value of {0} : {1}", val2, Math.Asin(val2));
}
}Output
This will produce the following output −
Return value of -∞ : NaN Return value of 2 : NaN