Average Error: 26.5 → 14.8
Time: 46.0s
Precision: binary64
Cost: 125268
\[\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 := \frac{h}{\ell} \cdot -0.5\\ t_1 := {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\\ t_2 := \left({\left(\frac{d}{\ell}\right)}^{0.5} \cdot {\left(\frac{d}{h}\right)}^{0.5}\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left(t_1 \cdot -0.5\right)\right)\\ t_3 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right| \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right)\right)\\ t_4 := \sqrt{\frac{d}{h}}\\ t_5 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;t_2 \leq -5 \cdot 10^{+297}:\\ \;\;\;\;\frac{\sqrt{h} \cdot \left(-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)}{{\ell}^{1.5}}\\ \mathbf{elif}\;t_2 \leq -1 \cdot 10^{-162}:\\ \;\;\;\;t_4 \cdot \left(t_5 \cdot \mathsf{fma}\left({\left(M \cdot \frac{\frac{D}{d}}{2}\right)}^{2}, t_0, 1\right)\right)\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_2 \leq 5 \cdot 10^{+303}:\\ \;\;\;\;t_4 \cdot \left(t_5 \cdot \left(1 + t_1 \cdot t_0\right)\right)\\ \mathbf{elif}\;t_2 \leq \infty:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \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 (* (/ h l) -0.5))
        (t_1 (pow (/ (* M D) (* d 2.0)) 2.0))
        (t_2
         (*
          (* (pow (/ d l) 0.5) (pow (/ d h) 0.5))
          (+ 1.0 (* (/ h l) (* t_1 -0.5)))))
        (t_3
         (*
          (fabs (/ d (sqrt (* h l))))
          (- 1.0 (* (/ h l) (* 0.5 (pow (* M (/ D (* d 2.0))) 2.0))))))
        (t_4 (sqrt (/ d h)))
        (t_5 (sqrt (/ d l))))
   (if (<= t_2 -5e+297)
     (/ (* (sqrt h) (* -0.125 (/ (pow (* M D) 2.0) d))) (pow l 1.5))
     (if (<= t_2 -1e-162)
       (* t_4 (* t_5 (fma (pow (* M (/ (/ D d) 2.0)) 2.0) t_0 1.0)))
       (if (<= t_2 0.0)
         t_3
         (if (<= t_2 5e+303)
           (* t_4 (* t_5 (+ 1.0 (* t_1 t_0))))
           (if (<= t_2 INFINITY) t_3 (* d (sqrt (/ (/ 1.0 h) l))))))))))
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 = (h / l) * -0.5;
	double t_1 = pow(((M * D) / (d * 2.0)), 2.0);
	double t_2 = (pow((d / l), 0.5) * pow((d / h), 0.5)) * (1.0 + ((h / l) * (t_1 * -0.5)));
	double t_3 = fabs((d / sqrt((h * l)))) * (1.0 - ((h / l) * (0.5 * pow((M * (D / (d * 2.0))), 2.0))));
	double t_4 = sqrt((d / h));
	double t_5 = sqrt((d / l));
	double tmp;
	if (t_2 <= -5e+297) {
		tmp = (sqrt(h) * (-0.125 * (pow((M * D), 2.0) / d))) / pow(l, 1.5);
	} else if (t_2 <= -1e-162) {
		tmp = t_4 * (t_5 * fma(pow((M * ((D / d) / 2.0)), 2.0), t_0, 1.0));
	} else if (t_2 <= 0.0) {
		tmp = t_3;
	} else if (t_2 <= 5e+303) {
		tmp = t_4 * (t_5 * (1.0 + (t_1 * t_0)));
	} else if (t_2 <= ((double) INFINITY)) {
		tmp = t_3;
	} else {
		tmp = d * sqrt(((1.0 / h) / l));
	}
	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 = Float64(Float64(h / l) * -0.5)
	t_1 = Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0
	t_2 = Float64(Float64((Float64(d / l) ^ 0.5) * (Float64(d / h) ^ 0.5)) * Float64(1.0 + Float64(Float64(h / l) * Float64(t_1 * -0.5))))
	t_3 = Float64(abs(Float64(d / sqrt(Float64(h * l)))) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0)))))
	t_4 = sqrt(Float64(d / h))
	t_5 = sqrt(Float64(d / l))
	tmp = 0.0
	if (t_2 <= -5e+297)
		tmp = Float64(Float64(sqrt(h) * Float64(-0.125 * Float64((Float64(M * D) ^ 2.0) / d))) / (l ^ 1.5));
	elseif (t_2 <= -1e-162)
		tmp = Float64(t_4 * Float64(t_5 * fma((Float64(M * Float64(Float64(D / d) / 2.0)) ^ 2.0), t_0, 1.0)));
	elseif (t_2 <= 0.0)
		tmp = t_3;
	elseif (t_2 <= 5e+303)
		tmp = Float64(t_4 * Float64(t_5 * Float64(1.0 + Float64(t_1 * t_0))));
	elseif (t_2 <= Inf)
		tmp = t_3;
	else
		tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l)));
	end
	return 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[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(t$95$1 * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, -5e+297], N[(N[(N[Sqrt[h], $MachinePrecision] * N[(-0.125 * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -1e-162], N[(t$95$4 * N[(t$95$5 * N[(N[Power[N[(M * N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], t$95$3, If[LessEqual[t$95$2, 5e+303], N[(t$95$4 * N[(t$95$5 * N[(1.0 + N[(t$95$1 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], t$95$3, N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $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 := \frac{h}{\ell} \cdot -0.5\\
t_1 := {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\\
t_2 := \left({\left(\frac{d}{\ell}\right)}^{0.5} \cdot {\left(\frac{d}{h}\right)}^{0.5}\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left(t_1 \cdot -0.5\right)\right)\\
t_3 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right| \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right)\right)\\
t_4 := \sqrt{\frac{d}{h}}\\
t_5 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t_2 \leq -5 \cdot 10^{+297}:\\
\;\;\;\;\frac{\sqrt{h} \cdot \left(-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)}{{\ell}^{1.5}}\\

\mathbf{elif}\;t_2 \leq -1 \cdot 10^{-162}:\\
\;\;\;\;t_4 \cdot \left(t_5 \cdot \mathsf{fma}\left({\left(M \cdot \frac{\frac{D}{d}}{2}\right)}^{2}, t_0, 1\right)\right)\\

\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;t_3\\

\mathbf{elif}\;t_2 \leq 5 \cdot 10^{+303}:\\
\;\;\;\;t_4 \cdot \left(t_5 \cdot \left(1 + t_1 \cdot t_0\right)\right)\\

\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;t_3\\

\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\


\end{array}

Error

Derivation

  1. Split input into 5 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)))) < -4.9999999999999998e297

    1. Initial program 62.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. Taylor expanded in d around 0 60.7

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    3. Simplified55.3

      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{-0.125}{d} \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right)\right)} \]
    4. Applied egg-rr48.0

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

    if -4.9999999999999998e297 < (*.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)))) < -9.99999999999999954e-163

    1. Initial program 1.2

      \[\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. Simplified5.6

      \[\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)} \]

    if -9.99999999999999954e-163 < (*.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 4.9999999999999997e303 < (*.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.2

      \[\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-rr52.6

      \[\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(\frac{M}{\frac{2 \cdot d}{D}} \cdot \sqrt{0.5}\right)\right)}^{2}}\right) \]
    3. Applied egg-rr53.7

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

      \[\leadsto {\left(\color{blue}{\left|\frac{d}{\sqrt{h \cdot \ell}}\right|} \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\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)))) < 4.9999999999999997e303

    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-rr0.9

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\left(1 + {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\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 50.9

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

      \[\leadsto \sqrt{\color{blue}{\log \left(e^{\frac{\frac{1}{\ell}}{h}}\right)}} \cdot d \]
    4. Applied egg-rr50.9

      \[\leadsto \sqrt{\color{blue}{\frac{\frac{1}{h}}{\ell}}} \cdot d \]
  3. Recombined 5 regimes into one program.
  4. Final simplification14.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{\ell}\right)}^{0.5} \cdot {\left(\frac{d}{h}\right)}^{0.5}\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot -0.5\right)\right) \leq -5 \cdot 10^{+297}:\\ \;\;\;\;\frac{\sqrt{h} \cdot \left(-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)}{{\ell}^{1.5}}\\ \mathbf{elif}\;\left({\left(\frac{d}{\ell}\right)}^{0.5} \cdot {\left(\frac{d}{h}\right)}^{0.5}\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot -0.5\right)\right) \leq -1 \cdot 10^{-162}:\\ \;\;\;\;\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)\\ \mathbf{elif}\;\left({\left(\frac{d}{\ell}\right)}^{0.5} \cdot {\left(\frac{d}{h}\right)}^{0.5}\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot -0.5\right)\right) \leq 0:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right| \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{\ell}\right)}^{0.5} \cdot {\left(\frac{d}{h}\right)}^{0.5}\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot -0.5\right)\right) \leq 5 \cdot 10^{+303}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{\ell}\right)}^{0.5} \cdot {\left(\frac{d}{h}\right)}^{0.5}\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot -0.5\right)\right) \leq \infty:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right| \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \end{array} \]

Alternatives

Alternative 1
Error14.4
Cost104336
\[\begin{array}{l} t_0 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right| \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right)\right)\\ t_1 := {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\\ t_2 := \left({\left(\frac{d}{\ell}\right)}^{0.5} \cdot {\left(\frac{d}{h}\right)}^{0.5}\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left(t_1 \cdot -0.5\right)\right)\\ t_3 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;t_2 \leq -1 \cdot 10^{-162}:\\ \;\;\;\;\left(1 - {\left(\left(\frac{M}{\frac{d \cdot 2}{D}} \cdot \sqrt{0.5}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \cdot \left(t_3 \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right)\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_2 \leq 5 \cdot 10^{+303}:\\ \;\;\;\;t_3 \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + t_1 \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\ \mathbf{elif}\;t_2 \leq \infty:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \end{array} \]
Alternative 2
Error14.4
Cost104336
\[\begin{array}{l} t_0 := {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right| \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right)\right)\\ t_3 := {\left(\frac{d}{h}\right)}^{0.5}\\ t_4 := \left({\left(\frac{d}{\ell}\right)}^{0.5} \cdot t_3\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left(t_0 \cdot -0.5\right)\right)\\ \mathbf{if}\;t_4 \leq -1 \cdot 10^{-162}:\\ \;\;\;\;\left(1 - {\left(\left(\frac{M}{\frac{d \cdot 2}{D}} \cdot \sqrt{0.5}\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right) \cdot \left(t_3 \cdot t_1\right)\\ \mathbf{elif}\;t_4 \leq 0:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_4 \leq 5 \cdot 10^{+303}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_1 \cdot \left(1 + t_0 \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\ \mathbf{elif}\;t_4 \leq \infty:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\ \end{array} \]
Alternative 3
Error17.3
Cost40456
\[\begin{array}{l} t_0 := {\left(\frac{d}{\ell}\right)}^{0.5}\\ t_1 := {\left(\frac{d}{h}\right)}^{0.5}\\ t_2 := \frac{M}{\frac{d \cdot 2}{D}}\\ t_3 := \sqrt{-h}\\ t_4 := t_2 \cdot \sqrt{0.5}\\ \mathbf{if}\;d \leq -1 \cdot 10^{+46}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{t_3} \cdot t_0\right) \cdot \left(1 - \frac{0.5 \cdot {t_2}^{2}}{\frac{\ell}{h}}\right)\\ \mathbf{elif}\;d \leq -1 \cdot 10^{-290}:\\ \;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 - {\left(\frac{t_3}{\sqrt{-\ell}} \cdot t_4\right)}^{2}\right)\\ \mathbf{elif}\;d \leq 10^{+100}:\\ \;\;\;\;\left(t_1 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - {\left(t_4 \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 4
Error22.6
Cost21656
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\\ \mathbf{if}\;\ell \leq -1.85 \cdot 10^{+214}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq -4.9 \cdot 10^{+86}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \left(1 + t_1 \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\ \mathbf{elif}\;\ell \leq -2.15 \cdot 10^{-135}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(\frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right) + -1\right)\\ \mathbf{elif}\;\ell \leq 0:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\left(h \cdot 0.5\right) \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 10^{-85}:\\ \;\;\;\;\frac{{\ell}^{-0.5}}{\frac{\sqrt{h}}{d}}\\ \mathbf{elif}\;\ell \leq 4.8 \cdot 10^{+179}:\\ \;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(t_1 \cdot -0.5\right)\right) \cdot \left(t_0 \cdot \frac{1}{\sqrt{\frac{h}{d}}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 5
Error22.8
Cost21528
\[\begin{array}{l} t_0 := {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\\ t_1 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;\ell \leq -1.85 \cdot 10^{+214}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;\ell \leq -4.9 \cdot 10^{+86}:\\ \;\;\;\;t_1 \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\ \mathbf{elif}\;\ell \leq -2.15 \cdot 10^{-135}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right) \cdot \left(\frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right) + -1\right)\\ \mathbf{elif}\;\ell \leq 0:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\left(h \cdot 0.5\right) \cdot t_0}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 10^{-85}:\\ \;\;\;\;\frac{{\ell}^{-0.5}}{\frac{\sqrt{h}}{d}}\\ \mathbf{elif}\;\ell \leq 10^{+176}:\\ \;\;\;\;\frac{t_1 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot t_0\right)\right)}{\sqrt{\frac{\ell}{d}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 6
Error21.8
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}}}\\ \mathbf{if}\;d \leq -2.9 \cdot 10^{+158}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;d \leq 1.35 \cdot 10^{-295}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 3.8 \cdot 10^{-56}:\\ \;\;\;\;\frac{{\ell}^{-0.5}}{\frac{\sqrt{h}}{d}}\\ \mathbf{elif}\;d \leq 10^{+100}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 7
Error21.4
Cost21264
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;d \leq -1.62 \cdot 10^{+153}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{elif}\;d \leq 8.9 \cdot 10^{-293}:\\ \;\;\;\;t_0 \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\right)\\ \mathbf{elif}\;d \leq 3.8 \cdot 10^{-56}:\\ \;\;\;\;\frac{{\ell}^{-0.5}}{\frac{\sqrt{h}}{d}}\\ \mathbf{elif}\;d \leq 10^{+100}:\\ \;\;\;\;\frac{t_0 \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}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 8
Error23.4
Cost15000
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ t_1 := d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{if}\;\ell \leq -1.85 \cdot 10^{+214}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\ell \leq -3 \cdot 10^{+121}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq -3.9 \cdot 10^{-162}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq 10^{-85}:\\ \;\;\;\;\frac{{\ell}^{-0.5}}{\frac{\sqrt{h}}{d}}\\ \mathbf{elif}\;\ell \leq 10^{+50}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 9
Error24.0
Cost13776
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ t_1 := d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{if}\;\ell \leq -1.85 \cdot 10^{+214}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\ell \leq -3 \cdot 10^{+121}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq -3.9 \cdot 10^{-162}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 10
Error23.4
Cost13380
\[\begin{array}{l} \mathbf{if}\;d \leq 8.9 \cdot 10^{-293}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 11
Error24.3
Cost13252
\[\begin{array}{l} \mathbf{if}\;d \leq 8.9 \cdot 10^{-293}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 12
Error23.4
Cost13252
\[\begin{array}{l} \mathbf{if}\;d \leq 8.9 \cdot 10^{-293}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 13
Error27.5
Cost7044
\[\begin{array}{l} \mathbf{if}\;d \leq -4.4 \cdot 10^{-267}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \end{array} \]
Alternative 14
Error36.5
Cost6980
\[\begin{array}{l} \mathbf{if}\;d \leq -2.7 \cdot 10^{-224}:\\ \;\;\;\;\sqrt{\frac{d \cdot d}{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \end{array} \]
Alternative 15
Error43.8
Cost6720
\[\frac{d}{\sqrt{h \cdot \ell}} \]

Error

Reproduce

herbie shell --seed 2022293 
(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)))))