code: func (s Sample) Bounds() (min float64, max float64) {
  	if len(s.Xs) == 0 || (!s.Sorted && s.Weights == nil) {
  		return Bounds(s.Xs)
  	}
  
  	if s.Sorted {
  		if s.Weights == nil {
  			return s.Xs[0], s.Xs[len(s.Xs)-1]
  		}
  		min, max = math.NaN(), math.NaN()
  		for i, w := range s.Weights {
  			if w != 0 {
  				min = s.Xs[i]
  				break
  			}
  		}
  		if math.IsNaN(min) {
  			return
  		}
  		for i := range s.Weights {
  			if s.Weights[len(s.Weights)-i-1] != 0 {
  				max = s.Xs[len(s.Weights)-i-1]
  				break
  			}
  		}
  	} else {
  		min, max = math.Inf(1), math.Inf(-1)
  		for i, x := range s.Xs {
  			w := s.Weights[i]
  			if x < min && w != 0 {
  				min = x
  			}
  			if x > max && w != 0 {
  				max = x
  			}
  		}
  		if math.IsInf(min, 0) {
  			min, max = math.NaN(), math.NaN()
  		}
  	}
  	return
  }
docs: // Bounds returns the minimum and maximum values of the Sample.
  //
  // If the Sample is weighted, this ignores samples with zero weight.
  //
  // This is constant time if s.Sorted and there are no zero-weighted
  // values.