C# Tutorial C# Advanced C# References

C# Math - Asin() Method



The C# Asin() method returns arc sine of a value. The returned value will be in the range -𝜋/2 through 𝜋/2. In special cases it returns the following:

  • If the argument is NaN or its absolute value is greater than 1, the method returns NaN.

Note: Asin() is the inverse of sin().

Syntax

public static double Asin(double arg);

Parameters

arg Specify the value.

Return Value

Returns the arc sine of the value.

Example:

In the example below, Asin() method is used to find out the arc sine of a given value.

using System;

class MyProgram {
  static void Main(string[] args) {
    Console.WriteLine("Math.Asin(-1) = "
                      + Math.Asin(-1));
    Console.WriteLine("Math.Asin(-0.5) = "
                      + Math.Asin(-0.5));
    Console.WriteLine("Math.Asin(0) = "
                      + Math.Asin(0));
    Console.WriteLine("Math.Asin(0.5) = "
                      + Math.Asin(0.5));
    Console.WriteLine("Math.Asin(1) = "
                      + Math.Asin(1));
    Console.WriteLine("Math.Asin(2) = "
                      + Math.Asin(2));
    Console.WriteLine("Math.Asin(Double.NaN) = "
                      + Math.Asin(Double.NaN));
  }
}

The output of the above code will be:

Math.Asin(-1) = -1.5707963267949
Math.Asin(-0.5) = -0.523598775598299
Math.Asin(0) = 0
Math.Asin(0.5) = 0.523598775598299
Math.Asin(1) = 1.5707963267949
Math.Asin(2) = NaN
Math.Asin(Double.NaN) = NaN

❮ C# Math Methods