Re: [Flightgear-devel] possible bug in oursun.cxx
Torsten Dreyer wrote: Hi, There are some possible floating point exceptions in oursun.cxx: in SGSun::update(double,double) there is sun_exp2_punch_through = 2.0/log(visibility); visibility is assigned the new_visibility _before_ new_visibility is clamped to 100 % 45000. Because update is called by SGSun::build with a new_visibility of 1, log(1) equals zero which results in division by zero. And further down, the aerosol factor fails, if visibility was clamped to a minimum of 100, because this aerosol_factor = 80.5 / log( visibility / 100 ); will be 80.5 / log ( 100/100 ) = 80.5 / log(1) = 80.5 / 0 Good catch! I should have been using new_visibility throughout the code since that's the one that gets clamped. Thanks for the heads up. Erik -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel
[Flightgear-devel] possible bug in oursun.cxx
Hi, There are some possible floating point exceptions in oursun.cxx: in SGSun::update(double,double) there is sun_exp2_punch_through = 2.0/log(visibility); visibility is assigned the new_visibility _before_ new_visibility is clamped to 100 % 45000. Because update is called by SGSun::build with a new_visibility of 1, log(1) equals zero which results in division by zero. And further down, the aerosol factor fails, if visibility was clamped to a minimum of 100, because this aerosol_factor = 80.5 / log( visibility / 100 ); will be 80.5 / log ( 100/100 ) = 80.5 / log(1) = 80.5 / 0 Greetings, Torsten -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel