Facebook Page Twitter Page LinkedIn Page
× C# Tutorial C# Advanced C# Resources


The C# Math Acos() method returns arc cosine of a value. The return value will be in the range 0 through 𝜋. 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: Acos() is the inverse of cos().

Syntax

public static double Acos(double arg);

Parameters

arg Specify the value.

Return Value

Returns the arc cosine of the value.

Example:

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

using System;

class MyProgram {
  static void Main(string[] args) {
   Console.WriteLine(Math.Acos(0.5));
   Console.WriteLine(Math.Acos(1));
   Console.WriteLine(Math.Acos(2));
  }
}

The output of the above code will be:

1.0471975511966
0
NaN

❮ C# Math Methods