From: ehofman Date: Mon, 6 Apr 2009 19:24:29 +0000 (+0000) Subject: Fix a NaN at higher altitudes: sin_beta could become greater than 1.0 which is hard... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=58f3985567a8df801a04a757e0466f8c74f43061;p=simgear.git Fix a NaN at higher altitudes: sin_beta could become greater than 1.0 which is hard to understand for asin. --- diff --git a/simgear/scene/sky/oursun.cxx b/simgear/scene/sky/oursun.cxx index 4ace0529..67bbc723 100644 --- a/simgear/scene/sky/oursun.cxx +++ b/simgear/scene/sky/oursun.cxx @@ -396,6 +396,7 @@ bool SGSun::reposition( double rightAscension, double declination, double gamma = SG_PI - sun_angle; double sin_beta = ( position_radius * sin ( gamma ) ) / r_tropo; + if (sin_beta > 1.0) sin_beta = 1.0; double alpha = SG_PI - gamma - asin( sin_beta ); // OK, now let's calculate the distance the light travels