How to use atan() function to compute the principal value of the arc tangent of N in Java

1 Answer

0 votes
package javaapplication1;
 
public class Example {
    public static void main(String[] args) {

        System.out.format("Math.atan(1.0) = %f\n", Math.atan(1.0));
        System.out.format("Math.atan(-1.0) = %f\n", Math.atan(-1.0));
        System.out.format("Math.atan(0.0) = %f\n", Math.atan(0.0));
        System.out.format("Math.atan(-0.0) = %f\n", Math.atan(-0.0));
        System.out.format("Math.atan(Infinity) = %f\n", Math.atan(Double.POSITIVE_INFINITY));
    }
}
 
/*
run:
  
Math.atan(1.0) = 0.785398
Math.atan(-1.0) = -0.785398
Math.atan(0.0) = 0.000000
Math.atan(-0.0) = -0.000000
Math.atan(Infinity) = 1.570796
  
*/

 



answered Apr 4, 2016 by avibootz
...