Program: 18381
Project: 18381
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())   mAxisLeft.mAxisMinimum=0f;
  if (mAxisRight.isStartAtZeroEnabled())   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);
  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 {
      mAxisLeft.mAxisMinimum=0f;
    }
  }
  if (mAxisRight.isStartAtZeroEnabled()) {
    if (mAxisRight.mAxisMinimum < 0.0 && mAxisRight.mAxisMaximum < 0.0) {
      mAxisRight.mAxisMaximum=0f;
    }
 else {
      mAxisRight.mAxisMinimum=0f;
    }
  }
  mAxisLeft.mAxisRange=Math.abs(mAxisLeft.mAxisMaximum - mAxisLeft.mAxisMinimum);
  mAxisRight.mAxisRange=Math.abs(mAxisRight.mAxisMaximum - mAxisRight.mAxisMinimum);
}