@Override
  public double calc(double x) {
    int res = Arrays.binarySearch(xs, x);
    if (res < 0) {
      res = -res - 1;
    }
    return ys[min(res, ys.length - 1)];
  }
@Override
  public double calc(double x)