private static double nextDown(double val) {
    // Math.nextDown returns -MIN_VALUE for 0.0. This is suitable for relations
    // (see fromRelation) but not suitable for inverted range boundary
    if (Double.compare(val, 0.0) == 0) {
      return -0.0;
    }
    return Math.nextDown(val);
  }
private static double nextDown(double val)