Average Error: 26.1 → 17.0
Time: 43.2s
Precision: binary64
Cost: 27860
\[ \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{\frac{d}{h}}\\ t_1 := 1 + \frac{\left(h \cdot {\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot -0.5}{\ell}\\ t_2 := \sqrt{-d}\\ t_3 := \frac{t_2}{\sqrt{-\ell}}\\ t_4 := {\left(\frac{d}{\ell}\right)}^{0.5}\\ \mathbf{if}\;\ell \leq -1 \cdot 10^{+208}:\\ \;\;\;\;t_3 \cdot t_0\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-180}:\\ \;\;\;\;\left(\frac{t_2}{\sqrt{-h}} \cdot t_4\right) \cdot t_1\\ \mathbf{elif}\;\ell \leq 0:\\ \;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot t_3\right) \cdot \left(1 + \frac{\left(h \cdot {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2}\right) \cdot -0.5}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 10^{-150}:\\ \;\;\;\;t_1 \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\ \mathbf{elif}\;\ell \leq 5.4 \cdot 10^{+68}:\\ \;\;\;\;\left(t_4 \cdot \frac{\sqrt{d}}{\sqrt{h}}\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{else}:\\ \;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\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 (sqrt (/ d h)))
        (t_1 (+ 1.0 (/ (* (* h (pow (* 0.5 (/ M (/ d D))) 2.0)) -0.5) l)))
        (t_2 (sqrt (- d)))
        (t_3 (/ t_2 (sqrt (- l))))
        (t_4 (pow (/ d l) 0.5)))
   (if (<= l -1e+208)
     (* t_3 t_0)
     (if (<= l -1e-180)
       (* (* (/ t_2 (sqrt (- h))) t_4) t_1)
       (if (<= l 0.0)
         (*
          (* (pow (/ d h) 0.5) t_3)
          (+ 1.0 (/ (* (* h (pow (* (/ D 2.0) (/ M d)) 2.0)) -0.5) l)))
         (if (<= l 1e-150)
           (* t_1 (* t_0 (/ (sqrt d) (sqrt l))))
           (if (<= l 5.4e+68)
             (*
              (* t_4 (/ (sqrt d) (sqrt h)))
              (+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* D M) (* d 2.0)) 2.0)))))
             (* (pow h -0.5) (/ d (sqrt 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 = sqrt((d / h));
	double t_1 = 1.0 + (((h * pow((0.5 * (M / (d / D))), 2.0)) * -0.5) / l);
	double t_2 = sqrt(-d);
	double t_3 = t_2 / sqrt(-l);
	double t_4 = pow((d / l), 0.5);
	double tmp;
	if (l <= -1e+208) {
		tmp = t_3 * t_0;
	} else if (l <= -1e-180) {
		tmp = ((t_2 / sqrt(-h)) * t_4) * t_1;
	} else if (l <= 0.0) {
		tmp = (pow((d / h), 0.5) * t_3) * (1.0 + (((h * pow(((D / 2.0) * (M / d)), 2.0)) * -0.5) / l));
	} else if (l <= 1e-150) {
		tmp = t_1 * (t_0 * (sqrt(d) / sqrt(l)));
	} else if (l <= 5.4e+68) {
		tmp = (t_4 * (sqrt(d) / sqrt(h))) * (1.0 + ((h / l) * (-0.5 * pow(((D * M) / (d * 2.0)), 2.0))));
	} else {
		tmp = pow(h, -0.5) * (d / sqrt(l));
	}
	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) :: t_4
    real(8) :: tmp
    t_0 = sqrt((d / h))
    t_1 = 1.0d0 + (((h * ((0.5d0 * (m / (d / d_1))) ** 2.0d0)) * (-0.5d0)) / l)
    t_2 = sqrt(-d)
    t_3 = t_2 / sqrt(-l)
    t_4 = (d / l) ** 0.5d0
    if (l <= (-1d+208)) then
        tmp = t_3 * t_0
    else if (l <= (-1d-180)) then
        tmp = ((t_2 / sqrt(-h)) * t_4) * t_1
    else if (l <= 0.0d0) then
        tmp = (((d / h) ** 0.5d0) * t_3) * (1.0d0 + (((h * (((d_1 / 2.0d0) * (m / d)) ** 2.0d0)) * (-0.5d0)) / l))
    else if (l <= 1d-150) then
        tmp = t_1 * (t_0 * (sqrt(d) / sqrt(l)))
    else if (l <= 5.4d+68) then
        tmp = (t_4 * (sqrt(d) / sqrt(h))) * (1.0d0 + ((h / l) * ((-0.5d0) * (((d_1 * m) / (d * 2.0d0)) ** 2.0d0))))
    else
        tmp = (h ** (-0.5d0)) * (d / sqrt(l))
    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.sqrt((d / h));
	double t_1 = 1.0 + (((h * Math.pow((0.5 * (M / (d / D))), 2.0)) * -0.5) / l);
	double t_2 = Math.sqrt(-d);
	double t_3 = t_2 / Math.sqrt(-l);
	double t_4 = Math.pow((d / l), 0.5);
	double tmp;
	if (l <= -1e+208) {
		tmp = t_3 * t_0;
	} else if (l <= -1e-180) {
		tmp = ((t_2 / Math.sqrt(-h)) * t_4) * t_1;
	} else if (l <= 0.0) {
		tmp = (Math.pow((d / h), 0.5) * t_3) * (1.0 + (((h * Math.pow(((D / 2.0) * (M / d)), 2.0)) * -0.5) / l));
	} else if (l <= 1e-150) {
		tmp = t_1 * (t_0 * (Math.sqrt(d) / Math.sqrt(l)));
	} else if (l <= 5.4e+68) {
		tmp = (t_4 * (Math.sqrt(d) / Math.sqrt(h))) * (1.0 + ((h / l) * (-0.5 * Math.pow(((D * M) / (d * 2.0)), 2.0))));
	} else {
		tmp = Math.pow(h, -0.5) * (d / Math.sqrt(l));
	}
	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((d / h))
	t_1 = 1.0 + (((h * math.pow((0.5 * (M / (d / D))), 2.0)) * -0.5) / l)
	t_2 = math.sqrt(-d)
	t_3 = t_2 / math.sqrt(-l)
	t_4 = math.pow((d / l), 0.5)
	tmp = 0
	if l <= -1e+208:
		tmp = t_3 * t_0
	elif l <= -1e-180:
		tmp = ((t_2 / math.sqrt(-h)) * t_4) * t_1
	elif l <= 0.0:
		tmp = (math.pow((d / h), 0.5) * t_3) * (1.0 + (((h * math.pow(((D / 2.0) * (M / d)), 2.0)) * -0.5) / l))
	elif l <= 1e-150:
		tmp = t_1 * (t_0 * (math.sqrt(d) / math.sqrt(l)))
	elif l <= 5.4e+68:
		tmp = (t_4 * (math.sqrt(d) / math.sqrt(h))) * (1.0 + ((h / l) * (-0.5 * math.pow(((D * M) / (d * 2.0)), 2.0))))
	else:
		tmp = math.pow(h, -0.5) * (d / math.sqrt(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 = sqrt(Float64(d / h))
	t_1 = Float64(1.0 + Float64(Float64(Float64(h * (Float64(0.5 * Float64(M / Float64(d / D))) ^ 2.0)) * -0.5) / l))
	t_2 = sqrt(Float64(-d))
	t_3 = Float64(t_2 / sqrt(Float64(-l)))
	t_4 = Float64(d / l) ^ 0.5
	tmp = 0.0
	if (l <= -1e+208)
		tmp = Float64(t_3 * t_0);
	elseif (l <= -1e-180)
		tmp = Float64(Float64(Float64(t_2 / sqrt(Float64(-h))) * t_4) * t_1);
	elseif (l <= 0.0)
		tmp = Float64(Float64((Float64(d / h) ^ 0.5) * t_3) * Float64(1.0 + Float64(Float64(Float64(h * (Float64(Float64(D / 2.0) * Float64(M / d)) ^ 2.0)) * -0.5) / l)));
	elseif (l <= 1e-150)
		tmp = Float64(t_1 * Float64(t_0 * Float64(sqrt(d) / sqrt(l))));
	elseif (l <= 5.4e+68)
		tmp = Float64(Float64(t_4 * Float64(sqrt(d) / sqrt(h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0)))));
	else
		tmp = Float64((h ^ -0.5) * Float64(d / sqrt(l)));
	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((d / h));
	t_1 = 1.0 + (((h * ((0.5 * (M / (d / D))) ^ 2.0)) * -0.5) / l);
	t_2 = sqrt(-d);
	t_3 = t_2 / sqrt(-l);
	t_4 = (d / l) ^ 0.5;
	tmp = 0.0;
	if (l <= -1e+208)
		tmp = t_3 * t_0;
	elseif (l <= -1e-180)
		tmp = ((t_2 / sqrt(-h)) * t_4) * t_1;
	elseif (l <= 0.0)
		tmp = (((d / h) ^ 0.5) * t_3) * (1.0 + (((h * (((D / 2.0) * (M / d)) ^ 2.0)) * -0.5) / l));
	elseif (l <= 1e-150)
		tmp = t_1 * (t_0 * (sqrt(d) / sqrt(l)));
	elseif (l <= 5.4e+68)
		tmp = (t_4 * (sqrt(d) / sqrt(h))) * (1.0 + ((h / l) * (-0.5 * (((D * M) / (d * 2.0)) ^ 2.0))));
	else
		tmp = (h ^ -0.5) * (d / sqrt(l));
	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[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(N[(N[(h * N[Power[N[(0.5 * N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]}, If[LessEqual[l, -1e+208], N[(t$95$3 * t$95$0), $MachinePrecision], If[LessEqual[l, -1e-180], N[(N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[l, 0.0], N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * t$95$3), $MachinePrecision] * N[(1.0 + N[(N[(N[(h * N[Power[N[(N[(D / 2.0), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1e-150], N[(t$95$1 * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.4e+68], N[(N[(t$95$4 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[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 := \sqrt{\frac{d}{h}}\\
t_1 := 1 + \frac{\left(h \cdot {\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot -0.5}{\ell}\\
t_2 := \sqrt{-d}\\
t_3 := \frac{t_2}{\sqrt{-\ell}}\\
t_4 := {\left(\frac{d}{\ell}\right)}^{0.5}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{+208}:\\
\;\;\;\;t_3 \cdot t_0\\

\mathbf{elif}\;\ell \leq -1 \cdot 10^{-180}:\\
\;\;\;\;\left(\frac{t_2}{\sqrt{-h}} \cdot t_4\right) \cdot t_1\\

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

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

\mathbf{elif}\;\ell \leq 5.4 \cdot 10^{+68}:\\
\;\;\;\;\left(t_4 \cdot \frac{\sqrt{d}}{\sqrt{h}}\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{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 6 regimes
  2. if l < -9.9999999999999998e207

    1. Initial program 30.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. Simplified30.0

      \[\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. Taylor expanded in M around 0 30.9

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

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

    if -9.9999999999999998e207 < l < -1e-180

    1. Initial program 23.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-rr22.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}{\frac{0.5 \cdot \left({\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot h\right)}{\ell}}\right) \]
    3. Taylor expanded in D around 0 22.1

      \[\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 - \frac{0.5 \cdot \left({\color{blue}{\left(0.5 \cdot \frac{D \cdot M}{d}\right)}}^{2} \cdot h\right)}{\ell}\right) \]
    4. Simplified22.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 - \frac{0.5 \cdot \left({\color{blue}{\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}}^{2} \cdot h\right)}{\ell}\right) \]
    5. Applied egg-rr15.7

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

    if -1e-180 < l < 0.0

    1. Initial program 37.8

      \[\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-rr31.0

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

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

    if 0.0 < l < 1.00000000000000001e-150

    1. Initial program 34.6

      \[\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-rr28.7

      \[\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}{\frac{0.5 \cdot \left({\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot h\right)}{\ell}}\right) \]
    3. Taylor expanded in D around 0 27.9

      \[\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 - \frac{0.5 \cdot \left({\color{blue}{\left(0.5 \cdot \frac{D \cdot M}{d}\right)}}^{2} \cdot h\right)}{\ell}\right) \]
    4. Simplified28.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 - \frac{0.5 \cdot \left({\color{blue}{\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}}^{2} \cdot h\right)}{\ell}\right) \]
    5. Applied egg-rr28.6

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

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

    if 1.00000000000000001e-150 < l < 5.39999999999999982e68

    1. Initial program 19.8

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

      \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \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) \]

    if 5.39999999999999982e68 < l

    1. Initial program 28.3

      \[\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. Simplified28.3

      \[\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. Taylor expanded in M around 0 31.3

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

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

      \[\leadsto \color{blue}{{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}} \]
  3. Recombined 6 regimes into one program.
  4. Final simplification17.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1 \cdot 10^{+208}:\\ \;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-180}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 + \frac{\left(h \cdot {\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot -0.5}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 0:\\ \;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot \left(1 + \frac{\left(h \cdot {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2}\right) \cdot -0.5}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 10^{-150}:\\ \;\;\;\;\left(1 + \frac{\left(h \cdot {\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot -0.5}{\ell}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\ \mathbf{elif}\;\ell \leq 5.4 \cdot 10^{+68}:\\ \;\;\;\;\left({\left(\frac{d}{\ell}\right)}^{0.5} \cdot \frac{\sqrt{d}}{\sqrt{h}}\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{else}:\\ \;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\ \end{array} \]

Alternatives

Alternative 1
Error15.2
Cost40464
\[\begin{array}{l} t_0 := \sqrt{-d}\\ t_1 := {\left(\frac{d}{h}\right)}^{0.5} \cdot \frac{t_0}{\sqrt{-\ell}}\\ t_2 := \frac{D}{2} \cdot \frac{M}{d}\\ t_3 := 1 + \frac{\left(h \cdot {\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot -0.5}{\ell}\\ \mathbf{if}\;\ell \leq -1 \cdot 10^{+208}:\\ \;\;\;\;t_1 \cdot \left(1 - {\left(\sqrt{\frac{h}{\ell}} \cdot \left(t_2 \cdot \sqrt{0.5}\right)\right)}^{2}\right)\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-180}:\\ \;\;\;\;\left(\frac{t_0}{\sqrt{-h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot t_3\\ \mathbf{elif}\;\ell \leq 0:\\ \;\;\;\;t_1 \cdot \left(1 + \frac{\left(h \cdot {t_2}^{2}\right) \cdot -0.5}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 10^{-128}:\\ \;\;\;\;t_3 \cdot \left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{d} \cdot \frac{1}{\sqrt{h}}\right) \cdot \frac{\sqrt{d} \cdot \mathsf{fma}\left({\left(\frac{M}{2 \cdot \frac{d}{D}}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\ \end{array} \]
Alternative 2
Error15.6
Cost40464
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{-d}\\ t_2 := \frac{t_1}{\sqrt{-\ell}}\\ t_3 := 1 + \frac{\left(h \cdot {\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot -0.5}{\ell}\\ \mathbf{if}\;\ell \leq -1 \cdot 10^{+208}:\\ \;\;\;\;t_2 \cdot t_0\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-180}:\\ \;\;\;\;\left(\frac{t_1}{\sqrt{-h}} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot t_3\\ \mathbf{elif}\;\ell \leq 0:\\ \;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot t_2\right) \cdot \left(1 + \frac{\left(h \cdot {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2}\right) \cdot -0.5}{\ell}\right)\\ \mathbf{elif}\;\ell \leq 10^{-128}:\\ \;\;\;\;t_3 \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{d} \cdot \frac{1}{\sqrt{h}}\right) \cdot \frac{\sqrt{d} \cdot \mathsf{fma}\left({\left(\frac{M}{2 \cdot \frac{d}{D}}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\ \end{array} \]
Alternative 3
Error19.7
Cost27532
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{-d}\\ \mathbf{if}\;h \leq -1 \cdot 10^{-105}:\\ \;\;\;\;\frac{t_1}{\sqrt{-\ell}} \cdot t_0\\ \mathbf{elif}\;h \leq 0:\\ \;\;\;\;\frac{t_1}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;h \leq 10^{-75}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + \frac{\left(h \cdot {\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot -0.5}{\ell}\right) \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\ \end{array} \]
Alternative 4
Error17.2
Cost27532
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := 1 + \frac{\left(h \cdot {\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot -0.5}{\ell}\\ t_2 := \sqrt{-d}\\ \mathbf{if}\;h \leq -1 \cdot 10^{-117}:\\ \;\;\;\;t_1 \cdot \left(\frac{t_2}{\sqrt{-\ell}} \cdot t_0\right)\\ \mathbf{elif}\;h \leq 0:\\ \;\;\;\;\frac{t_2}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;h \leq 10^{-75}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\ \end{array} \]
Alternative 5
Error16.7
Cost27532
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := 1 + \frac{\left(h \cdot {\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot -0.5}{\ell}\\ t_2 := \sqrt{-d}\\ \mathbf{if}\;h \leq -1 \cdot 10^{-105}:\\ \;\;\;\;t_1 \cdot \left(\frac{t_2}{\sqrt{-\ell}} \cdot t_0\right)\\ \mathbf{elif}\;h \leq 0:\\ \;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)\right) \cdot \left(\frac{t_2}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\ \mathbf{elif}\;h \leq 10^{-75}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \left(t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\ \end{array} \]
Alternative 6
Error21.3
Cost21264
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \sqrt{-d}\\ \mathbf{if}\;h \leq -1 \cdot 10^{-105}:\\ \;\;\;\;\frac{t_2}{\sqrt{-\ell}} \cdot t_0\\ \mathbf{elif}\;h \leq 0:\\ \;\;\;\;\frac{t_2}{\sqrt{-h}} \cdot t_1\\ \mathbf{elif}\;h \leq 10^{-75}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \mathbf{elif}\;h \leq 2.05 \cdot 10^{+157}:\\ \;\;\;\;\left(1 + \frac{\left(h \cdot {\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot -0.5}{\ell}\right) \cdot \left(t_0 \cdot t_1\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\\ \end{array} \]
Alternative 7
Error21.4
Cost20040
\[\begin{array}{l} t_0 := \sqrt{-d}\\ \mathbf{if}\;h \leq -1 \cdot 10^{-105}:\\ \;\;\;\;\frac{t_0}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;h \leq 0:\\ \;\;\;\;\frac{t_0}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 8
Error22.7
Cost19908
\[\begin{array}{l} \mathbf{if}\;h \leq 0:\\ \;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 9
Error26.0
Cost13444
\[\begin{array}{l} \mathbf{if}\;d \leq 2.75 \cdot 10^{-248}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot {\left(\frac{\ell}{d}\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 10
Error26.1
Cost13380
\[\begin{array}{l} \mathbf{if}\;d \leq 2.75 \cdot 10^{-248}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 11
Error29.5
Cost13252
\[\begin{array}{l} \mathbf{if}\;d \leq 2.75 \cdot 10^{-248}:\\ \;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
Alternative 12
Error33.7
Cost7112
\[\begin{array}{l} t_0 := \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\ \mathbf{if}\;h \leq -6.5 \cdot 10^{-264}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;h \leq 7.2 \cdot 10^{+102}:\\ \;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 13
Error36.9
Cost6980
\[\begin{array}{l} \mathbf{if}\;h \leq -5.1 \cdot 10^{-292}:\\ \;\;\;\;\sqrt{\frac{d \cdot d}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \end{array} \]
Alternative 14
Error44.1
Cost6784
\[d \cdot {\left(\ell \cdot h\right)}^{-0.5} \]
Alternative 15
Error44.1
Cost6720
\[\frac{d}{\sqrt{\ell \cdot h}} \]

Error

Reproduce

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