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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user