Fix bug in SGMisc<T>:: normalizePeriodic()

SGMisc<T>::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().
This commit is contained in:
Torsten Dreyer
2011-01-17 19:51:29 +01:00
parent 7d544dee47
commit e988dc0e42

View File

@@ -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;