Program: 6211
Project: 6211
Buggy source:
public double doubleValue(){
  int kDigits=Math.min(nDigits,maxDecimalDigits + 1);
  long lValue;
  double dValue;
  double rValue, tValue;
  if (digits == infinity || digits == notANumber) {
    if (digits == notANumber)     return Double.NaN;
 else     return (isNegative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY);
  }
 else {
    if (mustSetRoundDir) {
      roundDir=0;
    }
    int iValue=(int)digits[0] - (int)'0';
    int iDigits=Math.min(kDigits,intDecimalDigits);
    for (int i=1; i < iDigits; i++) {
      iValue=iValue * 10 + (int)digits[i] - (int)'0';
    }
    lValue=(long)iValue;
    for (int i=iDigits; i < kDigits; i++) {
      lValue=lValue * 10L + (long)((int)digits[i] - (int)'0');
    }
    dValue=(double)lValue;
    int exp=decExponent - kDigits;
    if (nDigits <= maxDecimalDigits) {
      if (exp == 0 || dValue == 0.0)       return (isNegative) ? -dValue : dValue;
 else       if (exp >= 0) {
        if (exp <= maxSmallTen) {
          rValue=dValue * small10pow[exp];
          if (mustSetRoundDir) {
            tValue=rValue / small10pow[exp];
            roundDir=(tValue == dValue) ? 0 : (tValue < dValue) ? 1 : -1;
          }
          return (isNegative) ? -rValue : rValue;
        }
        int slop=maxDecimalDigits - kDigits;
        if (exp <= maxSmallTen + slop) {
          dValue*=small10pow[slop];
          rValue=dValue * small10pow[exp - slop];
          if (mustSetRoundDir) {
            tValue=rValue / small10pow[exp - slop];
            roundDir=(tValue == dValue) ? 0 : (tValue < dValue) ? 1 : -1;
          }
          return (isNegative) ? -rValue : rValue;
        }
      }
 else {
        if (exp >= -maxSmallTen) {
          rValue=dValue / small10pow[-exp];
          tValue=rValue * small10pow[-exp];
          if (mustSetRoundDir) {
            roundDir=(tValue == dValue) ? 0 : (tValue < dValue) ? 1 : -1;
          }
          return (isNegative) ? -rValue : rValue;
        }
      }
    }
    if (exp > 0) {
      if (decExponent > maxDecimalExponent + 1) {
        return (isNegative) ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
      }
      if ((exp & 15) != 0) {
        dValue*=small10pow[exp & 15];
      }
      if ((exp>>=4) != 0) {
        int j;
        for (j=0; exp > 1; j++, exp>>=1) {
          if ((exp & 1) != 0)           dValue*=big10pow[j];
        }
        double t=dValue * big10pow[j];
        if (Double.isInfinite(t)) {
          t=dValue / 2.0;
          t*=big10pow[j];
          if (Double.isInfinite(t)) {
            return (isNegative) ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
          }
          t=Double.MAX_VALUE;
        }
        dValue=t;
      }
    }
 else     if (exp < 0) {
      exp=-exp;
      if (decExponent < minDecimalExponent - 1) {
        return (isNegative) ? -0.0 : 0.0;
      }
      if ((exp & 15) != 0) {
        dValue/=small10pow[exp & 15];
      }
      if ((exp>>=4) != 0) {
        int j;
        for (j=0; exp > 1; j++, exp>>=1) {
          if ((exp & 1) != 0)           dValue*=tiny10pow[j];
        }
        double t=dValue * tiny10pow[j];
        if (t == 0.0) {
          t=dValue * 2.0;
          t*=tiny10pow[j];
          if (t == 0.0) {
            return (isNegative) ? -0.0 : 0.0;
          }
          t=Double.MIN_VALUE;
        }
        dValue=t;
      }
    }
    FDBigInt bigD0=new FDBigInt(lValue,digits,kDigits,nDigits);
    exp=decExponent - nDigits;
    correctionLoop:     while (true) {
      FDBigInt bigB=doubleToBigInt(dValue);
      int B2, B5;
      int D2, D5;
      int Ulp2;
      if (exp >= 0) {
        B2=B5=0;
        D2=D5=exp;
      }
 else {
        B2=B5=-exp;
        D2=D5=0;
      }
      if (bigIntExp >= 0) {
        B2+=bigIntExp;
      }
 else {
        D2-=bigIntExp;
      }
      Ulp2=B2;
      int hulpbias;
      if (bigIntExp + bigIntNBits <= -expBias + 1) {
        hulpbias=bigIntExp + expBias + expShift;
      }
 else {
        hulpbias=expShift + 2 - bigIntNBits;
      }
      B2+=hulpbias;
      D2+=hulpbias;
      int common2=Math.min(B2,Math.min(D2,Ulp2));
      B2-=common2;
      D2-=common2;
      Ulp2-=common2;
      bigB=multPow52(bigB,B5,B2);
      FDBigInt bigD=multPow52(new FDBigInt(bigD0),D5,D2);
      FDBigInt diff;
      int cmpResult;
      boolean overvalue;
      if ((cmpResult=bigB.cmp(bigD)) > 0) {
        overvalue=true;
        diff=bigB.sub(bigD);
        if ((bigIntNBits == 1) && (bigIntExp > -expBias)) {
          Ulp2-=1;
          if (Ulp2 < 0) {
            Ulp2=0;
            diff.lshiftMe(1);
          }
        }
      }
 else       if (cmpResult < 0) {
        overvalue=false;
        diff=bigD.sub(bigB);
      }
 else {
        break correctionLoop;
      }
      FDBigInt halfUlp=constructPow52(B5,Ulp2);
      if ((cmpResult=diff.cmp(halfUlp)) < 0) {
        if (mustSetRoundDir) {
          roundDir=overvalue ? -1 : 1;
        }
        break correctionLoop;
      }
 else       if (cmpResult == 0) {
        dValue+=0.5 * ulp(dValue,overvalue);
        if (mustSetRoundDir) {
          roundDir=overvalue ? -1 : 1;
        }
        break correctionLoop;
      }
 else {
        dValue+=ulp(dValue,overvalue);
        if (dValue == 0.0 || dValue == Double.POSITIVE_INFINITY)         break correctionLoop;
        continue;
      }
    }
    return (isNegative) ? -dValue : dValue;
  }
}

Fixed version (ground truth):
public double doubleValue(){
  int kDigits=Math.min(nDigits,maxDecimalDigits + 1);
  long lValue;
  double dValue;
  double rValue, tValue;
  if (digits == infinity || digits == notANumber) {
    if (digits == notANumber)     return Double.NaN;
 else     return (isNegative ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY);
  }
 else {
    if (mustSetRoundDir) {
      roundDir=0;
    }
    int iValue=(int)digits[0] - (int)'0';
    int iDigits=Math.min(kDigits,intDecimalDigits);
    for (int i=1; i < iDigits; i++) {
      iValue=iValue * 10 + (int)digits[i] - (int)'0';
    }
    lValue=(long)iValue;
    for (int i=iDigits; i < kDigits; i++) {
      lValue=lValue * 10L + (long)((int)digits[i] - (int)'0');
    }
    dValue=(double)lValue;
    int exp=decExponent - kDigits;
    if (nDigits <= maxDecimalDigits) {
      if (exp == 0 || dValue == 0.0)       return (isNegative) ? -dValue : dValue;
 else       if (exp >= 0) {
        if (exp <= maxSmallTen) {
          rValue=dValue * small10pow[exp];
          if (mustSetRoundDir) {
            tValue=rValue / small10pow[exp];
            roundDir=(tValue == dValue) ? 0 : (tValue < dValue) ? 1 : -1;
          }
          return (isNegative) ? -rValue : rValue;
        }
        int slop=maxDecimalDigits - kDigits;
        if (exp <= maxSmallTen + slop) {
          dValue*=small10pow[slop];
          rValue=dValue * small10pow[exp - slop];
          if (mustSetRoundDir) {
            tValue=rValue / small10pow[exp - slop];
            roundDir=(tValue == dValue) ? 0 : (tValue < dValue) ? 1 : -1;
          }
          return (isNegative) ? -rValue : rValue;
        }
      }
 else {
        if (exp >= -maxSmallTen) {
          rValue=dValue / small10pow[-exp];
          tValue=rValue * small10pow[-exp];
          if (mustSetRoundDir) {
            roundDir=(tValue == dValue) ? 0 : (tValue < dValue) ? 1 : -1;
          }
          return (isNegative) ? -rValue : rValue;
        }
      }
    }
    if (exp > 0) {
      if (decExponent > maxDecimalExponent + 1) {
        return (isNegative) ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
      }
      if ((exp & 15) != 0) {
        dValue*=small10pow[exp & 15];
      }
      if ((exp>>=4) != 0) {
        int j;
        for (j=0; exp > 1; j++, exp>>=1) {
          if ((exp & 1) != 0)           dValue*=big10pow[j];
        }
        double t=dValue * big10pow[j];
        if (Double.isInfinite(t)) {
          t=dValue / 2.0;
          t*=big10pow[j];
          if (Double.isInfinite(t)) {
            return (isNegative) ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
          }
          t=Double.MAX_VALUE;
        }
        dValue=t;
      }
    }
 else     if (exp < 0) {
      exp=-exp;
      if (decExponent < minDecimalExponent - 1) {
        return (isNegative) ? -0.0 : 0.0;
      }
      if ((exp & 15) != 0) {
        dValue/=small10pow[exp & 15];
      }
      if ((exp>>=4) != 0) {
        int j;
        for (j=0; exp > 1; j++, exp>>=1) {
          if ((exp & 1) != 0)           dValue*=tiny10pow[j];
        }
        double t=dValue * tiny10pow[j];
        if (t == 0.0) {
          t=dValue * 2.0;
          t*=tiny10pow[j];
          if (t == 0.0) {
            return (isNegative) ? -0.0 : 0.0;
          }
          t=Double.MIN_VALUE;
        }
        dValue=t;
      }
    }
    dValue=correctionLoop(kDigits,lValue,dValue);
    return (isNegative) ? -dValue : dValue;
  }
}