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


The C# Math Atan() method is used to return arc tangent of a value. The return value will be in the range -𝜋/2 through 𝜋/2. In special cases it returns the following:

  • If the argument is NaN, the method returns NaN.

Note: Atan() is the inverse of tan().

Syntax

public static double Atan(double arg);

Parameters

arg Specify the value.

Return Value

Returns the arc tangent of the value.

Example:

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

using System;

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

The output of the above code will be:

0.463647609000806
0.785398163397448
1.10714871779409

❮ C# Math Methods