- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Math.Atan() Method in C#
The Math.Atan() method in C# is used to return the angle whose tan is the specified number. The number is a double value argument. The method returns an angle, θ, measured in radians, such that -Π/2 ≤θ≤Π/2.
Syntax
Following is the syntax −
public static double Atan(double num)
Example
Let us now see an example to implement the Math.Atan() method −
using System; public class Demo { public static void Main(){ double val1 = 0.0; double val2 = 1.0; Console.WriteLine("Return value of {0} : {1}", val1, Math.Atan(val1)); Console.WriteLine("Return value of {0} : {1}", val2, Math.Atan(val2)); } }
Output
This will produce the following output −
Return value of 0 : 0 Return value of 1 : 0.785398163397448
Example
Let us see another example to implement the Math.Atan() method −
using System; public class Demo { public static void Main(){ double val1 = Double.PositiveInfinity; double val2 = Double.NegativeInfinity; Console.WriteLine("Return value of {0} : {1}", val1, Math.Atan(val1)); Console.WriteLine("Return value of {0} : {1}", val2, Math.Atan(val2)); } }
Output
This will produce the following output −
Return value of ∞ : 1.5707963267949 Return value of -∞ : -1.5707963267949
Advertisements