Program: 18366
Project: 18366
Buggy source:
@Override protected void calcMinMax(){
  if (mAutoScaleMinMaxEnabled)   mData.calcMinMax(getLowestVisibleXIndex(),getHighestVisibleXIndex());
  float minLeft=mData.getYMin(AxisDependency.LEFT);
  float maxLeft=mData.getYMax(AxisDependency.LEFT);
  float minRight=mData.getYMin(AxisDependency.RIGHT);
  float maxRight=mData.getYMax(AxisDependency.RIGHT);
  float leftRange=Math.abs(maxLeft - (mAxisLeft.isStartAtZeroEnabled() ? 0 : minLeft));
  float rightRange=Math.abs(maxRight - (mAxisRight.isStartAtZeroEnabled() ? 0 : minRight));
  if (leftRange == 0f) {
    maxLeft=maxLeft + 1f;
    if (!mAxisLeft.isStartAtZeroEnabled())     minLeft=minLeft - 1f;
  }
  if (rightRange == 0f) {
    maxRight=maxRight + 1f;
    if (!mAxisRight.isStartAtZeroEnabled())     minRight=minRight - 1f;
  }
  float topSpaceLeft=leftRange / 100f * mAxisLeft.getSpaceTop();
  float topSpaceRight=rightRange / 100f * mAxisRight.getSpaceTop();
  float bottomSpaceLeft=leftRange / 100f * mAxisLeft.getSpaceBottom();
  float bottomSpaceRight=rightRange / 100f * mAxisRight.getSpaceBottom();
  mXChartMax=mData.getXVals().size() - 1;
  mDeltaX=Math.abs(mXChartMax - mXChartMin);
  mAxisLeft.mAxisMaximum=!Float.isNaN(mAxisLeft.getAxisMaxValue()) ? mAxisLeft.getAxisMaxValue() : maxLeft + topSpaceLeft;
  mAxisRight.mAxisMaximum=!Float.isNaN(mAxisRight.getAxisMaxValue()) ? mAxisRight.getAxisMaxValue() : maxRight + topSpaceRight;
  mAxisLeft.mAxisMinimum=!Float.isNaN(mAxisLeft.getAxisMinValue()) ? mAxisLeft.getAxisMinValue() : minLeft - bottomSpaceLeft;
  mAxisRight.mAxisMinimum=!Float.isNaN(mAxisRight.getAxisMinValue()) ? mAxisRight.getAxisMinValue() : minRight - bottomSpaceRight;
  if (mAxisLeft.isStartAtZeroEnabled()) {
    if (mAxisLeft.mAxisMinimum < 0f && mAxisLeft.mAxisMaximum < 0f) {
      mAxisLeft.mAxisMaximum=0f;
    }
 else     if (mAxisLeft.mAxisMinimum >= 0f) {
      mAxisLeft.mAxisMinimum=0f;
    }
  }
  if (mAxisRight.isStartAtZeroEnabled()) {
    if (mAxisRight.mAxisMinimum < 0.0 && mAxisRight.mAxisMaximum < 0.0) {
      mAxisRight.mAxisMaximum=0f;
    }
 else     if (mAxisRight.mAxisMinimum >= 0f) {
      mAxisRight.mAxisMinimum=0f;
    }
  }
  mAxisLeft.mAxisRange=Math.abs(mAxisLeft.mAxisMaximum - mAxisLeft.mAxisMinimum);
  mAxisRight.mAxisRange=Math.abs(mAxisRight.mAxisMaximum - mAxisRight.mAxisMinimum);
}

Fixed version (ground truth):
@Override protected void calcMinMax(){
  if (mAutoScaleMinMaxEnabled)   mData.calcMinMax(getLowestVisibleXIndex(),getHighestVisibleXIndex());
  float minLeft=mData.getYMin(AxisDependency.LEFT);
  float maxLeft=mData.getYMax(AxisDependency.LEFT);
  float minRight=mData.getYMin(AxisDependency.RIGHT);
  float maxRight=mData.getYMax(AxisDependency.RIGHT);
  float leftRange=Math.abs(maxLeft - (mAxisLeft.isStartAtZeroEnabled() ? 0 : minLeft));
  float rightRange=Math.abs(maxRight - (mAxisRight.isStartAtZeroEnabled() ? 0 : minRight));
  if (leftRange == 0f) {
    maxLeft=maxLeft + 1f;
    if (!mAxisLeft.isStartAtZeroEnabled())     minLeft=minLeft - 1f;
  }
  if (rightRange == 0f) {
    maxRight=maxRight + 1f;
    if (!mAxisRight.isStartAtZeroEnabled())     minRight=minRight - 1f;
  }
  float topSpaceLeft=leftRange / 100f * mAxisLeft.getSpaceTop();
  float topSpaceRight=rightRange / 100f * mAxisRight.getSpaceTop();
  float bottomSpaceLeft=leftRange / 100f * mAxisLeft.getSpaceBottom();
  float bottomSpaceRight=rightRange / 100f * mAxisRight.getSpaceBottom();
  mXChartMax=mData.getXVals().size() - 1;
  mDeltaX=Math.abs(mXChartMax - mXChartMin);
  if (mAxisLeft.isStartAtZeroEnabled()) {
    if (minLeft < 0.f && maxLeft < 0.f) {
      mAxisLeft.mAxisMinimum=Math.min(0.f,!Float.isNaN(mAxisLeft.getAxisMinValue()) ? mAxisLeft.getAxisMinValue() : (minLeft - bottomSpaceLeft));
      mAxisLeft.mAxisMaximum=0.f;
    }
 else     if (minLeft >= 0.0) {
      mAxisLeft.mAxisMinimum=0.f;
      mAxisLeft.mAxisMaximum=Math.max(0.f,!Float.isNaN(mAxisLeft.getAxisMaxValue()) ? mAxisLeft.getAxisMaxValue() : (maxLeft + topSpaceLeft));
    }
 else {
      mAxisLeft.mAxisMinimum=Math.min(0.f,!Float.isNaN(mAxisLeft.getAxisMinValue()) ? mAxisLeft.getAxisMinValue() : (minLeft - bottomSpaceLeft));
      mAxisLeft.mAxisMaximum=Math.max(0.f,!Float.isNaN(mAxisLeft.getAxisMaxValue()) ? mAxisLeft.getAxisMaxValue() : (maxLeft + topSpaceLeft));
    }
  }
 else {
    mAxisLeft.mAxisMinimum=!Float.isNaN(mAxisLeft.getAxisMinValue()) ? mAxisLeft.getAxisMinValue() : (minLeft - bottomSpaceLeft);
    mAxisLeft.mAxisMaximum=!Float.isNaN(mAxisLeft.getAxisMaxValue()) ? mAxisLeft.getAxisMaxValue() : (maxLeft + topSpaceLeft);
  }
  if (mAxisRight.isStartAtZeroEnabled()) {
    if (minRight < 0.f && maxRight < 0.f) {
      mAxisRight.mAxisMinimum=Math.min(0.f,!Float.isNaN(mAxisRight.getAxisMinValue()) ? mAxisRight.getAxisMinValue() : (minRight - bottomSpaceRight));
      mAxisRight.mAxisMaximum=0.f;
    }
 else     if (minRight >= 0.f) {
      mAxisRight.mAxisMinimum=0.f;
      mAxisRight.mAxisMaximum=Math.max(0.f,!Float.isNaN(mAxisRight.getAxisMaxValue()) ? mAxisRight.getAxisMaxValue() : (maxRight + topSpaceRight));
    }
 else {
      mAxisRight.mAxisMinimum=Math.min(0.f,!Float.isNaN(mAxisRight.getAxisMinValue()) ? mAxisRight.getAxisMinValue() : (minRight - bottomSpaceRight));
      mAxisRight.mAxisMaximum=Math.max(0.f,!Float.isNaN(mAxisRight.getAxisMaxValue()) ? mAxisRight.getAxisMaxValue() : (maxRight + topSpaceRight));
    }
  }
 else {
    mAxisRight.mAxisMinimum=!Float.isNaN(mAxisRight.getAxisMinValue()) ? mAxisRight.getAxisMinValue() : (minRight - bottomSpaceRight);
    mAxisRight.mAxisMaximum=!Float.isNaN(mAxisRight.getAxisMaxValue()) ? mAxisRight.getAxisMaxValue() : (maxRight + topSpaceRight);
  }
  mAxisLeft.mAxisRange=Math.abs(mAxisLeft.mAxisMaximum - mAxisLeft.mAxisMinimum);
  mAxisRight.mAxisRange=Math.abs(mAxisRight.mAxisMaximum - mAxisRight.mAxisMinimum);
}