public static double atan2(double arg1, double arg2)
    {
        // both are 0 or arg1 is +/- inf
        if(arg1+arg2 == arg1) {
            if(arg1 > 0) {
                return PIO2;
            }
            if(arg1 < 0) {
                return -PIO2;
            }
            return 0;
        }
        arg1 = atan(arg1/arg2);
        if(arg2 < 0) {
            if(arg1 <= 0) {
                return arg1 + Math.PI;
            }
            return arg1 - Math.PI;
        }
        return arg1;
    }
Rounds to keep <em>precision</em> decimals. Rounds towards even numbers.
@param x the number to round
@param precision the precision to round to. A precision of 3 will for instance round 1.65432 to 1.654
@return the rounded number
main/src/main/java/cgeo/geocaching/wherigo/kahlua/stdlib/MathLib.java