code: func getPercentileValue(datapoints []schema.Point, n float64, sortedDatapointVals []float64) float64 {
  	sortedDatapointVals = sortedDatapointVals[:0]
  	for _, p := range datapoints {
  		if !math.IsNaN(p.Val) {
  			sortedDatapointVals = append(sortedDatapointVals, p.Val)
  		}
  	}
  
  	sort.Float64s(sortedDatapointVals)
  
  	index := math.Min(math.Ceil(n/100.0*float64(len(sortedDatapointVals)+1)), float64(len(sortedDatapointVals))) - 1
  
  	return sortedDatapointVals[int(index)]
  }
docs: // sortedDatapointVals is an empty slice to be used for sorting datapoints.
  // n must be > 0. if n > 100, the largest value is returned.