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

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

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

\mathbf{elif}\;t_3 \leq 2 \cdot 10^{+279}:\\
\;\;\;\;t_0 \cdot \left(t_2 \cdot t_1\right)\\

\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{{t_4}^{2}}\\


\end{array}

Error

Derivation

  1. Split input into 6 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)))) < -inf.0

    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 0 60.5

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

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

    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.00000000000000007e-229

    1. Initial program 1.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. Simplified6.4

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(M \cdot \frac{\frac{D}{d}}{2}\right)}^{2} \cdot -0.5, 1\right)\right)} \]
    3. Taylor expanded in M around 0 2.5

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

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

    if -1.00000000000000007e-229 < (*.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

    1. Initial program 39.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. Applied egg-rr40.8

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

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

    1. Initial program 1.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. Applied egg-rr1.0

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

    if 2.00000000000000012e279 < (*.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 62.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. Taylor expanded in d around inf 35.9

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Simplified35.9

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

      \[\leadsto d \cdot \sqrt{\color{blue}{{\left(\sqrt[3]{\frac{\frac{1}{h}}{\ell}}\right)}^{3}}} \]
    5. Applied egg-rr33.0

      \[\leadsto d \cdot \color{blue}{\frac{{h}^{-0.5}}{\sqrt{\ell}}} \]

    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 49.7

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    3. Simplified49.7

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. Applied egg-rr50.6

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

    \[\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 + \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot -0.5\right)\right) \leq -\infty:\\ \;\;\;\;-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\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^{-229}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, {\left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right)}^{2} \cdot -0.5, 1\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\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:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\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 2 \cdot 10^{+279}:\\ \;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot -0.5\right)\right) \cdot \left({\left(\frac{d}{h}\right)}^{0.5} \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\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:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{{\left(\frac{d}{\sqrt{h \cdot \ell}}\right)}^{2}}\\ \end{array} \]

Alternatives

Alternative 1
Error18.9
Cost124244
\[\begin{array}{l} t_0 := 1 + \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot -0.5\right)\\ t_1 := \frac{d}{\sqrt{h \cdot \ell}}\\ t_2 := {\left(\frac{d}{h}\right)}^{0.5}\\ t_3 := \left(t_2 \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot t_0\\ t_4 := t_0 \cdot \left(t_2 \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{if}\;t_3 \leq -\infty:\\ \;\;\;\;-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}\\ \mathbf{elif}\;t_3 \leq -1 \cdot 10^{-229}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t_3 \leq 0:\\ \;\;\;\;t_1 \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right)\right)\\ \mathbf{elif}\;t_3 \leq 2 \cdot 10^{+279}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;t_3 \leq \infty:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{{t_1}^{2}}\\ \end{array} \]
Alternative 2
Error23.0
Cost21392
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;d \leq -2.05 \cdot 10^{+87}:\\ \;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}\right) + -1\right)\\ \mathbf{elif}\;d \leq 1.05 \cdot 10^{-234}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M}{2 \cdot \frac{d}{D}}\right)}^{2}\right)\right)\right)\\ \mathbf{elif}\;d \leq 10^{-130}:\\ \;\;\;\;-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2} \cdot \sqrt{h}}{d \cdot {\ell}^{1.5}}\\ \mathbf{elif}\;d \leq 10^{+120}:\\ \;\;\;\;\frac{1}{\sqrt{\frac{h}{d}}} \cdot \left(t_0 \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
Alternative 3
Error24.2
Cost21260
\[\begin{array}{l} t_0 := \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(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}\right)\right)\\ \mathbf{if}\;d \leq 10^{-240}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 10^{-130}:\\ \;\;\;\;-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2} \cdot \sqrt{h}}{d \cdot {\ell}^{1.5}}\\ \mathbf{elif}\;d \leq 10^{+120}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
Alternative 4
Error23.9
Cost21132
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M}{2 \cdot \frac{d}{D}}\right)}^{2}\right)\right)\right)\\ \mathbf{if}\;d \leq 1.05 \cdot 10^{-234}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 9.6 \cdot 10^{-138}:\\ \;\;\;\;-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2} \cdot \sqrt{h}}{d \cdot {\ell}^{1.5}}\\ \mathbf{elif}\;d \leq 10^{+47}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\ \end{array} \]
Alternative 5
Error26.8
Cost20560
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \frac{1}{\sqrt{\frac{h}{d}}}\\ \mathbf{if}\;d \leq -1 \cdot 10^{+55}:\\ \;\;\;\;t_0 \cdot t_1\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-19}:\\ \;\;\;\;t_1 \cdot \left(t_0 \cdot \left(1 + -0.125 \cdot \left(\left(h \cdot \frac{D}{d \cdot d}\right) \cdot \left(\frac{D}{\ell} \cdot \left(M \cdot M\right)\right)\right)\right)\right)\\ \mathbf{elif}\;d \leq 1.05 \cdot 10^{-234}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot t_0\\ \mathbf{elif}\;d \leq 9.6 \cdot 10^{-138}:\\ \;\;\;\;-0.125 \cdot \frac{\sqrt{h} \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}}{{\ell}^{1.5}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
Alternative 6
Error26.7
Cost20560
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \frac{1}{\sqrt{\frac{h}{d}}}\\ \mathbf{if}\;d \leq -1 \cdot 10^{+55}:\\ \;\;\;\;t_0 \cdot t_1\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-19}:\\ \;\;\;\;t_1 \cdot \left(t_0 \cdot \left(1 + -0.125 \cdot \left(\left(h \cdot \frac{D}{d \cdot d}\right) \cdot \left(\frac{D}{\ell} \cdot \left(M \cdot M\right)\right)\right)\right)\right)\\ \mathbf{elif}\;d \leq 1.05 \cdot 10^{-234}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot t_0\\ \mathbf{elif}\;d \leq 9.6 \cdot 10^{-138}:\\ \;\;\;\;-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2} \cdot \sqrt{h}}{d \cdot {\ell}^{1.5}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
Alternative 7
Error25.8
Cost14920
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \frac{1}{\sqrt{\frac{h}{d}}}\\ \mathbf{if}\;d \leq -1 \cdot 10^{+55}:\\ \;\;\;\;t_0 \cdot t_1\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-19}:\\ \;\;\;\;t_1 \cdot \left(t_0 \cdot \left(1 + -0.125 \cdot \left(\left(h \cdot \frac{D}{d \cdot d}\right) \cdot \left(\frac{D}{\ell} \cdot \left(M \cdot M\right)\right)\right)\right)\right)\\ \mathbf{elif}\;d \leq 1.25 \cdot 10^{-248}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
Alternative 8
Error25.8
Cost13508
\[\begin{array}{l} \mathbf{if}\;d \leq 7.5 \cdot 10^{-251}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
Alternative 9
Error26.0
Cost13380
\[\begin{array}{l} \mathbf{if}\;d \leq 1.25 \cdot 10^{-248}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
Alternative 10
Error32.5
Cost13252
\[\begin{array}{l} \mathbf{if}\;h \leq 0:\\ \;\;\;\;\sqrt{\frac{d \cdot d}{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
Alternative 11
Error36.5
Cost6980
\[\begin{array}{l} \mathbf{if}\;d \leq -5.4 \cdot 10^{-182}:\\ \;\;\;\;\sqrt{\frac{d \cdot d}{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\ \end{array} \]
Alternative 12
Error43.9
Cost6848
\[d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}} \]
Alternative 13
Error44.0
Cost6784
\[d \cdot {\left(h \cdot \ell\right)}^{-0.5} \]
Alternative 14
Error44.0
Cost6720
\[\frac{d}{\sqrt{h \cdot \ell}} \]

Error

Reproduce

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