private void checkQuantileError(double[] data,double value,double quantile,double tolerance,double referenceValue){
  final double n=(double)data.length;
  int nLess=0;
  for (  double val : data) {
    if (val < value) {
      nLess++;
    }
  }
  if (Double.isNaN(referenceValue)) {
    assertTrue(Double.isNaN(value));
  }
 else   if (Double.isInfinite(value)) {
    assertTrue(value == referenceValue);
  }
 else {
    assertTrue("Quantile error exceeded: value returned = " + value + " Reference value = "+ referenceValue+ " quantile = "+ quantile+ " n = "+ n+ " error = "+ (quantile - (double)nLess / n),FastMath.abs(quantile - (double)nLess / n) < tolerance);
  }
}

private void checkQuantileError ( double [ ] data , double value , double quantile , double tolerance , double referenceValue ) { final double n = ( double ) data . length ; int nLess = 0 ; for ( double val : data ) { if ( val < value ) { nLess ++ ; } } if ( Double . isNaN ( referenceValue ) ) { assertTrue ( Double . isNaN ( value ) ) ; } else if ( Double . isInfinite ( value ) ) { assertTrue ( value == referenceValue ) ; } else { assertTrue ( "Quantile error exceeded: value returned = " + value + " Reference value = " + referenceValue + " quantile = " + quantile + " n = " + n + " error = " + ( quantile - ( double ) nLess / n ) , FastMath . abs ( quantile - ( double ) nLess / n ) < tolerance ) ; } }
checks to make sure that the actual quantile position ( normalized rank ) of value is within tolerance of quantile
