cdm/src/main/java/ucar/nc2/ft2/coverage/CoordAxisHelper.java
private int findCoordElementRegular(double coordValue, boolean bounded) {
    int n = axis.getNcoords();
    if (n == 1 && bounded) return 0;

    double distance = coordValue - axis.getCoordEdge1(0);
    double exactNumSteps = distance / axis.getResolution();
    //int index = (int) Math.round(exactNumSteps); // ties round to +Inf
    int index = (int) exactNumSteps; // truncate down

    if (bounded && index < 0) return 0;
    if (bounded && index >= n) return n - 1;

    // check that found point is within interval
    if (index >= 0 && index < n) {
      double lower = axis.getCoordEdge1(index);
      double upper = axis.getCoordEdge2(index);
      if (axis.isAscending()) {
        assert lower <= coordValue : lower + " should be le " + coordValue;
        assert upper >= coordValue : upper + " should be ge " + coordValue;
      } else {
        assert lower >= coordValue : lower + " should be ge " + coordValue;
        assert upper <= coordValue : upper + " should be le " + coordValue;
      }
    }

    return index;
  }
private int findCoordElementRegular(double coordValue, boolean bounded) {
    int n = axis.getNcoords();
    if (n == 1 && bounded) return 0;

    double distance = coordValue - axis.getCoordEdge1(0);
    double exactNumSteps = distance / axis.getResolution();
    //int index = (int) Math.round(exactNumSteps); // ties round to +Inf
    int index = (int) exactNumSteps; // truncate down

    if (bounded && index < 0) return 0;
    if (bounded && index >= n) return n - 1;

    // check that found point is within interval
    if (index >= 0 && index < n) {
      double lower = axis.getCoordEdge1(index);
      double upper = axis.getCoordEdge2(index);
      if (axis.isAscending()) {
        assert lower <= coordValue : lower + " should be le " + coordValue;
        assert upper >= coordValue : upper + " should be ge " + coordValue;
      } else {
        assert lower >= coordValue : lower + " should be ge " + coordValue;
        assert upper <= coordValue : upper + " should be le " + coordValue;
      }
    }

    return index;
  }
same contract as findCoordElement()