code: func ToScale(input, min, max float64) float64 {
  	i := input*(math.Max(min, max)-math.Min(min, max)) + math.Min(min, max)
  	if i < math.Min(min, max) {
  		return math.Min(min, max)
  	} else if i > math.Max(min, max) {
  		return math.Max(min, max)
  	} else {
  		return i
  	}
  }
docs: // ToScale returns a converted input from 0...1 to min...max scale.
  // If input is less than min then ToScale returns min.
  // If input is greater than max then ToScale returns max