Math.Asin() is an inbuilt Math class method which returns the angle whose sine value is given as a double value argument. If the argument is NaN, then the result will be NaN.
Syntax:
public static double Asin(double num)
Parameter:
num: It is the number that represents a sine and type of this parameter is System.Double. It must be greater than or equal to -1, but less than or equal to 1.
Return Type: Returns an angle Θ, measured in radians and its type is System.Double. Here the angle is always measured in radians, such that -π/2 ≤ Θ ≤ π/2.
Note: If the value of the num is greater than 1 or less than -1 or equals to NaN, then this method always returns NaN as result. To convert the radians(return value) to degrees multiply it by 180 / Math.PI. A positive return value always represents a counter clock-wise angle from the x-axis and a negative return value always represents a clockwise angle.
Examples:
Input : Math.Asin(2)
Output : NaN
Input : Math.Asin(0.3584)
Output : 0.366553473829125
Input : Math.Asin(0.0)
Output : 0
Input : Math.Asin(-0.0)
Output : 0
Input : Math.Asin(Double.PositiveInfinity)
Output : NaN
Input : Math.Asin(Double.NegativeInfinity)
Output : NaN
Program: To illustrate the Math.Asin() method
using System;
class Geeks {
public static void Main(String[] args)
{
double a = Math.PI;
Console.WriteLine(Math.Asin(a));
Console.WriteLine(Math.Asin(2));
Console.WriteLine(Math.Asin(0.3584));
double d = 0.0;
double e = -0.0;
double posi = Double.PositiveInfinity;
double nega = Double.NegativeInfinity;
double nan = Double.NaN;
double res = Math.Asin(d);
double rest = res * (180 / Math.PI);
Console.WriteLine(rest);
Console.WriteLine(Math.Asin(e));
Console.WriteLine(Math.Asin(posi));
Console.WriteLine(Math.Asin(nega));
Console.WriteLine(Math.Asin(nan));
}
}
|
Output:
NaN
NaN
0.366553473829125
0
0
NaN
NaN
NaN
Reference: https://msdn.microsoft.com/en-us/library/system.math.Asin
Last Updated :
31 Jan, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...