From 17ccf72e441d8e97a0eaeb43faf5d9a17795be64 Mon Sep 17 00:00:00 2001 From: timoore Date: Thu, 8 Jan 2009 07:57:04 +0000 Subject: [PATCH] =?UTF-8?q?Divide-by-zero=20fixes=20from=20Csaba=20Hal?= =?UTF-8?q?=C3=A1sz?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Instrumentation/heading_indicator.cxx | 4 ++-- src/Instrumentation/heading_indicator_dg.cxx | 4 ++-- src/Instrumentation/heading_indicator_fg.cxx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Instrumentation/heading_indicator.cxx b/src/Instrumentation/heading_indicator.cxx index b92d99086..10f25e799 100644 --- a/src/Instrumentation/heading_indicator.cxx +++ b/src/Instrumentation/heading_indicator.cxx @@ -87,7 +87,7 @@ HeadingIndicator::update (double dt) // Next, calculate the indicated heading, // introducing errors. - double factor = 0.01 / (spin * spin * spin * spin * spin * spin); + double factor = 100 * (spin * spin * spin * spin * spin * spin); double heading = _heading_in_node->getDoubleValue(); // Now, we have to get the current @@ -98,7 +98,7 @@ HeadingIndicator::update (double dt) while ((heading - _last_heading_deg) < -180) _last_heading_deg -= 360; - heading = fgGetLowPass(_last_heading_deg, heading, dt/factor); + heading = fgGetLowPass(_last_heading_deg, heading, dt * factor); _last_heading_deg = heading; heading += offset; diff --git a/src/Instrumentation/heading_indicator_dg.cxx b/src/Instrumentation/heading_indicator_dg.cxx index 036caf47c..d9923c2e5 100644 --- a/src/Instrumentation/heading_indicator_dg.cxx +++ b/src/Instrumentation/heading_indicator_dg.cxx @@ -108,7 +108,7 @@ HeadingIndicatorDG::update (double dt) // Next, calculate the indicated heading, // introducing errors. - double factor = 0.01 / (spin * spin * spin * spin * spin * spin); + double factor = 100 * (spin * spin * spin * spin * spin * spin); double heading = _heading_in_node->getDoubleValue(); // Now, we have to get the current @@ -119,7 +119,7 @@ HeadingIndicatorDG::update (double dt) while ((heading - _last_heading_deg) < -180) _last_heading_deg -= 360; - heading = fgGetLowPass(_last_heading_deg, heading, dt/factor); + heading = fgGetLowPass(_last_heading_deg, heading, dt * factor); _last_heading_deg = heading; heading += offset; diff --git a/src/Instrumentation/heading_indicator_fg.cxx b/src/Instrumentation/heading_indicator_fg.cxx index 01d33892d..e35df2d63 100644 --- a/src/Instrumentation/heading_indicator_fg.cxx +++ b/src/Instrumentation/heading_indicator_fg.cxx @@ -109,7 +109,7 @@ HeadingIndicatorFG::update (double dt) // Next, calculate the indicated heading, // introducing errors. - double factor = 0.01 / (spin * spin * spin * spin * spin * spin); + double factor = 100 * (spin * spin * spin * spin * spin * spin); double heading = _heading_in_node->getDoubleValue(); // Now, we have to get the current @@ -120,7 +120,7 @@ HeadingIndicatorFG::update (double dt) while ((heading - _last_heading_deg) < -180) _last_heading_deg -= 360; - heading = fgGetLowPass(_last_heading_deg, heading, dt/factor); + heading = fgGetLowPass(_last_heading_deg, heading, dt * factor); _last_heading_deg = heading; heading += offset;