Java Math atan() Method

java math atan() method

Java Math Class

Java Math class provides several methods to perform several operations on math calculations like max(), min(), sin(), cos(), round(), ceil(), floor(), abs() etc.
The java.lang.Math class contains various methods for performing basic numeric operations

Here, in the page we will discuss about the atan() Method in java.

Java Math atan() Method :

The arc tangent of the given value is returned by the Java Math atan() method.
The inverse of the tangent function is the arc tangent.

Note:If the argument is zero, the result will also be zero with the same sign.

Syntax  :

public static double atan(double a)

clear() Function in ArrayList

clone() Function in ArrayList

add() Function in ArrayList

addall() Function in ArrayList

Example 1 for Positive Numbers :  

Run

public class Main{
    public static void main(String[] args) {
        
        //declaring variables
        double x = 45.0;
        double y = 30.0;
        double z = 60.0;
        double e = 0.0;


        //inpitting a positive value
        //outputing a positive value

        System.out.println("Math.atan(" + x + ") = " + Math.atan(x));
        System.out.println("Math.atan(" + y + ") = " + Math.atan(y));
        System.out.println("Math.atan(" + z + ") = " + Math.atan(z));
        System.out.println("Math.atan(" + e + ") = " + Math.atan(e));
    }
}
    

Output :

Math.atan(45.0) = 1.5485777614681775
Math.atan(30.0) = 1.5374753309166493
Math.atan(-60.0) = -1.554131203080956
Math.atan(-0.0) = -0.P

Example 2 for Negative Numbers :  

Run
public class Main{
    public static void main(String[] args) {
        
        //declaring negative variables
        double x = -50.0;
        double y = -75.0;
        double z = -55.0;
        double e = -0.0;
        
        //inpitting a negative value
        //outputing a negative value
        System.out.println("Math.atan(" + x + ") = " + Math.atan(x));
        System.out.println("Math.atan(" + y + ") = " + Math.atan(y));
        System.out.println("Math.atan(" + z + ") = " + Math.atan(z));
        System.out.println("Math.atan(" + e + ") = " + Math.atan(e));
    }
}    

Output :

Math.atan(-50.0) = -1.550798992821746
Math.atan(-75.0) = -1.557463783500751
Math.atan(-55.0) = -1.5526165117219184
Math.atan(-0.0) = -0.0

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription