Index: /trunk/Ohana/src/libohana/src/coordops.c
===================================================================
--- /trunk/Ohana/src/libohana/src/coordops.c	(revision 4715)
+++ /trunk/Ohana/src/libohana/src/coordops.c	(revision 4716)
@@ -12,5 +12,5 @@
   int Zenith1, Zenith2, Zenithal, Polynomial, Cartesian, PseudoCyl;
   char *type;
-  double L, M, X, Y, T, Z;
+  double L, M, X, Y, T, Z, Z2;
   double R, sphi, cphi, stht, ctht;
   double alpha, delta, salp, calp, sdel, sdp, cdp;
@@ -113,6 +113,8 @@
   if (PseudoCyl) {
     if (!strcmp(type, "-AIT")) {
-      Z = sqrt (1.0 - SQ(RAD_DEG*0.25*L) - SQ(RAD_DEG*0.5*M));
-      alpha = 2.0 * DEG_RAD * atan2 (RAD_DEG*0.5*Z*L, 2.0*SQ(Z) - 1.0);
+      Z2 = (1.0 - SQ(RAD_DEG*0.25*L) - SQ(RAD_DEG*0.5*M));
+      if (Z2 < 0) return (FALSE);
+      Z = sqrt (Z2);
+      alpha = 2.0 * DEG_RAD * atan2 (RAD_DEG*0.5*Z*L, 2.0*Z2 - 1.0);
       delta = DEG_RAD * asin (RAD_DEG*M*Z);
       *ra  = alpha + coords[0].crval1;
