docs: private static double CUBIC_MINIMIZER2(double cm, double u, double fu, double du, double v, double fv, double dv, double xmin, double xmax) {
          double a, d, gamma, theta, p, q, r, s;
          d = (v) - (u);
          theta = ((fu) - (fv)) * 3 / d + (du) + (dv);
          p = Math.abs(theta);
          q = Math.abs(du);
          r = Math.abs(dv);
          s = max3(p, q, r);
          /* gamma = s*sqrt((theta/s)**2 - (du/s) * (dv/s)) */
          a = theta / s;
          gamma = s * Math.sqrt(max2(0, a * a - ((du) / s) * ((dv) / s)));
          if ((u) < (v)) gamma = -gamma;
          p = gamma - (dv) + theta;
          q = gamma - (dv) + gamma + (du);
          r = p / q;
          if (r < 0. && gamma != 0.) {
              (cm) = (v) - r * d;
          } else if (a < 0) {
              (cm) = (xmax);
          } else {
              (cm) = (xmin);
          }
          return cm;
      }