public static double Asec(double x) { double u = x * x - 1; return 2 * Math.Atan(1) - Math.Atan2(Math.Sign(x), u * u); }