Here you can find the source of atanAlternative(double y, double x)
private static double atanAlternative(double y, double x)
//package com.java2s; //License from project: Apache License public class Main { private final static double piHalf = Math.PI / 2; private static double atanAlternative(double y, double x) { if (x == 0) { if (y < 0) { return -piHalf; } else { return piHalf; }//w ww . j a v a2 s. co m } return Math.atan(y / x); } }