code: func determineDistance(value, target float64) float64 {
  	if math.IsInf(target, 1) { // positive infinity
  		target = math.MaxFloat64
  	} else if math.IsInf(target, -1) { // negative infinity
  		target = -math.MaxFloat64
  	}
  
  	return math.Abs(target - value)
  }
docs: // determineDistance will determine the distance between the value
  // and the target.  If the target is positive or negative infinity,
  // (ie find max or min), this is clamped to max or min float64.