wrapNum function
Implementation
double wrapNum(double x, Tuple2<double, double> range, [bool? includeMax]) {
var max = range.item2;
var min = range.item1;
var d = max - min;
return x == max && includeMax != null ? x : ((x - min) % d + d) % d + min;
}