From: jmt Date: Fri, 2 Jan 2009 12:34:28 +0000 (+0000) Subject: NaN fix by Csaba/Jester - prefer atan2(x,y) to atan(a/y). X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1a05695ff5bf34bdc407fa2647f07d4aca336204;p=flightgear.git NaN fix by Csaba/Jester - prefer atan2(x,y) to atan(a/y). --- diff --git a/src/AIModel/AICarrier.cxx b/src/AIModel/AICarrier.cxx index 1a9a1d2b7..979e9710b 100644 --- a/src/AIModel/AICarrier.cxx +++ b/src/AIModel/AICarrier.cxx @@ -514,7 +514,7 @@ void FGAICarrier::UpdateWind( double dt) { + (rel_wind_speed_from_north_kts * rel_wind_speed_from_north_kts)); //calculate the relative wind direction - rel_wind_from_deg = atan(rel_wind_speed_from_east_kts/rel_wind_speed_from_north_kts) + rel_wind_from_deg = atan2(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts) * SG_RADIANS_TO_DEGREES; // rationalise the output