C# Tutorial C# Advanced C# Resources
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

C# - Math Atan() Method



The C# Math Atan() method returns 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 example below, 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

5