From e988dc0e421744fe71b7cdc74b8ff081becfc31d Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Mon, 17 Jan 2011 19:51:29 +0100 Subject: [PATCH] Fix bug in SGMisc:: normalizePeriodic() SGMisc::normalizePeriodic(min,max,value) returned zero for all values less than min. Example: A call of normalizePeriodic(0,twopi(),-pi()) returned zero where the correct value would be 3*pi(). --- simgear/math/SGMisc.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simgear/math/SGMisc.hxx b/simgear/math/SGMisc.hxx index a154d632..89417cb3 100644 --- a/simgear/math/SGMisc.hxx +++ b/simgear/math/SGMisc.hxx @@ -65,7 +65,7 @@ public: return min; T normalized = value - range*floor((value - min)/range); // two security checks that can only happen due to roundoff - if (value <= min) + if (normalized <= min) return min; if (max <= normalized) return min; -- 2.39.5