Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

c#

# What is Math.Atan() in C#? Arslan Bajwa

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

C# has a built-in Math class that provides useful mathematical functions and operations. The Math class has the Atan() function, which is used to compute the angle whose tangent comes out to be a specified number. It is also known as the inverse tangent of a specified number.

## Syntax

public static double Atan (double value);

## Parameters

• value: value is of the Double type and represents the input value, which is determined by finding Atan(). Its range is all real numbers.

## Return value

• Double: Atan() returns an angle Θ measured in radians, and of type Double, whose tangent is value.

• -π/2 <= Θ <= π/2 (radians)
• NaN: Atan() returns NaN type for value = NaN.

• -pi/2 if value is negative infinity.

• pi/2 if value is infinity.

Radians can be converted into degrees by multiplying radians by 180/Math.PI.

## Example

using System;class Educative{    static void Main()    {        Double result = Math.Atan(0);        System.Console.WriteLine("Atan(0) = "+ result + " radians");        Double result1 = Math.Atan(Double.PositiveInfinity);        System.Console.WriteLine("Atan(∞) = "+ result1 + " radians");        Double result2 = Math.Atan(400);        System.Console.WriteLine("Atan(400) = "+ result2 + " radians");        Double result3 = Math.Atan(Double.NegativeInfinity);        System.Console.WriteLine("Atan(-∞) = "+ result3+ " radians");        Double result4 = Math.Atan(Double.NaN);        System.Console.WriteLine("Atan(NaN) = "+ result4);    }}

RELATED TAGS

c#

CONTRIBUTOR Arslan Bajwa

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring

Learn in-demand tech skills in half the time 