Average Error: 26.6 → 15.4
Time: 41.3s
Precision: binary64
Cost: 104336
\[ \begin{array}{c}[M, D] = \mathsf{sort}([M, D])\\ \end{array} \]
\[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
\[\begin{array}{l} t_0 := \sqrt{h \cdot \ell}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_2 := \left(0.5 \cdot M\right) \cdot \frac{D}{d}\\ t_3 := \sqrt{\frac{d}{h}}\\ t_4 := \left|\frac{d}{t_0}\right| \cdot \left(1 + \frac{h}{\ell} \cdot \left({t_2}^{2} \cdot -0.5\right)\right)\\ \mathbf{if}\;t_1 \leq -2 \cdot 10^{-174}:\\ \;\;\;\;\left(t_3 \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right) \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell}} \cdot \left(t_2 \cdot \sqrt{0.5}\right)\right)}^{2}\right)\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+285}:\\ \;\;\;\;t_3 \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + {\left(\left(0.5 \cdot D\right) \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{t_0}{d}\right)}^{-1}\\ \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (*
  (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
  (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (* h l)))
        (t_1
         (*
          (* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
          (- 1.0 (* (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0)) (/ h l)))))
        (t_2 (* (* 0.5 M) (/ D d)))
        (t_3 (sqrt (/ d h)))
        (t_4 (* (fabs (/ d t_0)) (+ 1.0 (* (/ h l) (* (pow t_2 2.0) -0.5))))))
   (if (<= t_1 -2e-174)
     (*
      (* t_3 (/ 1.0 (sqrt (/ l d))))
      (- 1.0 (pow (* (sqrt (/ h l)) (* t_2 (sqrt 0.5))) 2.0)))
     (if (<= t_1 0.0)
       t_4
       (if (<= t_1 2e+285)
         (*
          t_3
          (*
           (sqrt (/ d l))
           (+ 1.0 (* (pow (* (* 0.5 D) (/ M d)) 2.0) (* (/ h l) -0.5)))))
         (if (<= t_1 INFINITY) t_4 (pow (/ t_0 d) -1.0)))))))
double code(double d, double h, double l, double M, double D) {
	return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((h * l));
	double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((0.5 * pow(((M * D) / (d * 2.0)), 2.0)) * (h / l)));
	double t_2 = (0.5 * M) * (D / d);
	double t_3 = sqrt((d / h));
	double t_4 = fabs((d / t_0)) * (1.0 + ((h / l) * (pow(t_2, 2.0) * -0.5)));
	double tmp;
	if (t_1 <= -2e-174) {
		tmp = (t_3 * (1.0 / sqrt((l / d)))) * (1.0 - pow((sqrt((h / l)) * (t_2 * sqrt(0.5))), 2.0));
	} else if (t_1 <= 0.0) {
		tmp = t_4;
	} else if (t_1 <= 2e+285) {
		tmp = t_3 * (sqrt((d / l)) * (1.0 + (pow(((0.5 * D) * (M / d)), 2.0) * ((h / l) * -0.5))));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_4;
	} else {
		tmp = pow((t_0 / d), -1.0);
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((h * l));
	double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0)) * (h / l)));
	double t_2 = (0.5 * M) * (D / d);
	double t_3 = Math.sqrt((d / h));
	double t_4 = Math.abs((d / t_0)) * (1.0 + ((h / l) * (Math.pow(t_2, 2.0) * -0.5)));
	double tmp;
	if (t_1 <= -2e-174) {
		tmp = (t_3 * (1.0 / Math.sqrt((l / d)))) * (1.0 - Math.pow((Math.sqrt((h / l)) * (t_2 * Math.sqrt(0.5))), 2.0));
	} else if (t_1 <= 0.0) {
		tmp = t_4;
	} else if (t_1 <= 2e+285) {
		tmp = t_3 * (Math.sqrt((d / l)) * (1.0 + (Math.pow(((0.5 * D) * (M / d)), 2.0) * ((h / l) * -0.5))));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_4;
	} else {
		tmp = Math.pow((t_0 / d), -1.0);
	}
	return tmp;
}
def code(d, h, l, M, D):
	return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
def code(d, h, l, M, D):
	t_0 = math.sqrt((h * l))
	t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)) * (h / l)))
	t_2 = (0.5 * M) * (D / d)
	t_3 = math.sqrt((d / h))
	t_4 = math.fabs((d / t_0)) * (1.0 + ((h / l) * (math.pow(t_2, 2.0) * -0.5)))
	tmp = 0
	if t_1 <= -2e-174:
		tmp = (t_3 * (1.0 / math.sqrt((l / d)))) * (1.0 - math.pow((math.sqrt((h / l)) * (t_2 * math.sqrt(0.5))), 2.0))
	elif t_1 <= 0.0:
		tmp = t_4
	elif t_1 <= 2e+285:
		tmp = t_3 * (math.sqrt((d / l)) * (1.0 + (math.pow(((0.5 * D) * (M / d)), 2.0) * ((h / l) * -0.5))))
	elif t_1 <= math.inf:
		tmp = t_4
	else:
		tmp = math.pow((t_0 / d), -1.0)
	return tmp
function code(d, h, l, M, D)
	return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
end
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(h * l))
	t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)) * Float64(h / l))))
	t_2 = Float64(Float64(0.5 * M) * Float64(D / d))
	t_3 = sqrt(Float64(d / h))
	t_4 = Float64(abs(Float64(d / t_0)) * Float64(1.0 + Float64(Float64(h / l) * Float64((t_2 ^ 2.0) * -0.5))))
	tmp = 0.0
	if (t_1 <= -2e-174)
		tmp = Float64(Float64(t_3 * Float64(1.0 / sqrt(Float64(l / d)))) * Float64(1.0 - (Float64(sqrt(Float64(h / l)) * Float64(t_2 * sqrt(0.5))) ^ 2.0)));
	elseif (t_1 <= 0.0)
		tmp = t_4;
	elseif (t_1 <= 2e+285)
		tmp = Float64(t_3 * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64((Float64(Float64(0.5 * D) * Float64(M / d)) ^ 2.0) * Float64(Float64(h / l) * -0.5)))));
	elseif (t_1 <= Inf)
		tmp = t_4;
	else
		tmp = Float64(t_0 / d) ^ -1.0;
	end
	return tmp
end
function tmp = code(d, h, l, M, D)
	tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((h * l));
	t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((0.5 * (((M * D) / (d * 2.0)) ^ 2.0)) * (h / l)));
	t_2 = (0.5 * M) * (D / d);
	t_3 = sqrt((d / h));
	t_4 = abs((d / t_0)) * (1.0 + ((h / l) * ((t_2 ^ 2.0) * -0.5)));
	tmp = 0.0;
	if (t_1 <= -2e-174)
		tmp = (t_3 * (1.0 / sqrt((l / d)))) * (1.0 - ((sqrt((h / l)) * (t_2 * sqrt(0.5))) ^ 2.0));
	elseif (t_1 <= 0.0)
		tmp = t_4;
	elseif (t_1 <= 2e+285)
		tmp = t_3 * (sqrt((d / l)) * (1.0 + ((((0.5 * D) * (M / d)) ^ 2.0) * ((h / l) * -0.5))));
	elseif (t_1 <= Inf)
		tmp = t_4;
	else
		tmp = (t_0 / d) ^ -1.0;
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[Abs[N[(d / t$95$0), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[t$95$2, 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-174], N[(N[(t$95$3 * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[Power[N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(t$95$2 * N[Sqrt[0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$4, If[LessEqual[t$95$1, 2e+285], N[(t$95$3 * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[Power[N[(N[(0.5 * D), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$4, N[Power[N[(t$95$0 / d), $MachinePrecision], -1.0], $MachinePrecision]]]]]]]]]]
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \left(0.5 \cdot M\right) \cdot \frac{D}{d}\\
t_3 := \sqrt{\frac{d}{h}}\\
t_4 := \left|\frac{d}{t_0}\right| \cdot \left(1 + \frac{h}{\ell} \cdot \left({t_2}^{2} \cdot -0.5\right)\right)\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{-174}:\\
\;\;\;\;\left(t_3 \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right) \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell}} \cdot \left(t_2 \cdot \sqrt{0.5}\right)\right)}^{2}\right)\\

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_4\\

\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+285}:\\
\;\;\;\;t_3 \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + {\left(\left(0.5 \cdot D\right) \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_4\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{t_0}{d}\right)}^{-1}\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -2e-174

    1. Initial program 29.1

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Applied egg-rr23.4

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{{\left(\sqrt{\frac{h}{\ell}} \cdot \left(\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right) \cdot \sqrt{0.5}\right)\right)}^{2}}\right) \]
    3. Applied egg-rr23.6

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\frac{1}{\sqrt{\frac{\ell}{d}}}}\right) \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell}} \cdot \left(\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right) \cdot \sqrt{0.5}\right)\right)}^{2}\right) \]
    4. Applied egg-rr23.6

      \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right) \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell}} \cdot \left(\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right) \cdot \sqrt{0.5}\right)\right)}^{2}\right) \]

    if -2e-174 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -0.0 or 2e285 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < +inf.0

    1. Initial program 52.4

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Applied egg-rr54.6

      \[\leadsto \color{blue}{{\left(\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)}^{1}} \]
    3. Applied egg-rr10.5

      \[\leadsto {\left(\color{blue}{\left|\frac{d}{\sqrt{\ell \cdot h}}\right|} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)}^{1} \]

    if -0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 2e285

    1. Initial program 0.9

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Simplified1.2

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(M \cdot \frac{\frac{D}{d}}{2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)\right)} \]
    3. Applied egg-rr1.1

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left({\left(\frac{M}{\frac{2}{D} \cdot d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right) + 1\right)}\right) \]
    4. Applied egg-rr1.2

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left({\color{blue}{\left(\left(D \cdot 0.5\right) \cdot \frac{M}{d}\right)}}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right) + 1\right)\right) \]

    if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l))))

    1. Initial program 64.0

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf 51.2

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Applied egg-rr51.2

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    4. Applied egg-rr51.2

      \[\leadsto \color{blue}{{\left(\frac{\sqrt{\ell \cdot h}}{d}\right)}^{-1}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification15.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -2 \cdot 10^{-174}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right) \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell}} \cdot \left(\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right) \cdot \sqrt{0.5}\right)\right)}^{2}\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 0:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right| \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 2 \cdot 10^{+285}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + {\left(\left(0.5 \cdot D\right) \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right| \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{\sqrt{h \cdot \ell}}{d}\right)}^{-1}\\ \end{array} \]

Alternatives

Alternative 1
Error16.6
Cost104336
\[\begin{array}{l} t_0 := {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\\ t_1 := {\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\\ t_2 := t_1 \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_3 := \sqrt{h \cdot \ell}\\ t_4 := \left|\frac{d}{t_3}\right| \cdot \left(1 + \frac{h}{\ell} \cdot \left(t_0 \cdot -0.5\right)\right)\\ \mathbf{if}\;t_2 \leq -1 \cdot 10^{-167}:\\ \;\;\;\;t_1 \cdot \left(1 + \frac{t_0 \cdot \left(h \cdot -0.5\right)}{\ell}\right)\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t_2 \leq 2 \cdot 10^{+285}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + {\left(\left(0.5 \cdot D\right) \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\ \mathbf{elif}\;t_2 \leq \infty:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{t_3}{d}\right)}^{-1}\\ \end{array} \]
Alternative 2
Error22.9
Cost21588
\[\begin{array}{l} t_0 := \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{0.5} \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right)\\ \mathbf{if}\;\ell \leq -2.35 \cdot 10^{+135}:\\ \;\;\;\;\frac{1}{\sqrt{\frac{h}{d}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(\frac{M}{d \cdot \frac{2}{D}}\right)}^{2}\right)\right)\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-20}:\\ \;\;\;\;\left(D \cdot \left(D \cdot \frac{M}{\frac{d}{M}}\right)\right) \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-160}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-270}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + h \cdot \left(\left(\frac{M}{d} \cdot \frac{M}{d}\right) \cdot \frac{D \cdot 0.125}{\frac{\ell}{D}}\right)\right)\\ \mathbf{elif}\;\ell \leq 2.9 \cdot 10^{-303}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 3
Error23.8
Cost21460
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \sqrt{\frac{1}{h \cdot \ell}}\\ t_2 := \frac{h}{\ell} \cdot -0.5\\ \mathbf{if}\;d \leq -1.4 \cdot 10^{+163}:\\ \;\;\;\;\frac{1}{\sqrt{\frac{h}{d}}} \cdot \left(t_0 \cdot \left(1 + t_2 \cdot {\left(\frac{M}{d \cdot \frac{2}{D}}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -3.9 \cdot 10^{+127}:\\ \;\;\;\;d \cdot \left(-t_1\right)\\ \mathbf{elif}\;d \leq -2.1 \cdot 10^{-57}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \left(1 + {\left(\left(0.5 \cdot D\right) \cdot \frac{M}{d}\right)}^{2} \cdot t_2\right)\right)\\ \mathbf{elif}\;d \leq -7.5 \cdot 10^{-178}:\\ \;\;\;\;\left(d \cdot t_1\right) \cdot \left(-1 + h \cdot \left(\left(\frac{M}{d} \cdot \frac{M}{d}\right) \cdot \frac{D \cdot 0.125}{\frac{\ell}{D}}\right)\right)\\ \mathbf{elif}\;d \leq 3.7 \cdot 10^{-190}:\\ \;\;\;\;\left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{0.5} \cdot t_0\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 4
Error22.8
Cost21460
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\\ t_2 := {\left(\frac{d}{h}\right)}^{0.5}\\ \mathbf{if}\;d \leq -1.4 \cdot 10^{+163}:\\ \;\;\;\;\frac{1}{\sqrt{\frac{h}{d}}} \cdot \left(t_0 \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(\frac{M}{d \cdot \frac{2}{D}}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -9.2 \cdot 10^{+62}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{elif}\;d \leq -6.6 \cdot 10^{-100}:\\ \;\;\;\;\left(t_2 \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 + \frac{t_1 \cdot \left(h \cdot -0.5\right)}{\ell}\right)\\ \mathbf{elif}\;d \leq -2.25 \cdot 10^{-288}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(-1 + \frac{h}{\ell} \cdot \left(0.5 \cdot t_1\right)\right)\\ \mathbf{elif}\;d \leq 3.7 \cdot 10^{-190}:\\ \;\;\;\;\left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left(t_2 \cdot t_0\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 5
Error23.8
Cost21396
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \sqrt{\frac{1}{h \cdot \ell}}\\ t_2 := \frac{h}{\ell} \cdot -0.5\\ \mathbf{if}\;d \leq -1.4 \cdot 10^{+163}:\\ \;\;\;\;\frac{1}{\sqrt{\frac{h}{d}}} \cdot \left(t_0 \cdot \left(1 + t_2 \cdot {\left(\frac{M}{d \cdot \frac{2}{D}}\right)}^{2}\right)\right)\\ \mathbf{elif}\;d \leq -3.9 \cdot 10^{+127}:\\ \;\;\;\;d \cdot \left(-t_1\right)\\ \mathbf{elif}\;d \leq -2.1 \cdot 10^{-57}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \left(1 + {\left(\left(0.5 \cdot D\right) \cdot \frac{M}{d}\right)}^{2} \cdot t_2\right)\right)\\ \mathbf{elif}\;d \leq -8 \cdot 10^{-166}:\\ \;\;\;\;\left(d \cdot t_1\right) \cdot \left(-1 + h \cdot \left(\left(\frac{M}{d} \cdot \frac{M}{d}\right) \cdot \frac{D \cdot 0.125}{\frac{\ell}{D}}\right)\right)\\ \mathbf{elif}\;d \leq -1.05 \cdot 10^{-303}:\\ \;\;\;\;\left(D \cdot \left(D \cdot \frac{M}{\frac{d}{M}}\right)\right) \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 6
Error23.1
Cost21264
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + {\left(\left(0.5 \cdot D\right) \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\ t_1 := \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{if}\;\ell \leq -1.7 \cdot 10^{+249}:\\ \;\;\;\;d \cdot \left(-t_1\right)\\ \mathbf{elif}\;\ell \leq -2.35 \cdot 10^{+135}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-40}:\\ \;\;\;\;\left(D \cdot \left(D \cdot \frac{M}{\frac{d}{M}}\right)\right) \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot t_1\\ \mathbf{elif}\;\ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 7
Error23.0
Cost21264
\[\begin{array}{l} t_0 := \frac{\sqrt{\frac{d}{h}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)}{\sqrt{\frac{\ell}{d}}}\\ t_1 := \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \mathbf{if}\;\ell \leq -1.7 \cdot 10^{+249}:\\ \;\;\;\;d \cdot \left(-t_1\right)\\ \mathbf{elif}\;\ell \leq -2.35 \cdot 10^{+135}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-20}:\\ \;\;\;\;\left(D \cdot \left(D \cdot \frac{M}{\frac{d}{M}}\right)\right) \cdot \left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot 0.125\right) - d \cdot t_1\\ \mathbf{elif}\;\ell \leq 2.9 \cdot 10^{-303}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 8
Error22.1
Cost20868
\[\begin{array}{l} \mathbf{if}\;h \leq -1 \cdot 10^{-46}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + {\left(\left(0.5 \cdot D\right) \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\ \mathbf{elif}\;h \leq -1 \cdot 10^{-301}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 9
Error22.1
Cost20868
\[\begin{array}{l} \mathbf{if}\;h \leq -1 \cdot 10^{-46}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + {\left(\left(0.5 \cdot D\right) \cdot \frac{M}{d}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\ \mathbf{elif}\;h \leq -1 \cdot 10^{-301}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(-1 + \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 10
Error24.6
Cost13648
\[\begin{array}{l} t_0 := d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{if}\;\ell \leq -1 \cdot 10^{+260}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq -1.65 \cdot 10^{+134}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq -18000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-270}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + h \cdot \left(\left(\frac{M}{d} \cdot \frac{M}{d}\right) \cdot \frac{D \cdot 0.125}{\frac{\ell}{D}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 11
Error23.3
Cost13384
\[\begin{array}{l} \mathbf{if}\;h \leq -1.18 \cdot 10^{+131}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;h \leq -1 \cdot 10^{-301}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 12
Error24.1
Cost13252
\[\begin{array}{l} \mathbf{if}\;\ell \leq 2.6 \cdot 10^{-292}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 13
Error27.8
Cost7044
\[\begin{array}{l} \mathbf{if}\;\ell \leq 2.6 \cdot 10^{-292}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \end{array} \]
Alternative 14
Error37.5
Cost6980
\[\begin{array}{l} \mathbf{if}\;\ell \leq -7.2 \cdot 10^{-241}:\\ \;\;\;\;\sqrt{\frac{d \cdot d}{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \end{array} \]
Alternative 15
Error44.2
Cost6784
\[d \cdot {\left(h \cdot \ell\right)}^{-0.5} \]
Alternative 16
Error62.2
Cost6720
\[d \cdot \sqrt{h \cdot \ell} \]
Alternative 17
Error44.2
Cost6720
\[\frac{d}{\sqrt{h \cdot \ell}} \]

Error

Reproduce

herbie shell --seed 2022216 
(FPCore (d h l M D)
  :name "Henrywood and Agarwal, Equation (12)"
  :precision binary64
  (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))