#include <math.h>
+#include <errno.h>
#include <Include/fg_constants.h>
#include <Math/fg_geodesy.hxx>
} else {
t_lat = tan(lat_geoc);
x_alpha = E*EQUATORIAL_RADIUS_M/sqrt(t_lat*t_lat + E*E);
- mu_alpha = atan2(sqrt(RESQ_M - x_alpha*x_alpha),E*x_alpha);
+ double tmp = RESQ_M - x_alpha * x_alpha;
+ if ( tmp < 0.0 ) { tmp = 0.0; }
+ mu_alpha = atan2(sqrt(tmp),E*x_alpha);
if (lat_geoc < 0) mu_alpha = - mu_alpha;
sin_mu_a = sin(mu_alpha);
delt_lambda = mu_alpha - lat_geoc;
r_alpha = x_alpha/cos(lat_geoc);
l_point = radius - r_alpha;
*alt = l_point*cos(delt_lambda);
+
+ // check for domain error
+ if ( errno == EDOM ) {
+ cout << "Domain ERROR in fgGeocToGeod!!!!\n";
+ *alt = 0.0;
+ }
+
denom = sqrt(1-EPS*EPS*sin_mu_a*sin_mu_a);
rho_alpha = EQUATORIAL_RADIUS_M*(1-EPS)/
(denom*denom*denom);
sin_lambda_sl = sin( lambda_sl );
*sea_level_r =
sqrt(RESQ_M / (1 + ((1/(E*E))-1)*sin_lambda_sl*sin_lambda_sl));
+
+ // check for domain error
+ if ( errno == EDOM ) {
+ cout << "Domain ERROR in fgGeocToGeod!!!!\n";
+ *sea_level_r = 0.0;
+ }
}
+
}
$Header$
$Log$
+Revision 1.4 1998/11/20 01:00:36 curt
+Patch in fgGeoc2Geod() to avoid a floating explosion.
+point3d.hxx include math.h for FreeBSD
+
+Revision 1.3 1998/11/11 00:18:36 curt
+Check for domain error in fgGeoctoGeod()
+
Revision 1.2 1998/10/16 23:36:36 curt
c++-ifying.
// $Log$
+// Revision 1.4 1998/11/20 01:00:36 curt
+// Patch in fgGeoc2Geod() to avoid a floating explosion.
+// point3d.hxx include math.h for FreeBSD
+//
+// Revision 1.3 1998/11/11 00:18:36 curt
+// Check for domain error in fgGeoctoGeod()
+//
// Revision 1.2 1998/10/16 23:36:36 curt
// c++-ifying.
//