docs: private static StatusCode update_trial_interval(UpdVals uv)
      {
          double x = uv.x;
          double fx = uv.fx;
          double dx = uv.dx;
          double y = uv.y;
          double fy = uv.fy;
          double dy = uv.dy;
          double t = uv.t;
          double ft = uv.ft;
          double dt = uv.dt;
          double tmin = uv.tmin;
          double tmax = uv.tmax;
          int brackt = uv.brackt;
          
          int bound;
          boolean dsign = fsigndiff(dt, dx);
          double mc = 0; /* minimizer of an interpolated cubic. */
          double mq = 0; /* minimizer of an interpolated quadratic. */
          double newt = 0;   /* new trial value. */
          // TODO: Remove: USES_MINIMIZER;     /* for CUBIC_MINIMIZER and QUARD_MINIMIZER. */
  
          /* Check the input parameters for errors. */
          if (brackt != 0) {
              if (t <= min2(x, y) || max2(x, y) <= t) {
                  /* The trival value t is out of the interval. */
                  return LBFGSERR_OUTOFINTERVAL;
              }
              if (0. <= dx * (t - x)) {
                  /* The function must decrease from x. */
                  return LBFGSERR_INCREASEGRADIENT;
              }
              if (tmax < tmin) {
                  /* Incorrect tmin and tmax specified. */
                  return LBFGSERR_INCORRECT_TMINMAX;
              }
          }
  
          /*
              Trial value selection.
           */
          if (fx < ft) {
              /*
                  Case 1: a higher function value.
                  The minimum is brackt. If the cubic minimizer is closer
                  to x than the quadratic one, the cubic one is taken, else
                  the average of the minimizers is taken.
               */
              brackt = 1;
              bound = 1;
              mc = CUBIC_MINIMIZER(mc, x, fx, dx, t, ft, dt);
              mq = QUARD_MINIMIZER(mq, x, fx, dx, t, ft);
              if (Math.abs(mc - x) < Math.abs(mq - x)) {
                  newt = mc;
              } else {
                  newt = mc + 0.5 * (mq - mc);
              }
          } else if (dsign) {
              /*
                  Case 2: a lower function value and derivatives of
                  opposite sign. The minimum is brackt. If the cubic
                  minimizer is closer to x than the quadratic (secant) one,
                  the cubic one is taken, else the quadratic one is taken.
               */
              brackt = 1;
              bound = 0;
              mc = CUBIC_MINIMIZER(mc, x, fx, dx, t, ft, dt);
              mq = QUARD_MINIMIZER2(mq, x, dx, t, dt);
              if (Math.abs(mc - t) > Math.abs(mq - t)) {
                  newt = mc;
              } else {
                  newt = mq;
              }
          } else if (Math.abs(dt) < Math.abs(dx)) {
              /*
                  Case 3: a lower function value, derivatives of the
                  same sign, and the magnitude of the derivative decreases.
                  The cubic minimizer is only used if the cubic tends to
                  infinity in the direction of the minimizer or if the minimum
                  of the cubic is beyond t. Otherwise the cubic minimizer is
                  defined to be either tmin or tmax. The quadratic (secant)
                  minimizer is also computed and if the minimum is brackt
                  then the the minimizer closest to x is taken, else the one
                  farthest away is taken.
               */
              bound = 1;
              mc = CUBIC_MINIMIZER2(mc, x, fx, dx, t, ft, dt, tmin, tmax);
              mq = QUARD_MINIMIZER2(mq, x, dx, t, dt);
              if (brackt != 0) {
                  if (Math.abs(t - mc) < Math.abs(t - mq)) {
                      newt = mc;
                  } else {
                      newt = mq;
                  }
              } else {
                  if (Math.abs(t - mc) > Math.abs(t - mq)) {
                      newt = mc;
                  } else {
                      newt = mq;
                  }
              }
          } else {
              /*
                  Case 4: a lower function value, derivatives of the
                  same sign, and the magnitude of the derivative does
                  not decrease. If the minimum is not brackt, the step
                  is either tmin or tmax, else the cubic minimizer is taken.
               */
              bound = 0;
              if (brackt != 0) {
                  newt = CUBIC_MINIMIZER(newt, t, ft, dt, y, fy, dy);
              } else if (x < t) {
                  newt = tmax;
              } else {
                  newt = tmin;
              }
          }
  
          /*
              Update the interval of uncertainty. This update does not
              depend on the new step or the case analysis above.
  
              - Case a: if f(x) < f(t),
                  x <- x, y <- t.
              - Case b: if f(t) <= f(x) && f'(t)*f'(x) > 0,
                  x <- t, y <- y.
              - Case c: if f(t) <= f(x) && f'(t)*f'(x) < 0, 
                  x <- t, y <- x.
           */
          if (fx < ft) {
              /* Case a */
              y = t;
              fy = ft;
              dy = dt;
          } else {
              /* Case c */
              if (dsign) {
                  y = x;
                  fy = fx;
                  dy = dx;
              }
              /* Cases b and c */
              x = t;
              fx = ft;
              dx = dt;
          }
  
          /* Clip the new trial value in [tmin, tmax]. */
          if (tmax < newt) newt = tmax;
          if (newt < tmin) newt = tmin;
  
          /*
              Redefine the new trial value if it is close to the upper bound
              of the interval.
           */
          if (brackt != 0 && bound != 0) {
              mq = x + 0.66 * (y - x);
              if (x < y) {
                  if (mq < newt) newt = mq;
              } else {
                  if (newt < mq) newt = mq;
              }
          }
  
          /* Return the new trial value. */
          t = newt;
          
  
          uv.x = x;
          uv.fx = fx;
          uv.dx = dx;
          uv.y = y;
          uv.fy = fy;
          uv.dy = dy;
          uv.t = t;
          uv.ft = ft;
          uv.dt = dt;
          //uv.tmin = tmin;
          //uv.tmax = tmax;
          uv.brackt = brackt;
          
          return LBFGS_CONTINUE;
      }