Average Error: 27.1 → 17.5
Time: 47.8s
Precision: binary64
Cost: 40396
\[ \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 := {\left(\frac{d}{h}\right)}^{0.5}\\ t_1 := \sqrt{-d}\\ t_2 := \frac{D}{\frac{d \cdot 2}{M}}\\ t_3 := 1 - {\left(\sqrt{\frac{h}{\ell}} \cdot \left(t_2 \cdot \sqrt{0.5}\right)\right)}^{2}\\ \mathbf{if}\;d \leq -1 \cdot 10^{+115}:\\ \;\;\;\;\left(\frac{t_1}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {t_2}^{2}\right)}{\ell}\right)\\ \mathbf{elif}\;d \leq -1 \cdot 10^{-280}:\\ \;\;\;\;\left(t_0 \cdot \frac{t_1}{\sqrt{-\ell}}\right) \cdot t_3\\ \mathbf{elif}\;d \leq 1.4 \cdot 10^{-24}:\\ \;\;\;\;t_3 \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \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 (pow (/ d h) 0.5))
        (t_1 (sqrt (- d)))
        (t_2 (/ D (/ (* d 2.0) M)))
        (t_3 (- 1.0 (pow (* (sqrt (/ h l)) (* t_2 (sqrt 0.5))) 2.0))))
   (if (<= d -1e+115)
     (*
      (* (/ t_1 (sqrt (- h))) (sqrt (/ d l)))
      (- 1.0 (/ (* h (* 0.5 (pow t_2 2.0))) l)))
     (if (<= d -1e-280)
       (* (* t_0 (/ t_1 (sqrt (- l)))) t_3)
       (if (<= d 1.4e-24)
         (* t_3 (* t_0 (/ (sqrt d) (sqrt l))))
         (* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))))
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 = pow((d / h), 0.5);
	double t_1 = sqrt(-d);
	double t_2 = D / ((d * 2.0) / M);
	double t_3 = 1.0 - pow((sqrt((h / l)) * (t_2 * sqrt(0.5))), 2.0);
	double tmp;
	if (d <= -1e+115) {
		tmp = ((t_1 / sqrt(-h)) * sqrt((d / l))) * (1.0 - ((h * (0.5 * pow(t_2, 2.0))) / l));
	} else if (d <= -1e-280) {
		tmp = (t_0 * (t_1 / sqrt(-l))) * t_3;
	} else if (d <= 1.4e-24) {
		tmp = t_3 * (t_0 * (sqrt(d) / sqrt(l)));
	} else {
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	}
	return tmp;
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = (d / h) ** 0.5d0
    t_1 = sqrt(-d)
    t_2 = d_1 / ((d * 2.0d0) / m)
    t_3 = 1.0d0 - ((sqrt((h / l)) * (t_2 * sqrt(0.5d0))) ** 2.0d0)
    if (d <= (-1d+115)) then
        tmp = ((t_1 / sqrt(-h)) * sqrt((d / l))) * (1.0d0 - ((h * (0.5d0 * (t_2 ** 2.0d0))) / l))
    else if (d <= (-1d-280)) then
        tmp = (t_0 * (t_1 / sqrt(-l))) * t_3
    else if (d <= 1.4d-24) then
        tmp = t_3 * (t_0 * (sqrt(d) / sqrt(l)))
    else
        tmp = d * (sqrt((1.0d0 / l)) / sqrt(h))
    end if
    code = tmp
end function
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.pow((d / h), 0.5);
	double t_1 = Math.sqrt(-d);
	double t_2 = D / ((d * 2.0) / M);
	double t_3 = 1.0 - Math.pow((Math.sqrt((h / l)) * (t_2 * Math.sqrt(0.5))), 2.0);
	double tmp;
	if (d <= -1e+115) {
		tmp = ((t_1 / Math.sqrt(-h)) * Math.sqrt((d / l))) * (1.0 - ((h * (0.5 * Math.pow(t_2, 2.0))) / l));
	} else if (d <= -1e-280) {
		tmp = (t_0 * (t_1 / Math.sqrt(-l))) * t_3;
	} else if (d <= 1.4e-24) {
		tmp = t_3 * (t_0 * (Math.sqrt(d) / Math.sqrt(l)));
	} else {
		tmp = d * (Math.sqrt((1.0 / l)) / Math.sqrt(h));
	}
	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.pow((d / h), 0.5)
	t_1 = math.sqrt(-d)
	t_2 = D / ((d * 2.0) / M)
	t_3 = 1.0 - math.pow((math.sqrt((h / l)) * (t_2 * math.sqrt(0.5))), 2.0)
	tmp = 0
	if d <= -1e+115:
		tmp = ((t_1 / math.sqrt(-h)) * math.sqrt((d / l))) * (1.0 - ((h * (0.5 * math.pow(t_2, 2.0))) / l))
	elif d <= -1e-280:
		tmp = (t_0 * (t_1 / math.sqrt(-l))) * t_3
	elif d <= 1.4e-24:
		tmp = t_3 * (t_0 * (math.sqrt(d) / math.sqrt(l)))
	else:
		tmp = d * (math.sqrt((1.0 / l)) / math.sqrt(h))
	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(d / h) ^ 0.5
	t_1 = sqrt(Float64(-d))
	t_2 = Float64(D / Float64(Float64(d * 2.0) / M))
	t_3 = Float64(1.0 - (Float64(sqrt(Float64(h / l)) * Float64(t_2 * sqrt(0.5))) ^ 2.0))
	tmp = 0.0
	if (d <= -1e+115)
		tmp = Float64(Float64(Float64(t_1 / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (t_2 ^ 2.0))) / l)));
	elseif (d <= -1e-280)
		tmp = Float64(Float64(t_0 * Float64(t_1 / sqrt(Float64(-l)))) * t_3);
	elseif (d <= 1.4e-24)
		tmp = Float64(t_3 * Float64(t_0 * Float64(sqrt(d) / sqrt(l))));
	else
		tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / sqrt(h)));
	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 = (d / h) ^ 0.5;
	t_1 = sqrt(-d);
	t_2 = D / ((d * 2.0) / M);
	t_3 = 1.0 - ((sqrt((h / l)) * (t_2 * sqrt(0.5))) ^ 2.0);
	tmp = 0.0;
	if (d <= -1e+115)
		tmp = ((t_1 / sqrt(-h)) * sqrt((d / l))) * (1.0 - ((h * (0.5 * (t_2 ^ 2.0))) / l));
	elseif (d <= -1e-280)
		tmp = (t_0 * (t_1 / sqrt(-l))) * t_3;
	elseif (d <= 1.4e-24)
		tmp = t_3 * (t_0 * (sqrt(d) / sqrt(l)));
	else
		tmp = d * (sqrt((1.0 / l)) / sqrt(h));
	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[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$2 = N[(D / N[(N[(d * 2.0), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = 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]}, If[LessEqual[d, -1e+115], N[(N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-280], N[(N[(t$95$0 * N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[d, 1.4e-24], N[(t$95$3 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $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 := {\left(\frac{d}{h}\right)}^{0.5}\\
t_1 := \sqrt{-d}\\
t_2 := \frac{D}{\frac{d \cdot 2}{M}}\\
t_3 := 1 - {\left(\sqrt{\frac{h}{\ell}} \cdot \left(t_2 \cdot \sqrt{0.5}\right)\right)}^{2}\\
\mathbf{if}\;d \leq -1 \cdot 10^{+115}:\\
\;\;\;\;\left(\frac{t_1}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {t_2}^{2}\right)}{\ell}\right)\\

\mathbf{elif}\;d \leq -1 \cdot 10^{-280}:\\
\;\;\;\;\left(t_0 \cdot \frac{t_1}{\sqrt{-\ell}}\right) \cdot t_3\\

\mathbf{elif}\;d \leq 1.4 \cdot 10^{-24}:\\
\;\;\;\;t_3 \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\

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


\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 d < -1e115

    1. Initial program 27.5

      \[\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-rr27.5

      \[\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) \]
    3. Applied egg-rr13.4

      \[\leadsto \left(\color{blue}{\frac{\sqrt{-d}}{\sqrt{-h}}} \cdot \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) \]
    4. Applied egg-rr12.5

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

    if -1e115 < d < -9.9999999999999996e-281

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

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

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

    if -9.9999999999999996e-281 < d < 1.4000000000000001e-24

    1. Initial program 34.5

      \[\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-rr32.8

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

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

    if 1.4000000000000001e-24 < d

    1. Initial program 23.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. Taylor expanded in d around inf 20.4

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

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

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

Alternatives

Alternative 1
Error18.9
Cost40528
\[\begin{array}{l} t_0 := d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ t_1 := \frac{D}{\frac{d \cdot 2}{M}}\\ t_2 := 0.5 \cdot {t_1}^{2}\\ \mathbf{if}\;h \leq -1 \cdot 10^{+145}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{h \cdot t_2}{\ell}\right)\\ \mathbf{elif}\;h \leq 0:\\ \;\;\;\;\frac{1}{\frac{-\sqrt{h \cdot \ell}}{d}} \cdot \left(1 - t_2 \cdot \frac{h}{\ell}\right)\\ \mathbf{elif}\;h \leq 10^{-40}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;h \leq 10^{+195}:\\ \;\;\;\;\left(1 - {\left(\sqrt{\frac{h}{\ell}} \cdot \left(t_1 \cdot \sqrt{0.5}\right)\right)}^{2}\right) \cdot \left({\left(\frac{d}{h}\right)}^{0.5} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error19.2
Cost34196
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ t_2 := {\left(\frac{d}{h}\right)}^{0.5}\\ t_3 := \sqrt{-d}\\ \mathbf{if}\;\ell \leq -1 \cdot 10^{-140}:\\ \;\;\;\;\left(\frac{t_3}{\sqrt{-h}} \cdot t_0\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)\right)\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-255}:\\ \;\;\;\;\left(t_2 \cdot \frac{t_3}{\sqrt{-\ell}}\right) \cdot \left(1 - 0.125 \cdot \left(M \cdot \left(M \cdot \frac{\frac{D}{\frac{d}{D}}}{\frac{\ell}{\frac{h}{d}}}\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 3 \cdot 10^{-290}:\\ \;\;\;\;\left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{D}{\frac{d \cdot 2}{M}}\right)}^{2}\right)}{\ell}\right) \cdot \left(t_0 \cdot t_2\right)\\ \mathbf{elif}\;\ell \leq 10^{-20}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\ell \leq 10^{+92}:\\ \;\;\;\;\left(\sqrt{d} \cdot \sqrt{\frac{1}{h}}\right) \cdot \left(t_0 \cdot \mathsf{fma}\left({\left(\frac{\frac{D}{d}}{\frac{2}{M}}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error19.2
Cost34068
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ t_2 := {\left(\frac{d}{h}\right)}^{0.5}\\ t_3 := \sqrt{-d}\\ \mathbf{if}\;\ell \leq -1 \cdot 10^{-140}:\\ \;\;\;\;\left(\frac{t_3}{\sqrt{-h}} \cdot t_0\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)\right)\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-255}:\\ \;\;\;\;\left(t_2 \cdot \frac{t_3}{\sqrt{-\ell}}\right) \cdot \left(1 - 0.125 \cdot \left(M \cdot \left(M \cdot \frac{\frac{D}{\frac{d}{D}}}{\frac{\ell}{\frac{h}{d}}}\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 3 \cdot 10^{-290}:\\ \;\;\;\;\left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{D}{\frac{d \cdot 2}{M}}\right)}^{2}\right)}{\ell}\right) \cdot \left(t_0 \cdot t_2\right)\\ \mathbf{elif}\;\ell \leq 10^{-20}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\ell \leq 10^{+92}:\\ \;\;\;\;\left(t_0 \cdot \mathsf{fma}\left({\left(\frac{\frac{D}{d}}{\frac{2}{M}}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error20.1
Cost27396
\[\begin{array}{l} t_0 := 0.5 \cdot {\left(\frac{D}{\frac{d \cdot 2}{M}}\right)}^{2}\\ \mathbf{if}\;h \leq -1 \cdot 10^{+145}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{h \cdot t_0}{\ell}\right)\\ \mathbf{elif}\;h \leq 0:\\ \;\;\;\;\frac{1}{\frac{-\sqrt{h \cdot \ell}}{d}} \cdot \left(1 - t_0 \cdot \frac{h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 5
Error23.2
Cost21264
\[\begin{array}{l} t_0 := \frac{\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}\right)\right)}{\sqrt{\frac{h}{d}}}\\ \mathbf{if}\;\ell \leq -2.6 \cdot 10^{+190}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;\ell \leq -9.8 \cdot 10^{-147}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;\ell \leq -6.2 \cdot 10^{-242}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{elif}\;\ell \leq 3 \cdot 10^{-290}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 6
Error23.2
Cost21264
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;\ell \leq -2.6 \cdot 10^{+190}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;\ell \leq -9.8 \cdot 10^{-147}:\\ \;\;\;\;\frac{t_0 \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}\right)\right)}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;\ell \leq -6.2 \cdot 10^{-242}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{elif}\;\ell \leq 3 \cdot 10^{-290}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 7
Error20.4
Cost20932
\[\begin{array}{l} t_0 := 0.5 \cdot {\left(\frac{D}{\frac{d \cdot 2}{M}}\right)}^{2}\\ \mathbf{if}\;h \leq -1 \cdot 10^{+100}:\\ \;\;\;\;\left(1 - \frac{h \cdot t_0}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot {\left(\frac{d}{h}\right)}^{0.5}\right)\\ \mathbf{elif}\;h \leq 0:\\ \;\;\;\;\frac{1}{\frac{-\sqrt{h \cdot \ell}}{d}} \cdot \left(1 - t_0 \cdot \frac{h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 8
Error20.7
Cost20868
\[\begin{array}{l} \mathbf{if}\;h \leq -1 \cdot 10^{+100}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}\right)\right)}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;h \leq 0:\\ \;\;\;\;\frac{1}{\frac{-\sqrt{h \cdot \ell}}{d}} \cdot \left(1 - \left(0.5 \cdot {\left(\frac{D}{\frac{d \cdot 2}{M}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 9
Error22.6
Cost13512
\[\begin{array}{l} \mathbf{if}\;h \leq -4.4 \cdot 10^{+195}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;h \leq 0:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 10
Error22.6
Cost13512
\[\begin{array}{l} \mathbf{if}\;h \leq -4.4 \cdot 10^{+195}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;h \leq 0:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 11
Error23.5
Cost13380
\[\begin{array}{l} \mathbf{if}\;\ell \leq 3 \cdot 10^{-290}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\ \end{array} \]
Alternative 12
Error23.5
Cost13252
\[\begin{array}{l} \mathbf{if}\;\ell \leq 3 \cdot 10^{-290}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 13
Error28.1
Cost7044
\[\begin{array}{l} \mathbf{if}\;\ell \leq -1.1 \cdot 10^{-229}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \]
Alternative 14
Error37.4
Cost6980
\[\begin{array}{l} \mathbf{if}\;\ell \leq -2.35 \cdot 10^{-129}:\\ \;\;\;\;\sqrt{\frac{d \cdot d}{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\ \end{array} \]
Alternative 15
Error37.5
Cost6980
\[\begin{array}{l} \mathbf{if}\;\ell \leq -2.35 \cdot 10^{-129}:\\ \;\;\;\;\sqrt{\frac{d \cdot d}{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \]
Alternative 16
Error43.8
Cost6784
\[d \cdot {\left(h \cdot \ell\right)}^{-0.5} \]
Alternative 17
Error43.8
Cost6720
\[\frac{d}{\sqrt{h \cdot \ell}} \]

Error

Reproduce

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