Program: 57393
Project: 57393
Buggy source:
/** 
 * For this distribution, X, this method returns the critical point x, such that P(X &lt; x) = <code>p</code>.
 * @param p the desired probability
 * @return x, such that P(X &lt; x) = <code>p</code>
 * @throws MathException if the inverse cumulative probability can not becomputed due to convergence or other numerical errors.
 * @throws IllegalArgumentException if <code>p</code> is not a validprobability.
 */
public double inverseCumulativeProbability(final double p) throws MathException {
  if (p < 0.0 || p > 1.0) {
    throw MathRuntimeException.createIllegalArgumentException("String_Node_Str",p,0.0,1.0);
  }
  UnivariateRealFunction rootFindingFunction=new UnivariateRealFunction(){
    public double value(    double x) throws FunctionEvaluationException {
      try {
        return cumulativeProbability(x) - p;
      }
 catch (      MathException ex) {
        throw new FunctionEvaluationException(ex,x,ex.getPattern(),ex.getArguments());
      }
    }
  }
;
  double lowerBound=getDomainLowerBound(p);
  double upperBound=getDomainUpperBound(p);
  double[] bracket=null;
  try {
    bracket=UnivariateRealSolverUtils.bracket(rootFindingFunction,getInitialDomain(p),lowerBound,upperBound);
  }
 catch (  ConvergenceException ex) {
    if (Math.abs(rootFindingFunction.value(lowerBound)) < 1E-6) {
      return lowerBound;
    }
    if (Math.abs(rootFindingFunction.value(upperBound)) < 1E-6) {
      return upperBound;
    }
    throw new MathException(ex);
  }
  double root=UnivariateRealSolverUtils.solve(rootFindingFunction,bracket[0],bracket[1]);
  return root;
}

Fixed version (ground truth):
/** 
 * For this distribution, X, this method returns the critical point x, such that P(X &lt; x) = <code>p</code>.
 * @param p the desired probability
 * @return x, such that P(X &lt; x) = <code>p</code>
 * @throws MathException if the inverse cumulative probability can not becomputed due to convergence or other numerical errors.
 * @throws IllegalArgumentException if <code>p</code> is not a validprobability.
 */
public double inverseCumulativeProbability(final double p) throws MathException {
  if (p < 0.0 || p > 1.0) {
    throw MathRuntimeException.createIllegalArgumentException("String_Node_Str",p,0.0,1.0);
  }
  UnivariateRealFunction rootFindingFunction=new UnivariateRealFunction(){
    public double value(    double x) throws FunctionEvaluationException {
      double ret=Double.NaN;
      try {
        ret=cumulativeProbability(x) - p;
      }
 catch (      MathException ex) {
        throw new FunctionEvaluationException(ex,x,ex.getPattern(),ex.getArguments());
      }
      if (Double.isNaN(ret)) {
        throw new FunctionEvaluationException(x,"String_Node_Str",x,p);
      }
      return ret;
    }
  }
;
  double lowerBound=getDomainLowerBound(p);
  double upperBound=getDomainUpperBound(p);
  double[] bracket=null;
  try {
    bracket=UnivariateRealSolverUtils.bracket(rootFindingFunction,getInitialDomain(p),lowerBound,upperBound);
  }
 catch (  ConvergenceException ex) {
    if (Math.abs(rootFindingFunction.value(lowerBound)) < 1E-6) {
      return lowerBound;
    }
    if (Math.abs(rootFindingFunction.value(upperBound)) < 1E-6) {
      return upperBound;
    }
    throw new MathException(ex);
  }
  double root=UnivariateRealSolverUtils.solve(rootFindingFunction,bracket[0],bracket[1],getSolverAbsoluteAccuracy());
  return root;
}