]> git.mxchange.org Git - flightgear.git/commitdiff
Patch in fgGeoc2Geod() to avoid a floating explosion.
authorcurt <curt>
Fri, 20 Nov 1998 01:00:36 +0000 (01:00 +0000)
committercurt <curt>
Fri, 20 Nov 1998 01:00:36 +0000 (01:00 +0000)
point3d.hxx include math.h for FreeBSD

Math/fg_geodesy.cxx
Math/point3d.hxx

index ac7fa9bb967029152a558135f99c2f8af568cd40..b6d1a214d4e4f7f9fdcb5f62a3669a47b1cc3da4 100644 (file)
@@ -48,7 +48,9 @@ void fgGeocToGeod( double lat_geoc, double radius, double
     } 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;
@@ -154,6 +156,10 @@ void fgGeodToGeoc( double lat_geod, double alt, double *sl_radius,
 
 $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()
 
@@ -236,6 +242,10 @@ Initial Flight Gear revision.
 
 
 // $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()
 //
index ba43a8c0799d23ef5f7ab03cf513d641c291bc69..30054bd0fdf75e883777786b49e6d0c744c4cb6a 100644 (file)
@@ -33,6 +33,8 @@
 
 #include <iostream>
 #include <assert.h>
+#include <math.h>
+
 
 const double fgPoint3_Epsilon = 0.0000001;
 
@@ -293,6 +295,10 @@ Point3D::distance3D(const Point3D& a ) const
 
 
 // $Log$
+// Revision 1.5  1998/11/20 01:00:38  curt
+// Patch in fgGeoc2Geod() to avoid a floating explosion.
+// point3d.hxx include math.h for FreeBSD
+//
 // Revision 1.4  1998/11/11 00:18:38  curt
 // Check for domain error in fgGeoctoGeod()
 //