Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.2% → 81.2%
Time: 16.4s
Alternatives: 14
Speedup: 3.3×

Specification

?
\[\begin{array}{l} \\ \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) \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)))))
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)));
}
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
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)));
}
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)))
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 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
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]
\begin{array}{l}

\\
\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)
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 14 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 66.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \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) \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)))))
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)));
}
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
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)));
}
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)))
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 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
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]
\begin{array}{l}

\\
\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)
\end{array}

Alternative 1: 81.2% accurate, 1.2× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := \frac{\sqrt{d}}{\sqrt{\ell}}\\ t_1 := 1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\\ \mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_1\\ \mathbf{elif}\;d \leq 7.8 \cdot 10^{-116}:\\ \;\;\;\;\frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d \cdot 2}{M \cdot D}\right)}^{-2}, 1\right) \cdot t\_0\right) \cdot \sqrt{d}}{\sqrt{h}}\\ \mathbf{else}:\\ \;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot t\_0\right) \cdot t\_1\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (/ (sqrt d) (sqrt l)))
        (t_1
         (-
          1.0
          (*
           (/ (* (* (/ D d) M) 0.5) l)
           (* 0.5 (* (* (* 0.5 (/ D d)) M) h))))))
   (if (<= d -5e-310)
     (* (* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l))) t_1)
     (if (<= d 7.8e-116)
       (/
        (*
         (* (fma (* -0.5 (/ h l)) (pow (/ (* d 2.0) (* M D)) -2.0) 1.0) t_0)
         (sqrt d))
        (sqrt h))
       (* (* (pow (/ d h) (pow 2.0 -1.0)) t_0) t_1)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt(d) / sqrt(l);
	double t_1 = 1.0 - (((((D / d) * M) * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h)));
	double tmp;
	if (d <= -5e-310) {
		tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * t_1;
	} else if (d <= 7.8e-116) {
		tmp = ((fma((-0.5 * (h / l)), pow(((d * 2.0) / (M * D)), -2.0), 1.0) * t_0) * sqrt(d)) / sqrt(h);
	} else {
		tmp = (pow((d / h), pow(2.0, -1.0)) * t_0) * t_1;
	}
	return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	t_0 = Float64(sqrt(d) / sqrt(l))
	t_1 = Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D / d) * M) * 0.5) / l) * Float64(0.5 * Float64(Float64(Float64(0.5 * Float64(D / d)) * M) * h))))
	tmp = 0.0
	if (d <= -5e-310)
		tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * t_1);
	elseif (d <= 7.8e-116)
		tmp = Float64(Float64(Float64(fma(Float64(-0.5 * Float64(h / l)), (Float64(Float64(d * 2.0) / Float64(M * D)) ^ -2.0), 1.0) * t_0) * sqrt(d)) / sqrt(h));
	else
		tmp = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * t_0) * t_1);
	end
	return tmp
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(N[(N[(N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision] * N[(0.5 * N[(N[(N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, 7.8e-116], N[(N[(N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(d * 2.0), $MachinePrecision] / N[(M * D), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{d}}{\sqrt{\ell}}\\
t_1 := 1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\\
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_1\\

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

\mathbf{else}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot t\_0\right) \cdot t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -4.999999999999985e-310

    1. Initial program 70.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\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(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}}\right) \]
      2. lift-/.f64N/A

        \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
      3. clear-numN/A

        \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{1}{\frac{\ell}{h}}}\right) \]
      4. un-div-invN/A

        \[\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{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\frac{\ell}{h}}}\right) \]
      5. lift-*.f64N/A

        \[\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{\color{blue}{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
      6. *-commutativeN/A

        \[\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{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}}}{\frac{\ell}{h}}\right) \]
      7. lift-pow.f64N/A

        \[\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{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}} \cdot \frac{1}{2}}{\frac{\ell}{h}}\right) \]
      8. unpow2N/A

        \[\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{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \cdot \frac{1}{2}}{\frac{\ell}{h}}\right) \]
      9. associate-*l*N/A

        \[\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{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}\right)}}{\frac{\ell}{h}}\right) \]
      10. div-invN/A

        \[\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{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}\right)}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
      11. times-fracN/A

        \[\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{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}}{\frac{1}{h}}}\right) \]
      12. lower-*.f64N/A

        \[\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{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}}{\frac{1}{h}}}\right) \]
    4. Applied rewrites68.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{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \frac{\left(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{{h}^{-1}}}\right) \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\frac{\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}}{{h}^{-1}}}\right) \]
      2. div-invN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\left(\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}\right) \cdot \frac{1}{{h}^{-1}}\right)}\right) \]
      3. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\color{blue}{\left(\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}\right)} \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      4. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\color{blue}{\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right)} \cdot \frac{M}{d}\right) \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      5. associate-*l*N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\color{blue}{\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right)} \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      6. lift-pow.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \frac{1}{\color{blue}{{h}^{-1}}}\right)\right) \]
      7. unpow-1N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \frac{1}{\color{blue}{\frac{1}{h}}}\right)\right) \]
      8. remove-double-divN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \color{blue}{h}\right)\right) \]
      9. associate-*l*N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)}\right) \]
      10. lower-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)}\right) \]
      11. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\color{blue}{\left(D \cdot \frac{1}{2}\right)} \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      12. metadata-evalN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \color{blue}{\frac{1}{2}}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      13. div-invN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\color{blue}{\frac{D}{2}} \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      14. lift-/.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\frac{D}{2} \cdot \color{blue}{\frac{M}{d}}\right) \cdot h\right)\right)\right) \]
      15. times-fracN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\color{blue}{\frac{D \cdot M}{2 \cdot d}} \cdot h\right)\right)\right) \]
      16. *-commutativeN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\frac{\color{blue}{M \cdot D}}{2 \cdot d} \cdot h\right)\right)\right) \]
      17. lower-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot h\right)}\right)\right) \]
    6. Applied rewrites69.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 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \color{blue}{\left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)}\right) \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      2. metadata-eval69.7

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      3. lift-pow.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      4. pow1/2N/A

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

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

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
    9. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      3. lift-pow.f64N/A

        \[\leadsto \left(\color{blue}{{\left(\frac{d}{h}\right)}^{\frac{1}{2}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      4. unpow1/2N/A

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      5. lift-/.f64N/A

        \[\leadsto \left(\sqrt{\color{blue}{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      6. frac-2negN/A

        \[\leadsto \left(\sqrt{\color{blue}{\frac{\mathsf{neg}\left(d\right)}{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      7. sqrt-divN/A

        \[\leadsto \left(\color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      8. lower-/.f64N/A

        \[\leadsto \left(\color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      9. lower-sqrt.f64N/A

        \[\leadsto \left(\frac{\color{blue}{\sqrt{\mathsf{neg}\left(d\right)}}}{\sqrt{\mathsf{neg}\left(h\right)}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      10. lower-neg.f64N/A

        \[\leadsto \left(\frac{\sqrt{\color{blue}{-d}}}{\sqrt{\mathsf{neg}\left(h\right)}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      11. lower-sqrt.f64N/A

        \[\leadsto \left(\frac{\sqrt{-d}}{\color{blue}{\sqrt{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      12. lower-neg.f6480.8

        \[\leadsto \left(\frac{\sqrt{-d}}{\sqrt{\color{blue}{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
    10. Applied rewrites80.8%

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

    if -4.999999999999985e-310 < d < 7.8000000000000001e-116

    1. Initial program 35.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. Add Preprocessing
    3. Applied rewrites53.0%

      \[\leadsto \color{blue}{\frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{-2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}}} \]
    4. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{h}{\ell}, {\left(\color{blue}{\frac{d}{M}} \cdot \frac{2}{D}\right)}^{-2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
      3. lift-/.f64N/A

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{h}{\ell}, {\color{blue}{\left(\frac{d \cdot 2}{M \cdot D}\right)}}^{-2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
      5. *-commutativeN/A

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{h}{\ell}, {\color{blue}{\left(\frac{2 \cdot d}{M \cdot D}\right)}}^{-2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{h}{\ell}, {\left(\frac{\color{blue}{d \cdot 2}}{M \cdot D}\right)}^{-2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
      8. lower-*.f64N/A

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

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

      \[\leadsto \frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\color{blue}{\left(\frac{d \cdot 2}{M \cdot D}\right)}}^{-2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{h}{\ell}, {\left(\frac{d \cdot 2}{M \cdot D}\right)}^{-2}, 1\right) \cdot \frac{\color{blue}{\sqrt{d}}}{\sqrt{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
      5. lower-/.f64N/A

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

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

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

    if 7.8000000000000001e-116 < d

    1. Initial program 77.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\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(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}}\right) \]
      2. lift-/.f64N/A

        \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
      3. clear-numN/A

        \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{1}{\frac{\ell}{h}}}\right) \]
      4. un-div-invN/A

        \[\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{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\frac{\ell}{h}}}\right) \]
      5. lift-*.f64N/A

        \[\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{\color{blue}{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
      6. *-commutativeN/A

        \[\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{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}}}{\frac{\ell}{h}}\right) \]
      7. lift-pow.f64N/A

        \[\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{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}} \cdot \frac{1}{2}}{\frac{\ell}{h}}\right) \]
      8. unpow2N/A

        \[\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{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \cdot \frac{1}{2}}{\frac{\ell}{h}}\right) \]
      9. associate-*l*N/A

        \[\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{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}\right)}}{\frac{\ell}{h}}\right) \]
      10. div-invN/A

        \[\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{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}\right)}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
      11. times-fracN/A

        \[\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{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}}{\frac{1}{h}}}\right) \]
      12. lower-*.f64N/A

        \[\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{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}}{\frac{1}{h}}}\right) \]
    4. Applied rewrites86.4%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \frac{\left(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{{h}^{-1}}}\right) \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\frac{\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}}{{h}^{-1}}}\right) \]
      2. div-invN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\left(\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}\right) \cdot \frac{1}{{h}^{-1}}\right)}\right) \]
      3. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\color{blue}{\left(\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}\right)} \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      4. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\color{blue}{\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right)} \cdot \frac{M}{d}\right) \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      5. associate-*l*N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\color{blue}{\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right)} \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      6. lift-pow.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \frac{1}{\color{blue}{{h}^{-1}}}\right)\right) \]
      7. unpow-1N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \frac{1}{\color{blue}{\frac{1}{h}}}\right)\right) \]
      8. remove-double-divN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \color{blue}{h}\right)\right) \]
      9. associate-*l*N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)}\right) \]
      10. lower-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)}\right) \]
      11. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\color{blue}{\left(D \cdot \frac{1}{2}\right)} \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      12. metadata-evalN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \color{blue}{\frac{1}{2}}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      13. div-invN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\color{blue}{\frac{D}{2}} \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      14. lift-/.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\frac{D}{2} \cdot \color{blue}{\frac{M}{d}}\right) \cdot h\right)\right)\right) \]
      15. times-fracN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\color{blue}{\frac{D \cdot M}{2 \cdot d}} \cdot h\right)\right)\right) \]
      16. *-commutativeN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\frac{\color{blue}{M \cdot D}}{2 \cdot d} \cdot h\right)\right)\right) \]
      17. lower-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot h\right)}\right)\right) \]
    6. Applied rewrites87.4%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \color{blue}{\left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)}\right) \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      2. metadata-eval87.4

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      3. lift-pow.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      4. pow1/2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      5. lift-/.f64N/A

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

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      7. lift-sqrt.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \frac{\color{blue}{\sqrt{d}}}{\sqrt{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      8. pow1/2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \frac{\sqrt{d}}{\color{blue}{{\ell}^{\frac{1}{2}}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      9. lower-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\frac{\sqrt{d}}{{\ell}^{\frac{1}{2}}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      10. pow1/2N/A

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

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

      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification83.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)\\ \mathbf{elif}\;d \leq 7.8 \cdot 10^{-116}:\\ \;\;\;\;\frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d \cdot 2}{M \cdot D}\right)}^{-2}, 1\right) \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}}\\ \mathbf{else}:\\ \;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 81.6% accurate, 1.8× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \frac{D}{d} \cdot M\\ \mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right) \cdot \left(1 - \frac{t\_1 \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)\\ \mathbf{elif}\;d \leq 6.8 \cdot 10^{-164}:\\ \;\;\;\;\frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d \cdot 2}{M \cdot D}\right)}^{-2}, 1\right) \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{t\_1 \cdot -0.5}{\ell} \cdot \left(\frac{M}{d} \cdot \left(0.25 \cdot D\right)\right), h, 1\right) \cdot t\_0\right) \cdot \sqrt{d}}{\sqrt{h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l))) (t_1 (* (/ D d) M)))
   (if (<= d -5e-310)
     (*
      (* (/ (sqrt (- d)) (sqrt (- h))) t_0)
      (- 1.0 (* (/ (* t_1 0.5) l) (* 0.5 (* (* (* 0.5 (/ D d)) M) h)))))
     (if (<= d 6.8e-164)
       (/
        (*
         (*
          (fma (* -0.5 (/ h l)) (pow (/ (* d 2.0) (* M D)) -2.0) 1.0)
          (/ (sqrt d) (sqrt l)))
         (sqrt d))
        (sqrt h))
       (/
        (*
         (* (fma (* (/ (* t_1 -0.5) l) (* (/ M d) (* 0.25 D))) h 1.0) t_0)
         (sqrt d))
        (sqrt h))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double t_1 = (D / d) * M;
	double tmp;
	if (d <= -5e-310) {
		tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * (1.0 - (((t_1 * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))));
	} else if (d <= 6.8e-164) {
		tmp = ((fma((-0.5 * (h / l)), pow(((d * 2.0) / (M * D)), -2.0), 1.0) * (sqrt(d) / sqrt(l))) * sqrt(d)) / sqrt(h);
	} else {
		tmp = ((fma((((t_1 * -0.5) / l) * ((M / d) * (0.25 * D))), h, 1.0) * t_0) * sqrt(d)) / sqrt(h);
	}
	return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = Float64(Float64(D / d) * M)
	tmp = 0.0
	if (d <= -5e-310)
		tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0) * Float64(1.0 - Float64(Float64(Float64(t_1 * 0.5) / l) * Float64(0.5 * Float64(Float64(Float64(0.5 * Float64(D / d)) * M) * h)))));
	elseif (d <= 6.8e-164)
		tmp = Float64(Float64(Float64(fma(Float64(-0.5 * Float64(h / l)), (Float64(Float64(d * 2.0) / Float64(M * D)) ^ -2.0), 1.0) * Float64(sqrt(d) / sqrt(l))) * sqrt(d)) / sqrt(h));
	else
		tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(t_1 * -0.5) / l) * Float64(Float64(M / d) * Float64(0.25 * D))), h, 1.0) * t_0) * sqrt(d)) / sqrt(h));
	end
	return tmp
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision]}, If[LessEqual[d, -5e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(t$95$1 * 0.5), $MachinePrecision] / l), $MachinePrecision] * N[(0.5 * N[(N[(N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.8e-164], N[(N[(N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(d * 2.0), $MachinePrecision] / N[(M * D), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(t$95$1 * -0.5), $MachinePrecision] / l), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(0.25 * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \frac{D}{d} \cdot M\\
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right) \cdot \left(1 - \frac{t\_1 \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{t\_1 \cdot -0.5}{\ell} \cdot \left(\frac{M}{d} \cdot \left(0.25 \cdot D\right)\right), h, 1\right) \cdot t\_0\right) \cdot \sqrt{d}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -4.999999999999985e-310

    1. Initial program 70.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\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(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}}\right) \]
      2. lift-/.f64N/A

        \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
      3. clear-numN/A

        \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{1}{\frac{\ell}{h}}}\right) \]
      4. un-div-invN/A

        \[\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{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\frac{\ell}{h}}}\right) \]
      5. lift-*.f64N/A

        \[\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{\color{blue}{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
      6. *-commutativeN/A

        \[\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{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}}}{\frac{\ell}{h}}\right) \]
      7. lift-pow.f64N/A

        \[\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{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}} \cdot \frac{1}{2}}{\frac{\ell}{h}}\right) \]
      8. unpow2N/A

        \[\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{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \cdot \frac{1}{2}}{\frac{\ell}{h}}\right) \]
      9. associate-*l*N/A

        \[\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{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}\right)}}{\frac{\ell}{h}}\right) \]
      10. div-invN/A

        \[\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{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}\right)}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
      11. times-fracN/A

        \[\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{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}}{\frac{1}{h}}}\right) \]
      12. lower-*.f64N/A

        \[\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{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}}{\frac{1}{h}}}\right) \]
    4. Applied rewrites68.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{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \frac{\left(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{{h}^{-1}}}\right) \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\frac{\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}}{{h}^{-1}}}\right) \]
      2. div-invN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\left(\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}\right) \cdot \frac{1}{{h}^{-1}}\right)}\right) \]
      3. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\color{blue}{\left(\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}\right)} \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      4. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\color{blue}{\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right)} \cdot \frac{M}{d}\right) \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      5. associate-*l*N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\color{blue}{\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right)} \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      6. lift-pow.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \frac{1}{\color{blue}{{h}^{-1}}}\right)\right) \]
      7. unpow-1N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \frac{1}{\color{blue}{\frac{1}{h}}}\right)\right) \]
      8. remove-double-divN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \color{blue}{h}\right)\right) \]
      9. associate-*l*N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)}\right) \]
      10. lower-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)}\right) \]
      11. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\color{blue}{\left(D \cdot \frac{1}{2}\right)} \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      12. metadata-evalN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \color{blue}{\frac{1}{2}}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      13. div-invN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\color{blue}{\frac{D}{2}} \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      14. lift-/.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\frac{D}{2} \cdot \color{blue}{\frac{M}{d}}\right) \cdot h\right)\right)\right) \]
      15. times-fracN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\color{blue}{\frac{D \cdot M}{2 \cdot d}} \cdot h\right)\right)\right) \]
      16. *-commutativeN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\frac{\color{blue}{M \cdot D}}{2 \cdot d} \cdot h\right)\right)\right) \]
      17. lower-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot h\right)}\right)\right) \]
    6. Applied rewrites69.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 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \color{blue}{\left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)}\right) \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      2. metadata-eval69.7

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      3. lift-pow.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      4. pow1/2N/A

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

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

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
    9. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      3. lift-pow.f64N/A

        \[\leadsto \left(\color{blue}{{\left(\frac{d}{h}\right)}^{\frac{1}{2}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      4. unpow1/2N/A

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      5. lift-/.f64N/A

        \[\leadsto \left(\sqrt{\color{blue}{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      6. frac-2negN/A

        \[\leadsto \left(\sqrt{\color{blue}{\frac{\mathsf{neg}\left(d\right)}{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      7. sqrt-divN/A

        \[\leadsto \left(\color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      8. lower-/.f64N/A

        \[\leadsto \left(\color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      9. lower-sqrt.f64N/A

        \[\leadsto \left(\frac{\color{blue}{\sqrt{\mathsf{neg}\left(d\right)}}}{\sqrt{\mathsf{neg}\left(h\right)}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      10. lower-neg.f64N/A

        \[\leadsto \left(\frac{\sqrt{\color{blue}{-d}}}{\sqrt{\mathsf{neg}\left(h\right)}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      11. lower-sqrt.f64N/A

        \[\leadsto \left(\frac{\sqrt{-d}}{\color{blue}{\sqrt{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      12. lower-neg.f6480.8

        \[\leadsto \left(\frac{\sqrt{-d}}{\sqrt{\color{blue}{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
    10. Applied rewrites80.8%

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

    if -4.999999999999985e-310 < d < 6.8e-164

    1. Initial program 29.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. Add Preprocessing
    3. Applied rewrites47.8%

      \[\leadsto \color{blue}{\frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{-2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}}} \]
    4. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{h}{\ell}, {\left(\color{blue}{\frac{d}{M}} \cdot \frac{2}{D}\right)}^{-2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
      3. lift-/.f64N/A

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{h}{\ell}, {\color{blue}{\left(\frac{d \cdot 2}{M \cdot D}\right)}}^{-2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
      5. *-commutativeN/A

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{h}{\ell}, {\color{blue}{\left(\frac{2 \cdot d}{M \cdot D}\right)}}^{-2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{h}{\ell}, {\left(\frac{\color{blue}{d \cdot 2}}{M \cdot D}\right)}^{-2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
      8. lower-*.f64N/A

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

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

      \[\leadsto \frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\color{blue}{\left(\frac{d \cdot 2}{M \cdot D}\right)}}^{-2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{-1}{2} \cdot \frac{h}{\ell}, {\left(\frac{d \cdot 2}{M \cdot D}\right)}^{-2}, 1\right) \cdot \frac{\color{blue}{\sqrt{d}}}{\sqrt{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
      5. lower-/.f64N/A

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

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

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

    if 6.8e-164 < d

    1. Initial program 76.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. Add Preprocessing
    3. Applied rewrites79.1%

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

      \[\leadsto \frac{\left(\color{blue}{\mathsf{fma}\left(\frac{\left(\frac{D}{d} \cdot M\right) \cdot -0.5}{\ell} \cdot \left(\frac{M}{d} \cdot \left(0.25 \cdot D\right)\right), h, 1\right)} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 78.9% accurate, 2.9× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \frac{D}{d} \cdot M\\ \mathbf{if}\;h \leq -4 \cdot 10^{-310}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right) \cdot \left(1 - \frac{t\_1 \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{t\_1 \cdot -0.5}{\ell}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\right), 1\right) \cdot t\_0\right) \cdot \sqrt{d}}{\sqrt{h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l))) (t_1 (* (/ D d) M)))
   (if (<= h -4e-310)
     (*
      (* (/ (sqrt (- d)) (sqrt (- h))) t_0)
      (- 1.0 (* (/ (* t_1 0.5) l) (* 0.5 (* (* (* 0.5 (/ D d)) M) h)))))
     (/
      (*
       (* (fma (/ (* t_1 -0.5) l) (* (* (/ M d) h) (* 0.25 D)) 1.0) t_0)
       (sqrt d))
      (sqrt h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double t_1 = (D / d) * M;
	double tmp;
	if (h <= -4e-310) {
		tmp = ((sqrt(-d) / sqrt(-h)) * t_0) * (1.0 - (((t_1 * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))));
	} else {
		tmp = ((fma(((t_1 * -0.5) / l), (((M / d) * h) * (0.25 * D)), 1.0) * t_0) * sqrt(d)) / sqrt(h);
	}
	return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = Float64(Float64(D / d) * M)
	tmp = 0.0
	if (h <= -4e-310)
		tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0) * Float64(1.0 - Float64(Float64(Float64(t_1 * 0.5) / l) * Float64(0.5 * Float64(Float64(Float64(0.5 * Float64(D / d)) * M) * h)))));
	else
		tmp = Float64(Float64(Float64(fma(Float64(Float64(t_1 * -0.5) / l), Float64(Float64(Float64(M / d) * h) * Float64(0.25 * D)), 1.0) * t_0) * sqrt(d)) / sqrt(h));
	end
	return tmp
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision]}, If[LessEqual[h, -4e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(t$95$1 * 0.5), $MachinePrecision] / l), $MachinePrecision] * N[(0.5 * N[(N[(N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(t$95$1 * -0.5), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision] * N[(0.25 * D), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \frac{D}{d} \cdot M\\
\mathbf{if}\;h \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\right) \cdot \left(1 - \frac{t\_1 \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{t\_1 \cdot -0.5}{\ell}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\right), 1\right) \cdot t\_0\right) \cdot \sqrt{d}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if h < -3.999999999999988e-310

    1. Initial program 70.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\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(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}}\right) \]
      2. lift-/.f64N/A

        \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
      3. clear-numN/A

        \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{1}{\frac{\ell}{h}}}\right) \]
      4. un-div-invN/A

        \[\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{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\frac{\ell}{h}}}\right) \]
      5. lift-*.f64N/A

        \[\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{\color{blue}{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
      6. *-commutativeN/A

        \[\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{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}}}{\frac{\ell}{h}}\right) \]
      7. lift-pow.f64N/A

        \[\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{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}} \cdot \frac{1}{2}}{\frac{\ell}{h}}\right) \]
      8. unpow2N/A

        \[\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{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \cdot \frac{1}{2}}{\frac{\ell}{h}}\right) \]
      9. associate-*l*N/A

        \[\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{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}\right)}}{\frac{\ell}{h}}\right) \]
      10. div-invN/A

        \[\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{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}\right)}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
      11. times-fracN/A

        \[\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{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}}{\frac{1}{h}}}\right) \]
      12. lower-*.f64N/A

        \[\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{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}}{\frac{1}{h}}}\right) \]
    4. Applied rewrites68.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{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \frac{\left(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{{h}^{-1}}}\right) \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\frac{\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}}{{h}^{-1}}}\right) \]
      2. div-invN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\left(\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}\right) \cdot \frac{1}{{h}^{-1}}\right)}\right) \]
      3. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\color{blue}{\left(\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}\right)} \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      4. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\color{blue}{\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right)} \cdot \frac{M}{d}\right) \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      5. associate-*l*N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\color{blue}{\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right)} \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      6. lift-pow.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \frac{1}{\color{blue}{{h}^{-1}}}\right)\right) \]
      7. unpow-1N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \frac{1}{\color{blue}{\frac{1}{h}}}\right)\right) \]
      8. remove-double-divN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \color{blue}{h}\right)\right) \]
      9. associate-*l*N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)}\right) \]
      10. lower-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)}\right) \]
      11. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\color{blue}{\left(D \cdot \frac{1}{2}\right)} \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      12. metadata-evalN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \color{blue}{\frac{1}{2}}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      13. div-invN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\color{blue}{\frac{D}{2}} \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      14. lift-/.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\frac{D}{2} \cdot \color{blue}{\frac{M}{d}}\right) \cdot h\right)\right)\right) \]
      15. times-fracN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\color{blue}{\frac{D \cdot M}{2 \cdot d}} \cdot h\right)\right)\right) \]
      16. *-commutativeN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\frac{\color{blue}{M \cdot D}}{2 \cdot d} \cdot h\right)\right)\right) \]
      17. lower-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot h\right)}\right)\right) \]
    6. Applied rewrites69.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 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \color{blue}{\left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)}\right) \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      2. metadata-eval69.7

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      3. lift-pow.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      4. pow1/2N/A

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

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

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
    9. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      3. lift-pow.f64N/A

        \[\leadsto \left(\color{blue}{{\left(\frac{d}{h}\right)}^{\frac{1}{2}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      4. unpow1/2N/A

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      5. lift-/.f64N/A

        \[\leadsto \left(\sqrt{\color{blue}{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      6. frac-2negN/A

        \[\leadsto \left(\sqrt{\color{blue}{\frac{\mathsf{neg}\left(d\right)}{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      7. sqrt-divN/A

        \[\leadsto \left(\color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      8. lower-/.f64N/A

        \[\leadsto \left(\color{blue}{\frac{\sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      9. lower-sqrt.f64N/A

        \[\leadsto \left(\frac{\color{blue}{\sqrt{\mathsf{neg}\left(d\right)}}}{\sqrt{\mathsf{neg}\left(h\right)}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      10. lower-neg.f64N/A

        \[\leadsto \left(\frac{\sqrt{\color{blue}{-d}}}{\sqrt{\mathsf{neg}\left(h\right)}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      11. lower-sqrt.f64N/A

        \[\leadsto \left(\frac{\sqrt{-d}}{\color{blue}{\sqrt{\mathsf{neg}\left(h\right)}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      12. lower-neg.f6480.8

        \[\leadsto \left(\frac{\sqrt{-d}}{\sqrt{\color{blue}{-h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
    10. Applied rewrites80.8%

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

    if -3.999999999999988e-310 < h

    1. Initial program 66.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. Add Preprocessing
    3. Applied rewrites72.6%

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

      \[\leadsto \frac{\left(\color{blue}{\mathsf{fma}\left(\frac{\left(\frac{D}{d} \cdot M\right) \cdot -0.5}{\ell}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\right), 1\right)} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 74.7% accurate, 2.9× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := M \cdot \left(\frac{D}{d} \cdot 0.5\right)\\ \mathbf{if}\;h \leq -4 \cdot 10^{-310}:\\ \;\;\;\;\frac{\left(\mathsf{fma}\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot t\_0, t\_0, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{\left(\frac{D}{d} \cdot M\right) \cdot -0.5}{\ell}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\right), 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* M (* (/ D d) 0.5))))
   (if (<= h -4e-310)
     (/
      (*
       (* (fma (* (* (/ h l) -0.5) t_0) t_0 1.0) (sqrt (/ d h)))
       (sqrt (- d)))
      (sqrt (- l)))
     (/
      (*
       (*
        (fma (/ (* (* (/ D d) M) -0.5) l) (* (* (/ M d) h) (* 0.25 D)) 1.0)
        (sqrt (/ d l)))
       (sqrt d))
      (sqrt h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = M * ((D / d) * 0.5);
	double tmp;
	if (h <= -4e-310) {
		tmp = ((fma((((h / l) * -0.5) * t_0), t_0, 1.0) * sqrt((d / h))) * sqrt(-d)) / sqrt(-l);
	} else {
		tmp = ((fma(((((D / d) * M) * -0.5) / l), (((M / d) * h) * (0.25 * D)), 1.0) * sqrt((d / l))) * sqrt(d)) / sqrt(h);
	}
	return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	t_0 = Float64(M * Float64(Float64(D / d) * 0.5))
	tmp = 0.0
	if (h <= -4e-310)
		tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(h / l) * -0.5) * t_0), t_0, 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(-d))) / sqrt(Float64(-l)));
	else
		tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(Float64(D / d) * M) * -0.5) / l), Float64(Float64(Float64(M / d) * h) * Float64(0.25 * D)), 1.0) * sqrt(Float64(d / l))) * sqrt(d)) / sqrt(h));
	end
	return tmp
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(M * N[(N[(D / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -4e-310], N[(N[(N[(N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision] * N[(0.25 * D), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := M \cdot \left(\frac{D}{d} \cdot 0.5\right)\\
\mathbf{if}\;h \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot t\_0, t\_0, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{\left(\frac{D}{d} \cdot M\right) \cdot -0.5}{\ell}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\right), 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if h < -3.999999999999988e-310

    1. Initial program 70.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. Add Preprocessing
    3. Applied rewrites71.3%

      \[\leadsto \color{blue}{\frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{-2}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
    4. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \frac{\left(\color{blue}{\left(\left(\frac{-1}{2} \cdot \frac{h}{\ell}\right) \cdot {\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{-2} + 1\right)} \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
      2. lift-pow.f64N/A

        \[\leadsto \frac{\left(\left(\left(\frac{-1}{2} \cdot \frac{h}{\ell}\right) \cdot \color{blue}{{\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{-2}} + 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
      3. metadata-evalN/A

        \[\leadsto \frac{\left(\left(\left(\frac{-1}{2} \cdot \frac{h}{\ell}\right) \cdot {\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{\color{blue}{\left(-1 \cdot 2\right)}} + 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
      4. pow-powN/A

        \[\leadsto \frac{\left(\left(\left(\frac{-1}{2} \cdot \frac{h}{\ell}\right) \cdot \color{blue}{{\left({\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{-1}\right)}^{2}} + 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
      5. inv-powN/A

        \[\leadsto \frac{\left(\left(\left(\frac{-1}{2} \cdot \frac{h}{\ell}\right) \cdot {\color{blue}{\left(\frac{1}{\frac{d}{M} \cdot \frac{2}{D}}\right)}}^{2} + 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\left(\left(\left(\frac{-1}{2} \cdot \frac{h}{\ell}\right) \cdot {\left(\frac{1}{\color{blue}{\frac{d}{M} \cdot \frac{2}{D}}}\right)}^{2} + 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
      7. lift-/.f64N/A

        \[\leadsto \frac{\left(\left(\left(\frac{-1}{2} \cdot \frac{h}{\ell}\right) \cdot {\left(\frac{1}{\color{blue}{\frac{d}{M}} \cdot \frac{2}{D}}\right)}^{2} + 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
      8. lift-/.f64N/A

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

        \[\leadsto \frac{\left(\left(\left(\frac{-1}{2} \cdot \frac{h}{\ell}\right) \cdot {\left(\frac{1}{\color{blue}{\frac{d \cdot 2}{M \cdot D}}}\right)}^{2} + 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
      10. *-commutativeN/A

        \[\leadsto \frac{\left(\left(\left(\frac{-1}{2} \cdot \frac{h}{\ell}\right) \cdot {\left(\frac{1}{\frac{\color{blue}{2 \cdot d}}{M \cdot D}}\right)}^{2} + 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
      11. clear-numN/A

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

        \[\leadsto \frac{\left(\left(\left(\frac{-1}{2} \cdot \frac{h}{\ell}\right) \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} + 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
      13. associate-*r*N/A

        \[\leadsto \frac{\left(\left(\color{blue}{\left(\left(\frac{-1}{2} \cdot \frac{h}{\ell}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}} + 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
      14. lower-fma.f64N/A

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

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

    if -3.999999999999988e-310 < h

    1. Initial program 66.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. Add Preprocessing
    3. Applied rewrites72.6%

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

      \[\leadsto \frac{\left(\color{blue}{\mathsf{fma}\left(\frac{\left(\frac{D}{d} \cdot M\right) \cdot -0.5}{\ell}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\right), 1\right)} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 72.6% accurate, 3.1× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := \frac{D}{d} \cdot M\\ t_1 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;\ell \leq 3.6 \cdot 10^{-161}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t\_1\right) \cdot \left(1 - \frac{t\_0 \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{t\_0 \cdot -0.5}{\ell}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\right), 1\right) \cdot t\_1\right) \cdot \sqrt{d}}{\sqrt{h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* (/ D d) M)) (t_1 (sqrt (/ d l))))
   (if (<= l 3.6e-161)
     (*
      (* (sqrt (/ d h)) t_1)
      (- 1.0 (* (/ (* t_0 0.5) l) (* 0.5 (* (* (* 0.5 (/ D d)) M) h)))))
     (/
      (*
       (* (fma (/ (* t_0 -0.5) l) (* (* (/ M d) h) (* 0.25 D)) 1.0) t_1)
       (sqrt d))
      (sqrt h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = (D / d) * M;
	double t_1 = sqrt((d / l));
	double tmp;
	if (l <= 3.6e-161) {
		tmp = (sqrt((d / h)) * t_1) * (1.0 - (((t_0 * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))));
	} else {
		tmp = ((fma(((t_0 * -0.5) / l), (((M / d) * h) * (0.25 * D)), 1.0) * t_1) * sqrt(d)) / sqrt(h);
	}
	return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	t_0 = Float64(Float64(D / d) * M)
	t_1 = sqrt(Float64(d / l))
	tmp = 0.0
	if (l <= 3.6e-161)
		tmp = Float64(Float64(sqrt(Float64(d / h)) * t_1) * Float64(1.0 - Float64(Float64(Float64(t_0 * 0.5) / l) * Float64(0.5 * Float64(Float64(Float64(0.5 * Float64(D / d)) * M) * h)))));
	else
		tmp = Float64(Float64(Float64(fma(Float64(Float64(t_0 * -0.5) / l), Float64(Float64(Float64(M / d) * h) * Float64(0.25 * D)), 1.0) * t_1) * sqrt(d)) / sqrt(h));
	end
	return tmp
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 3.6e-161], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(N[(t$95$0 * 0.5), $MachinePrecision] / l), $MachinePrecision] * N[(0.5 * N[(N[(N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(t$95$0 * -0.5), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision] * N[(0.25 * D), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{D}{d} \cdot M\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq 3.6 \cdot 10^{-161}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t\_1\right) \cdot \left(1 - \frac{t\_0 \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{t\_0 \cdot -0.5}{\ell}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\right), 1\right) \cdot t\_1\right) \cdot \sqrt{d}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 3.60000000000000018e-161

    1. Initial program 68.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\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(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}}\right) \]
      2. lift-/.f64N/A

        \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
      3. clear-numN/A

        \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{1}{\frac{\ell}{h}}}\right) \]
      4. un-div-invN/A

        \[\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{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\frac{\ell}{h}}}\right) \]
      5. lift-*.f64N/A

        \[\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{\color{blue}{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
      6. *-commutativeN/A

        \[\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{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}}}{\frac{\ell}{h}}\right) \]
      7. lift-pow.f64N/A

        \[\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{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}} \cdot \frac{1}{2}}{\frac{\ell}{h}}\right) \]
      8. unpow2N/A

        \[\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{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \cdot \frac{1}{2}}{\frac{\ell}{h}}\right) \]
      9. associate-*l*N/A

        \[\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{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}\right)}}{\frac{\ell}{h}}\right) \]
      10. div-invN/A

        \[\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{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}\right)}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
      11. times-fracN/A

        \[\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{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}}{\frac{1}{h}}}\right) \]
      12. lower-*.f64N/A

        \[\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{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}}{\frac{1}{h}}}\right) \]
    4. Applied rewrites70.2%

      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \frac{\left(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{{h}^{-1}}}\right) \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\frac{\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}}{{h}^{-1}}}\right) \]
      2. div-invN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\left(\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}\right) \cdot \frac{1}{{h}^{-1}}\right)}\right) \]
      3. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\color{blue}{\left(\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}\right)} \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      4. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\color{blue}{\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right)} \cdot \frac{M}{d}\right) \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      5. associate-*l*N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\color{blue}{\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right)} \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      6. lift-pow.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \frac{1}{\color{blue}{{h}^{-1}}}\right)\right) \]
      7. unpow-1N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \frac{1}{\color{blue}{\frac{1}{h}}}\right)\right) \]
      8. remove-double-divN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \color{blue}{h}\right)\right) \]
      9. associate-*l*N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)}\right) \]
      10. lower-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)}\right) \]
      11. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\color{blue}{\left(D \cdot \frac{1}{2}\right)} \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      12. metadata-evalN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \color{blue}{\frac{1}{2}}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      13. div-invN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\color{blue}{\frac{D}{2}} \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      14. lift-/.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\frac{D}{2} \cdot \color{blue}{\frac{M}{d}}\right) \cdot h\right)\right)\right) \]
      15. times-fracN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\color{blue}{\frac{D \cdot M}{2 \cdot d}} \cdot h\right)\right)\right) \]
      16. *-commutativeN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\frac{\color{blue}{M \cdot D}}{2 \cdot d} \cdot h\right)\right)\right) \]
      17. lower-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot h\right)}\right)\right) \]
    6. Applied rewrites72.2%

      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \color{blue}{\left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)}\right) \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      3. lift-pow.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      4. pow1/2N/A

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

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

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
    9. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      3. lift-pow.f64N/A

        \[\leadsto \left(\color{blue}{{\left(\frac{d}{h}\right)}^{\frac{1}{2}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      4. unpow1/2N/A

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      5. lower-sqrt.f6472.2

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

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

    if 3.60000000000000018e-161 < l

    1. Initial program 67.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. Add Preprocessing
    3. Applied rewrites74.9%

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

      \[\leadsto \frac{\left(\color{blue}{\mathsf{fma}\left(\frac{\left(\frac{D}{d} \cdot M\right) \cdot -0.5}{\ell}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\right), 1\right)} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 73.3% accurate, 3.1× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := \frac{D}{d} \cdot M\\ t_1 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;\ell \leq 4.8 \cdot 10^{-164}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t\_1\right) \cdot \left(1 - \frac{t\_0 \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{t\_0 \cdot -0.5}{\ell} \cdot \left(\frac{M}{d} \cdot \left(0.25 \cdot D\right)\right), h, 1\right) \cdot t\_1\right) \cdot \sqrt{d}}{\sqrt{h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (* (/ D d) M)) (t_1 (sqrt (/ d l))))
   (if (<= l 4.8e-164)
     (*
      (* (sqrt (/ d h)) t_1)
      (- 1.0 (* (/ (* t_0 0.5) l) (* 0.5 (* (* (* 0.5 (/ D d)) M) h)))))
     (/
      (*
       (* (fma (* (/ (* t_0 -0.5) l) (* (/ M d) (* 0.25 D))) h 1.0) t_1)
       (sqrt d))
      (sqrt h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double t_0 = (D / d) * M;
	double t_1 = sqrt((d / l));
	double tmp;
	if (l <= 4.8e-164) {
		tmp = (sqrt((d / h)) * t_1) * (1.0 - (((t_0 * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))));
	} else {
		tmp = ((fma((((t_0 * -0.5) / l) * ((M / d) * (0.25 * D))), h, 1.0) * t_1) * sqrt(d)) / sqrt(h);
	}
	return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	t_0 = Float64(Float64(D / d) * M)
	t_1 = sqrt(Float64(d / l))
	tmp = 0.0
	if (l <= 4.8e-164)
		tmp = Float64(Float64(sqrt(Float64(d / h)) * t_1) * Float64(1.0 - Float64(Float64(Float64(t_0 * 0.5) / l) * Float64(0.5 * Float64(Float64(Float64(0.5 * Float64(D / d)) * M) * h)))));
	else
		tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(t_0 * -0.5) / l) * Float64(Float64(M / d) * Float64(0.25 * D))), h, 1.0) * t_1) * sqrt(d)) / sqrt(h));
	end
	return tmp
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 4.8e-164], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] * N[(1.0 - N[(N[(N[(t$95$0 * 0.5), $MachinePrecision] / l), $MachinePrecision] * N[(0.5 * N[(N[(N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(t$95$0 * -0.5), $MachinePrecision] / l), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(0.25 * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{D}{d} \cdot M\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq 4.8 \cdot 10^{-164}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t\_1\right) \cdot \left(1 - \frac{t\_0 \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{t\_0 \cdot -0.5}{\ell} \cdot \left(\frac{M}{d} \cdot \left(0.25 \cdot D\right)\right), h, 1\right) \cdot t\_1\right) \cdot \sqrt{d}}{\sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 4.79999999999999966e-164

    1. Initial program 68.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\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(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}}\right) \]
      2. lift-/.f64N/A

        \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
      3. clear-numN/A

        \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{1}{\frac{\ell}{h}}}\right) \]
      4. un-div-invN/A

        \[\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{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\frac{\ell}{h}}}\right) \]
      5. lift-*.f64N/A

        \[\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{\color{blue}{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
      6. *-commutativeN/A

        \[\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{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}}}{\frac{\ell}{h}}\right) \]
      7. lift-pow.f64N/A

        \[\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{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}} \cdot \frac{1}{2}}{\frac{\ell}{h}}\right) \]
      8. unpow2N/A

        \[\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{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \cdot \frac{1}{2}}{\frac{\ell}{h}}\right) \]
      9. associate-*l*N/A

        \[\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{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}\right)}}{\frac{\ell}{h}}\right) \]
      10. div-invN/A

        \[\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{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}\right)}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
      11. times-fracN/A

        \[\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{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}}{\frac{1}{h}}}\right) \]
      12. lower-*.f64N/A

        \[\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{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}}{\frac{1}{h}}}\right) \]
    4. Applied rewrites70.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{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \frac{\left(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{{h}^{-1}}}\right) \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\frac{\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}}{{h}^{-1}}}\right) \]
      2. div-invN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\left(\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}\right) \cdot \frac{1}{{h}^{-1}}\right)}\right) \]
      3. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\color{blue}{\left(\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}\right)} \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      4. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\color{blue}{\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right)} \cdot \frac{M}{d}\right) \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      5. associate-*l*N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\color{blue}{\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right)} \cdot \frac{1}{{h}^{-1}}\right)\right) \]
      6. lift-pow.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \frac{1}{\color{blue}{{h}^{-1}}}\right)\right) \]
      7. unpow-1N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \frac{1}{\color{blue}{\frac{1}{h}}}\right)\right) \]
      8. remove-double-divN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \color{blue}{h}\right)\right) \]
      9. associate-*l*N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)}\right) \]
      10. lower-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)}\right) \]
      11. lift-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\color{blue}{\left(D \cdot \frac{1}{2}\right)} \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      12. metadata-evalN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \color{blue}{\frac{1}{2}}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      13. div-invN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\color{blue}{\frac{D}{2}} \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
      14. lift-/.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\frac{D}{2} \cdot \color{blue}{\frac{M}{d}}\right) \cdot h\right)\right)\right) \]
      15. times-fracN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\color{blue}{\frac{D \cdot M}{2 \cdot d}} \cdot h\right)\right)\right) \]
      16. *-commutativeN/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\frac{\color{blue}{M \cdot D}}{2 \cdot d} \cdot h\right)\right)\right) \]
      17. lower-*.f64N/A

        \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot h\right)}\right)\right) \]
    6. Applied rewrites72.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 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \color{blue}{\left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)}\right) \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      2. metadata-eval72.0

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      3. lift-pow.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      4. pow1/2N/A

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

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

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
    9. Step-by-step derivation
      1. lift-/.f64N/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      3. lift-pow.f64N/A

        \[\leadsto \left(\color{blue}{{\left(\frac{d}{h}\right)}^{\frac{1}{2}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      4. unpow1/2N/A

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
      5. lower-sqrt.f6472.0

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
    10. Applied rewrites72.0%

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

    if 4.79999999999999966e-164 < l

    1. Initial program 67.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. Add Preprocessing
    3. Applied rewrites75.2%

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

      \[\leadsto \frac{\left(\color{blue}{\mathsf{fma}\left(\frac{\left(\frac{D}{d} \cdot M\right) \cdot -0.5}{\ell} \cdot \left(\frac{M}{d} \cdot \left(0.25 \cdot D\right)\right), h, 1\right)} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{d}}{\sqrt{h}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 51.6% accurate, 3.2× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -6.6 \cdot 10^{-164}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \frac{\left(-\ell\right) \cdot \ell}{\ell}}}\\ \mathbf{elif}\;\ell \leq 2.15 \cdot 10^{+77}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d}, \left(h \cdot \frac{M \cdot M}{d}\right) \cdot \left(D \cdot D\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -6.6e-164)
   (* (- d) (sqrt (pow (* l h) -1.0)))
   (if (<= l -5e-310)
     (/ d (sqrt (* h (/ (* (- l) l) l))))
     (if (<= l 2.15e+77)
       (*
        (/ d (sqrt (* l h)))
        (fma (/ -0.125 (* l d)) (* (* h (/ (* M M) d)) (* D D)) 1.0))
       (/ d (* (sqrt l) (sqrt h)))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -6.6e-164) {
		tmp = -d * sqrt(pow((l * h), -1.0));
	} else if (l <= -5e-310) {
		tmp = d / sqrt((h * ((-l * l) / l)));
	} else if (l <= 2.15e+77) {
		tmp = (d / sqrt((l * h))) * fma((-0.125 / (l * d)), ((h * ((M * M) / d)) * (D * D)), 1.0);
	} else {
		tmp = d / (sqrt(l) * sqrt(h));
	}
	return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -6.6e-164)
		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
	elseif (l <= -5e-310)
		tmp = Float64(d / sqrt(Float64(h * Float64(Float64(Float64(-l) * l) / l))));
	elseif (l <= 2.15e+77)
		tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(Float64(-0.125 / Float64(l * d)), Float64(Float64(h * Float64(Float64(M * M) / d)) * Float64(D * D)), 1.0));
	else
		tmp = Float64(d / Float64(sqrt(l) * sqrt(h)));
	end
	return tmp
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -6.6e-164], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d / N[Sqrt[N[(h * N[(N[((-l) * l), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.15e+77], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(N[(M * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.6 \cdot 10^{-164}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\

\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \frac{\left(-\ell\right) \cdot \ell}{\ell}}}\\

\mathbf{elif}\;\ell \leq 2.15 \cdot 10^{+77}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d}, \left(h \cdot \frac{M \cdot M}{d}\right) \cdot \left(D \cdot D\right), 1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -6.6e-164

    1. Initial program 71.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. Add Preprocessing
    3. Taylor expanded in l around -inf

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      2. unpow2N/A

        \[\leadsto \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      3. rem-square-sqrtN/A

        \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      5. mul-1-negN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      6. lower-neg.f64N/A

        \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
      7. lower-sqrt.f64N/A

        \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
      8. lower-/.f64N/A

        \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
      9. *-commutativeN/A

        \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
      10. lower-*.f6444.6

        \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
    5. Applied rewrites44.6%

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

    if -6.6e-164 < l < -4.999999999999985e-310

    1. Initial program 66.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. Add Preprocessing
    3. Taylor expanded in d around inf

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
      3. lower-sqrt.f64N/A

        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
      4. lower-/.f64N/A

        \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
      5. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
      6. lower-*.f6422.0

        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
    5. Applied rewrites22.0%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    6. Step-by-step derivation
      1. Applied rewrites22.0%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
      2. Step-by-step derivation
        1. Applied rewrites8.6%

          \[\leadsto \frac{d}{\color{blue}{\sqrt{h \cdot \left(-\ell\right)}}} \]
        2. Step-by-step derivation
          1. Applied rewrites66.2%

            \[\leadsto \frac{d}{\sqrt{h \cdot \frac{0 - \ell \cdot \ell}{0 + \ell}}} \]

          if -4.999999999999985e-310 < l < 2.14999999999999996e77

          1. Initial program 70.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. Add Preprocessing
          3. Taylor expanded in d around 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 \color{blue}{\frac{{d}^{2} - \frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}{{d}^{2}}} \]
          4. Applied rewrites53.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 \color{blue}{\mathsf{fma}\left(\left(\frac{\frac{M \cdot M}{d}}{d} \cdot h\right) \cdot -0.125, \frac{D \cdot D}{\ell}, 1\right)} \]
          5. Applied rewrites68.0%

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

            \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \color{blue}{\frac{{d}^{2} - \frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}{{d}^{2}}} \]
          7. Step-by-step derivation
            1. div-subN/A

              \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \color{blue}{\left(\frac{{d}^{2}}{{d}^{2}} - \frac{\frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}{{d}^{2}}\right)} \]
            2. *-inversesN/A

              \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(\color{blue}{1} - \frac{\frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}{{d}^{2}}\right) \]
            3. associate-/l*N/A

              \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \color{blue}{\frac{1}{8} \cdot \frac{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}{{d}^{2}}}\right) \]
            4. associate-/r*N/A

              \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{1}{8} \cdot \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}}\right) \]
            5. *-commutativeN/A

              \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{{d}^{2} \cdot \ell}}\right) \]
            6. cancel-sign-sub-invN/A

              \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \color{blue}{\left(1 + \left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)} \]
            7. metadata-evalN/A

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

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

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

          if 2.14999999999999996e77 < l

          1. Initial program 59.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. Add Preprocessing
          3. Taylor expanded in d around inf

            \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
            2. lower-*.f64N/A

              \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
            3. lower-sqrt.f64N/A

              \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
            4. lower-/.f64N/A

              \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
            5. *-commutativeN/A

              \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
            6. lower-*.f6447.7

              \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
          5. Applied rewrites47.7%

            \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
          6. Step-by-step derivation
            1. Applied rewrites47.8%

              \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
            2. Step-by-step derivation
              1. Applied rewrites57.7%

                \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
            3. Recombined 4 regimes into one program.
            4. Final simplification49.2%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -6.6 \cdot 10^{-164}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \frac{\left(-\ell\right) \cdot \ell}{\ell}}}\\ \mathbf{elif}\;\ell \leq 2.15 \cdot 10^{+77}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d}, \left(h \cdot \frac{M \cdot M}{d}\right) \cdot \left(D \cdot D\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
            5. Add Preprocessing

            Alternative 8: 44.8% accurate, 3.2× speedup?

            \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -6.6 \cdot 10^{-164}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \frac{\left(-\ell\right) \cdot \ell}{\ell}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \end{array} \]
            NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
            (FPCore (d h l M D)
             :precision binary64
             (if (<= l -6.6e-164)
               (* (- d) (sqrt (pow (* l h) -1.0)))
               (if (<= l -5e-310)
                 (/ d (sqrt (* h (/ (* (- l) l) l))))
                 (/ d (* (sqrt l) (sqrt h))))))
            assert(d < h && h < l && l < M && M < D);
            double code(double d, double h, double l, double M, double D) {
            	double tmp;
            	if (l <= -6.6e-164) {
            		tmp = -d * sqrt(pow((l * h), -1.0));
            	} else if (l <= -5e-310) {
            		tmp = d / sqrt((h * ((-l * l) / l)));
            	} else {
            		tmp = d / (sqrt(l) * sqrt(h));
            	}
            	return tmp;
            }
            
            NOTE: d, h, l, M, and D should be sorted in increasing order before calling this 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) :: tmp
                if (l <= (-6.6d-164)) then
                    tmp = -d * sqrt(((l * h) ** (-1.0d0)))
                else if (l <= (-5d-310)) then
                    tmp = d / sqrt((h * ((-l * l) / l)))
                else
                    tmp = d / (sqrt(l) * sqrt(h))
                end if
                code = tmp
            end function
            
            assert d < h && h < l && l < M && M < D;
            public static double code(double d, double h, double l, double M, double D) {
            	double tmp;
            	if (l <= -6.6e-164) {
            		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
            	} else if (l <= -5e-310) {
            		tmp = d / Math.sqrt((h * ((-l * l) / l)));
            	} else {
            		tmp = d / (Math.sqrt(l) * Math.sqrt(h));
            	}
            	return tmp;
            }
            
            [d, h, l, M, D] = sort([d, h, l, M, D])
            def code(d, h, l, M, D):
            	tmp = 0
            	if l <= -6.6e-164:
            		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
            	elif l <= -5e-310:
            		tmp = d / math.sqrt((h * ((-l * l) / l)))
            	else:
            		tmp = d / (math.sqrt(l) * math.sqrt(h))
            	return tmp
            
            d, h, l, M, D = sort([d, h, l, M, D])
            function code(d, h, l, M, D)
            	tmp = 0.0
            	if (l <= -6.6e-164)
            		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
            	elseif (l <= -5e-310)
            		tmp = Float64(d / sqrt(Float64(h * Float64(Float64(Float64(-l) * l) / l))));
            	else
            		tmp = Float64(d / Float64(sqrt(l) * sqrt(h)));
            	end
            	return tmp
            end
            
            d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
            function tmp_2 = code(d, h, l, M, D)
            	tmp = 0.0;
            	if (l <= -6.6e-164)
            		tmp = -d * sqrt(((l * h) ^ -1.0));
            	elseif (l <= -5e-310)
            		tmp = d / sqrt((h * ((-l * l) / l)));
            	else
            		tmp = d / (sqrt(l) * sqrt(h));
            	end
            	tmp_2 = tmp;
            end
            
            NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
            code[d_, h_, l_, M_, D_] := If[LessEqual[l, -6.6e-164], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d / N[Sqrt[N[(h * N[(N[((-l) * l), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
            
            \begin{array}{l}
            [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
            \\
            \begin{array}{l}
            \mathbf{if}\;\ell \leq -6.6 \cdot 10^{-164}:\\
            \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
            
            \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
            \;\;\;\;\frac{d}{\sqrt{h \cdot \frac{\left(-\ell\right) \cdot \ell}{\ell}}}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if l < -6.6e-164

              1. Initial program 71.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. Add Preprocessing
              3. Taylor expanded in l around -inf

                \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
              4. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                2. unpow2N/A

                  \[\leadsto \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                3. rem-square-sqrtN/A

                  \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                4. lower-*.f64N/A

                  \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                5. mul-1-negN/A

                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                6. lower-neg.f64N/A

                  \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                7. lower-sqrt.f64N/A

                  \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                8. lower-/.f64N/A

                  \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                9. *-commutativeN/A

                  \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
                10. lower-*.f6444.6

                  \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
              5. Applied rewrites44.6%

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

              if -6.6e-164 < l < -4.999999999999985e-310

              1. Initial program 66.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. Add Preprocessing
              3. Taylor expanded in d around inf

                \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
              4. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                2. lower-*.f64N/A

                  \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                3. lower-sqrt.f64N/A

                  \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                4. lower-/.f64N/A

                  \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                5. *-commutativeN/A

                  \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                6. lower-*.f6422.0

                  \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
              5. Applied rewrites22.0%

                \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
              6. Step-by-step derivation
                1. Applied rewrites22.0%

                  \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                2. Step-by-step derivation
                  1. Applied rewrites8.6%

                    \[\leadsto \frac{d}{\color{blue}{\sqrt{h \cdot \left(-\ell\right)}}} \]
                  2. Step-by-step derivation
                    1. Applied rewrites66.2%

                      \[\leadsto \frac{d}{\sqrt{h \cdot \frac{0 - \ell \cdot \ell}{0 + \ell}}} \]

                    if -4.999999999999985e-310 < l

                    1. Initial program 66.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. Add Preprocessing
                    3. Taylor expanded in d around inf

                      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                    4. Step-by-step derivation
                      1. *-commutativeN/A

                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                      2. lower-*.f64N/A

                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                      3. lower-sqrt.f64N/A

                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                      4. lower-/.f64N/A

                        \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                      5. *-commutativeN/A

                        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                      6. lower-*.f6444.0

                        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                    5. Applied rewrites44.0%

                      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                    6. Step-by-step derivation
                      1. Applied rewrites45.1%

                        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                      2. Step-by-step derivation
                        1. Applied rewrites51.2%

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

                        \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -6.6 \cdot 10^{-164}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \frac{\left(-\ell\right) \cdot \ell}{\ell}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
                      5. Add Preprocessing

                      Alternative 9: 45.9% accurate, 3.2× speedup?

                      \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -3.4 \cdot 10^{-136}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{elif}\;d \leq 9.8 \cdot 10^{-287}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \end{array} \]
                      NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
                      (FPCore (d h l M D)
                       :precision binary64
                       (if (<= d -3.4e-136)
                         (* (- d) (sqrt (pow (* l h) -1.0)))
                         (if (<= d 9.8e-287)
                           (/ (* (- d) (sqrt (/ h l))) h)
                           (/ d (* (sqrt l) (sqrt h))))))
                      assert(d < h && h < l && l < M && M < D);
                      double code(double d, double h, double l, double M, double D) {
                      	double tmp;
                      	if (d <= -3.4e-136) {
                      		tmp = -d * sqrt(pow((l * h), -1.0));
                      	} else if (d <= 9.8e-287) {
                      		tmp = (-d * sqrt((h / l))) / h;
                      	} else {
                      		tmp = d / (sqrt(l) * sqrt(h));
                      	}
                      	return tmp;
                      }
                      
                      NOTE: d, h, l, M, and D should be sorted in increasing order before calling this 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) :: tmp
                          if (d <= (-3.4d-136)) then
                              tmp = -d * sqrt(((l * h) ** (-1.0d0)))
                          else if (d <= 9.8d-287) then
                              tmp = (-d * sqrt((h / l))) / h
                          else
                              tmp = d / (sqrt(l) * sqrt(h))
                          end if
                          code = tmp
                      end function
                      
                      assert d < h && h < l && l < M && M < D;
                      public static double code(double d, double h, double l, double M, double D) {
                      	double tmp;
                      	if (d <= -3.4e-136) {
                      		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
                      	} else if (d <= 9.8e-287) {
                      		tmp = (-d * Math.sqrt((h / l))) / h;
                      	} else {
                      		tmp = d / (Math.sqrt(l) * Math.sqrt(h));
                      	}
                      	return tmp;
                      }
                      
                      [d, h, l, M, D] = sort([d, h, l, M, D])
                      def code(d, h, l, M, D):
                      	tmp = 0
                      	if d <= -3.4e-136:
                      		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
                      	elif d <= 9.8e-287:
                      		tmp = (-d * math.sqrt((h / l))) / h
                      	else:
                      		tmp = d / (math.sqrt(l) * math.sqrt(h))
                      	return tmp
                      
                      d, h, l, M, D = sort([d, h, l, M, D])
                      function code(d, h, l, M, D)
                      	tmp = 0.0
                      	if (d <= -3.4e-136)
                      		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
                      	elseif (d <= 9.8e-287)
                      		tmp = Float64(Float64(Float64(-d) * sqrt(Float64(h / l))) / h);
                      	else
                      		tmp = Float64(d / Float64(sqrt(l) * sqrt(h)));
                      	end
                      	return tmp
                      end
                      
                      d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
                      function tmp_2 = code(d, h, l, M, D)
                      	tmp = 0.0;
                      	if (d <= -3.4e-136)
                      		tmp = -d * sqrt(((l * h) ^ -1.0));
                      	elseif (d <= 9.8e-287)
                      		tmp = (-d * sqrt((h / l))) / h;
                      	else
                      		tmp = d / (sqrt(l) * sqrt(h));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
                      code[d_, h_, l_, M_, D_] := If[LessEqual[d, -3.4e-136], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.8e-287], N[(N[((-d) * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;d \leq -3.4 \cdot 10^{-136}:\\
                      \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                      
                      \mathbf{elif}\;d \leq 9.8 \cdot 10^{-287}:\\
                      \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if d < -3.4e-136

                        1. Initial program 77.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. Add Preprocessing
                        3. Taylor expanded in l around -inf

                          \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                        4. Step-by-step derivation
                          1. *-commutativeN/A

                            \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          2. unpow2N/A

                            \[\leadsto \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          3. rem-square-sqrtN/A

                            \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          4. lower-*.f64N/A

                            \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                          5. mul-1-negN/A

                            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          6. lower-neg.f64N/A

                            \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          7. lower-sqrt.f64N/A

                            \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                          8. lower-/.f64N/A

                            \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                          9. *-commutativeN/A

                            \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
                          10. lower-*.f6449.3

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

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

                        if -3.4e-136 < d < 9.8000000000000002e-287

                        1. Initial program 47.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. Add Preprocessing
                        3. Taylor expanded in h around 0

                          \[\leadsto \color{blue}{\frac{\frac{-1}{8} \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{{h}^{3}}{{\ell}^{3}}}\right) + d \cdot \sqrt{\frac{h}{\ell}}}{h}} \]
                        4. Step-by-step derivation
                          1. lower-/.f64N/A

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

                          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\left(\left(M \cdot M\right) \cdot -0.125\right) \cdot \frac{D \cdot D}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}} \]
                        6. Taylor expanded in l around -inf

                          \[\leadsto \frac{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                        7. Step-by-step derivation
                          1. Applied rewrites27.6%

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

                          if 9.8000000000000002e-287 < d

                          1. Initial program 68.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. Add Preprocessing
                          3. Taylor expanded in d around inf

                            \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                          4. Step-by-step derivation
                            1. *-commutativeN/A

                              \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                            2. lower-*.f64N/A

                              \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                            3. lower-sqrt.f64N/A

                              \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                            4. lower-/.f64N/A

                              \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                            5. *-commutativeN/A

                              \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                            6. lower-*.f6444.9

                              \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                          5. Applied rewrites44.9%

                            \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                          6. Step-by-step derivation
                            1. Applied rewrites46.1%

                              \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                            2. Step-by-step derivation
                              1. Applied rewrites52.5%

                                \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
                            3. Recombined 3 regimes into one program.
                            4. Final simplification47.2%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -3.4 \cdot 10^{-136}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{elif}\;d \leq 9.8 \cdot 10^{-287}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
                            5. Add Preprocessing

                            Alternative 10: 46.5% accurate, 3.2× speedup?

                            \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq 2.8 \cdot 10^{-305}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \end{array} \]
                            NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
                            (FPCore (d h l M D)
                             :precision binary64
                             (if (<= d 2.8e-305)
                               (* (- d) (sqrt (pow (* l h) -1.0)))
                               (/ d (* (sqrt l) (sqrt h)))))
                            assert(d < h && h < l && l < M && M < D);
                            double code(double d, double h, double l, double M, double D) {
                            	double tmp;
                            	if (d <= 2.8e-305) {
                            		tmp = -d * sqrt(pow((l * h), -1.0));
                            	} else {
                            		tmp = d / (sqrt(l) * sqrt(h));
                            	}
                            	return tmp;
                            }
                            
                            NOTE: d, h, l, M, and D should be sorted in increasing order before calling this 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) :: tmp
                                if (d <= 2.8d-305) then
                                    tmp = -d * sqrt(((l * h) ** (-1.0d0)))
                                else
                                    tmp = d / (sqrt(l) * sqrt(h))
                                end if
                                code = tmp
                            end function
                            
                            assert d < h && h < l && l < M && M < D;
                            public static double code(double d, double h, double l, double M, double D) {
                            	double tmp;
                            	if (d <= 2.8e-305) {
                            		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
                            	} else {
                            		tmp = d / (Math.sqrt(l) * Math.sqrt(h));
                            	}
                            	return tmp;
                            }
                            
                            [d, h, l, M, D] = sort([d, h, l, M, D])
                            def code(d, h, l, M, D):
                            	tmp = 0
                            	if d <= 2.8e-305:
                            		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
                            	else:
                            		tmp = d / (math.sqrt(l) * math.sqrt(h))
                            	return tmp
                            
                            d, h, l, M, D = sort([d, h, l, M, D])
                            function code(d, h, l, M, D)
                            	tmp = 0.0
                            	if (d <= 2.8e-305)
                            		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
                            	else
                            		tmp = Float64(d / Float64(sqrt(l) * sqrt(h)));
                            	end
                            	return tmp
                            end
                            
                            d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
                            function tmp_2 = code(d, h, l, M, D)
                            	tmp = 0.0;
                            	if (d <= 2.8e-305)
                            		tmp = -d * sqrt(((l * h) ^ -1.0));
                            	else
                            		tmp = d / (sqrt(l) * sqrt(h));
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
                            code[d_, h_, l_, M_, D_] := If[LessEqual[d, 2.8e-305], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                            
                            \begin{array}{l}
                            [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
                            \\
                            \begin{array}{l}
                            \mathbf{if}\;d \leq 2.8 \cdot 10^{-305}:\\
                            \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if d < 2.80000000000000014e-305

                              1. Initial program 70.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. Add Preprocessing
                              3. Taylor expanded in l around -inf

                                \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                              4. Step-by-step derivation
                                1. *-commutativeN/A

                                  \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                2. unpow2N/A

                                  \[\leadsto \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                3. rem-square-sqrtN/A

                                  \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                4. lower-*.f64N/A

                                  \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                5. mul-1-negN/A

                                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                6. lower-neg.f64N/A

                                  \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                7. lower-sqrt.f64N/A

                                  \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                                8. lower-/.f64N/A

                                  \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                                9. *-commutativeN/A

                                  \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
                                10. lower-*.f6440.0

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

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

                              if 2.80000000000000014e-305 < d

                              1. Initial program 66.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. Add Preprocessing
                              3. Taylor expanded in d around inf

                                \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                              4. Step-by-step derivation
                                1. *-commutativeN/A

                                  \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                2. lower-*.f64N/A

                                  \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                3. lower-sqrt.f64N/A

                                  \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                                4. lower-/.f64N/A

                                  \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                                5. *-commutativeN/A

                                  \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                6. lower-*.f6444.3

                                  \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                              5. Applied rewrites44.3%

                                \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                              6. Step-by-step derivation
                                1. Applied rewrites45.5%

                                  \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                                2. Step-by-step derivation
                                  1. Applied rewrites51.6%

                                    \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
                                3. Recombined 2 regimes into one program.
                                4. Final simplification45.6%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 2.8 \cdot 10^{-305}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
                                5. Add Preprocessing

                                Alternative 11: 42.7% accurate, 3.2× speedup?

                                \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -2.1 \cdot 10^{-262}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
                                NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
                                (FPCore (d h l M D)
                                 :precision binary64
                                 (if (<= l -2.1e-262)
                                   (* (- d) (sqrt (pow (* l h) -1.0)))
                                   (/ d (sqrt (* l h)))))
                                assert(d < h && h < l && l < M && M < D);
                                double code(double d, double h, double l, double M, double D) {
                                	double tmp;
                                	if (l <= -2.1e-262) {
                                		tmp = -d * sqrt(pow((l * h), -1.0));
                                	} else {
                                		tmp = d / sqrt((l * h));
                                	}
                                	return tmp;
                                }
                                
                                NOTE: d, h, l, M, and D should be sorted in increasing order before calling this 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) :: tmp
                                    if (l <= (-2.1d-262)) then
                                        tmp = -d * sqrt(((l * h) ** (-1.0d0)))
                                    else
                                        tmp = d / sqrt((l * h))
                                    end if
                                    code = tmp
                                end function
                                
                                assert d < h && h < l && l < M && M < D;
                                public static double code(double d, double h, double l, double M, double D) {
                                	double tmp;
                                	if (l <= -2.1e-262) {
                                		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
                                	} else {
                                		tmp = d / Math.sqrt((l * h));
                                	}
                                	return tmp;
                                }
                                
                                [d, h, l, M, D] = sort([d, h, l, M, D])
                                def code(d, h, l, M, D):
                                	tmp = 0
                                	if l <= -2.1e-262:
                                		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
                                	else:
                                		tmp = d / math.sqrt((l * h))
                                	return tmp
                                
                                d, h, l, M, D = sort([d, h, l, M, D])
                                function code(d, h, l, M, D)
                                	tmp = 0.0
                                	if (l <= -2.1e-262)
                                		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
                                	else
                                		tmp = Float64(d / sqrt(Float64(l * h)));
                                	end
                                	return tmp
                                end
                                
                                d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
                                function tmp_2 = code(d, h, l, M, D)
                                	tmp = 0.0;
                                	if (l <= -2.1e-262)
                                		tmp = -d * sqrt(((l * h) ^ -1.0));
                                	else
                                		tmp = d / sqrt((l * h));
                                	end
                                	tmp_2 = tmp;
                                end
                                
                                NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
                                code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.1e-262], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
                                
                                \begin{array}{l}
                                [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
                                \\
                                \begin{array}{l}
                                \mathbf{if}\;\ell \leq -2.1 \cdot 10^{-262}:\\
                                \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if l < -2.1e-262

                                  1. Initial program 69.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. Add Preprocessing
                                  3. Taylor expanded in l around -inf

                                    \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                  4. Step-by-step derivation
                                    1. *-commutativeN/A

                                      \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                    2. unpow2N/A

                                      \[\leadsto \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                    3. rem-square-sqrtN/A

                                      \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                    4. lower-*.f64N/A

                                      \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                    5. mul-1-negN/A

                                      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                    6. lower-neg.f64N/A

                                      \[\leadsto \color{blue}{\left(-d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                    7. lower-sqrt.f64N/A

                                      \[\leadsto \left(-d\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                                    8. lower-/.f64N/A

                                      \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                                    9. *-commutativeN/A

                                      \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
                                    10. lower-*.f6442.0

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

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

                                  if -2.1e-262 < l

                                  1. Initial program 67.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. Add Preprocessing
                                  3. Taylor expanded in d around inf

                                    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                  4. Step-by-step derivation
                                    1. *-commutativeN/A

                                      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                    2. lower-*.f64N/A

                                      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                    3. lower-sqrt.f64N/A

                                      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                                    4. lower-/.f64N/A

                                      \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                                    5. *-commutativeN/A

                                      \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                    6. lower-*.f6443.9

                                      \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                  5. Applied rewrites43.9%

                                    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                  6. Step-by-step derivation
                                    1. Applied rewrites45.0%

                                      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                                  7. Recombined 2 regimes into one program.
                                  8. Final simplification43.6%

                                    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -2.1 \cdot 10^{-262}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \]
                                  9. Add Preprocessing

                                  Alternative 12: 69.9% accurate, 3.3× speedup?

                                  \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \end{array} \]
                                  NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
                                  (FPCore (d h l M D)
                                   :precision binary64
                                   (*
                                    (* (sqrt (/ d h)) (sqrt (/ d l)))
                                    (- 1.0 (* (/ (* (* (/ D d) M) 0.5) l) (* 0.5 (* (* (* 0.5 (/ D d)) M) h))))))
                                  assert(d < h && h < l && l < M && M < D);
                                  double code(double d, double h, double l, double M, double D) {
                                  	return (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (((((D / d) * M) * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))));
                                  }
                                  
                                  NOTE: d, h, l, M, and D should be sorted in increasing order before calling this 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
                                      code = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (((((d_1 / d) * m) * 0.5d0) / l) * (0.5d0 * (((0.5d0 * (d_1 / d)) * m) * h))))
                                  end function
                                  
                                  assert d < h && h < l && l < M && M < D;
                                  public static double code(double d, double h, double l, double M, double D) {
                                  	return (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (((((D / d) * M) * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))));
                                  }
                                  
                                  [d, h, l, M, D] = sort([d, h, l, M, D])
                                  def code(d, h, l, M, D):
                                  	return (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (((((D / d) * M) * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))))
                                  
                                  d, h, l, M, D = sort([d, h, l, M, D])
                                  function code(d, h, l, M, D)
                                  	return Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D / d) * M) * 0.5) / l) * Float64(0.5 * Float64(Float64(Float64(0.5 * Float64(D / d)) * M) * h)))))
                                  end
                                  
                                  d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
                                  function tmp = code(d, h, l, M, D)
                                  	tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (((((D / d) * M) * 0.5) / l) * (0.5 * (((0.5 * (D / d)) * M) * h))));
                                  end
                                  
                                  NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
                                  code[d_, h_, l_, M_, D_] := N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision] * 0.5), $MachinePrecision] / l), $MachinePrecision] * N[(0.5 * N[(N[(N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                  
                                  \begin{array}{l}
                                  [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
                                  \\
                                  \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right)
                                  \end{array}
                                  
                                  Derivation
                                  1. Initial program 68.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. Add Preprocessing
                                  3. Step-by-step derivation
                                    1. lift-*.f64N/A

                                      \[\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(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}}\right) \]
                                    2. lift-/.f64N/A

                                      \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
                                    3. clear-numN/A

                                      \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{1}{\frac{\ell}{h}}}\right) \]
                                    4. un-div-invN/A

                                      \[\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{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\frac{\ell}{h}}}\right) \]
                                    5. lift-*.f64N/A

                                      \[\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{\color{blue}{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
                                    6. *-commutativeN/A

                                      \[\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{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}}}{\frac{\ell}{h}}\right) \]
                                    7. lift-pow.f64N/A

                                      \[\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{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}} \cdot \frac{1}{2}}{\frac{\ell}{h}}\right) \]
                                    8. unpow2N/A

                                      \[\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{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \cdot \frac{1}{2}}{\frac{\ell}{h}}\right) \]
                                    9. associate-*l*N/A

                                      \[\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{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}\right)}}{\frac{\ell}{h}}\right) \]
                                    10. div-invN/A

                                      \[\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{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}\right)}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
                                    11. times-fracN/A

                                      \[\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{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}}{\frac{1}{h}}}\right) \]
                                    12. lower-*.f64N/A

                                      \[\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{\frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{1}{2}}{\frac{1}{h}}}\right) \]
                                  4. Applied rewrites70.4%

                                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \frac{\left(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{{h}^{-1}}}\right) \]
                                  5. Step-by-step derivation
                                    1. lift-/.f64N/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\frac{\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}}{{h}^{-1}}}\right) \]
                                    2. div-invN/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\left(\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}\right) \cdot \frac{1}{{h}^{-1}}\right)}\right) \]
                                    3. lift-*.f64N/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\color{blue}{\left(\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right) \cdot \frac{M}{d}\right)} \cdot \frac{1}{{h}^{-1}}\right)\right) \]
                                    4. lift-*.f64N/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\color{blue}{\left(\frac{1}{2} \cdot \left(D \cdot \frac{1}{2}\right)\right)} \cdot \frac{M}{d}\right) \cdot \frac{1}{{h}^{-1}}\right)\right) \]
                                    5. associate-*l*N/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\color{blue}{\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right)} \cdot \frac{1}{{h}^{-1}}\right)\right) \]
                                    6. lift-pow.f64N/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \frac{1}{\color{blue}{{h}^{-1}}}\right)\right) \]
                                    7. unpow-1N/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \frac{1}{\color{blue}{\frac{1}{h}}}\right)\right) \]
                                    8. remove-double-divN/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\left(\frac{1}{2} \cdot \left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right)\right) \cdot \color{blue}{h}\right)\right) \]
                                    9. associate-*l*N/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)}\right) \]
                                    10. lower-*.f64N/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \color{blue}{\left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \frac{1}{2}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)}\right) \]
                                    11. lift-*.f64N/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\color{blue}{\left(D \cdot \frac{1}{2}\right)} \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
                                    12. metadata-evalN/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(D \cdot \color{blue}{\frac{1}{2}}\right) \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
                                    13. div-invN/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\color{blue}{\frac{D}{2}} \cdot \frac{M}{d}\right) \cdot h\right)\right)\right) \]
                                    14. lift-/.f64N/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\frac{D}{2} \cdot \color{blue}{\frac{M}{d}}\right) \cdot h\right)\right)\right) \]
                                    15. times-fracN/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\color{blue}{\frac{D \cdot M}{2 \cdot d}} \cdot h\right)\right)\right) \]
                                    16. *-commutativeN/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\frac{\color{blue}{M \cdot D}}{2 \cdot d} \cdot h\right)\right)\right) \]
                                    17. lower-*.f64N/A

                                      \[\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{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot h\right)}\right)\right) \]
                                  6. Applied rewrites72.3%

                                    \[\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{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \color{blue}{\left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)}\right) \]
                                  7. Step-by-step derivation
                                    1. lift-/.f64N/A

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

                                      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{0.5}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
                                    3. lift-pow.f64N/A

                                      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
                                    4. pow1/2N/A

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

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

                                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
                                  9. Step-by-step derivation
                                    1. lift-/.f64N/A

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

                                      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{0.5}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
                                    3. lift-pow.f64N/A

                                      \[\leadsto \left(\color{blue}{{\left(\frac{d}{h}\right)}^{\frac{1}{2}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
                                    4. unpow1/2N/A

                                      \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot \frac{1}{2}}{\ell} \cdot \left(\frac{1}{2} \cdot \left(\left(\left(\frac{1}{2} \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
                                    5. lower-sqrt.f6472.3

                                      \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
                                  10. Applied rewrites72.3%

                                    \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(0.5 \cdot \left(\left(\left(0.5 \cdot \frac{D}{d}\right) \cdot M\right) \cdot h\right)\right)\right) \]
                                  11. Add Preprocessing

                                  Alternative 13: 43.1% accurate, 3.5× speedup?

                                  \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{\ell}}\\ \mathbf{if}\;M \leq 1.85 \cdot 10^{-125}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(\left(M \cdot M\right) \cdot -0.125\right) \cdot \frac{D \cdot D}{d}, \frac{h}{\ell} \cdot t\_0, t\_0 \cdot d\right)}{h}\\ \end{array} \end{array} \]
                                  NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
                                  (FPCore (d h l M D)
                                   :precision binary64
                                   (let* ((t_0 (sqrt (/ h l))))
                                     (if (<= M 1.85e-125)
                                       (/ (sqrt (/ d h)) (sqrt (/ l d)))
                                       (/
                                        (fma (* (* (* M M) -0.125) (/ (* D D) d)) (* (/ h l) t_0) (* t_0 d))
                                        h))))
                                  assert(d < h && h < l && l < M && M < D);
                                  double code(double d, double h, double l, double M, double D) {
                                  	double t_0 = sqrt((h / l));
                                  	double tmp;
                                  	if (M <= 1.85e-125) {
                                  		tmp = sqrt((d / h)) / sqrt((l / d));
                                  	} else {
                                  		tmp = fma((((M * M) * -0.125) * ((D * D) / d)), ((h / l) * t_0), (t_0 * d)) / h;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  d, h, l, M, D = sort([d, h, l, M, D])
                                  function code(d, h, l, M, D)
                                  	t_0 = sqrt(Float64(h / l))
                                  	tmp = 0.0
                                  	if (M <= 1.85e-125)
                                  		tmp = Float64(sqrt(Float64(d / h)) / sqrt(Float64(l / d)));
                                  	else
                                  		tmp = Float64(fma(Float64(Float64(Float64(M * M) * -0.125) * Float64(Float64(D * D) / d)), Float64(Float64(h / l) * t_0), Float64(t_0 * d)) / h);
                                  	end
                                  	return tmp
                                  end
                                  
                                  NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
                                  code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, 1.85e-125], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(M * M), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(t$95$0 * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]
                                  
                                  \begin{array}{l}
                                  [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
                                  \\
                                  \begin{array}{l}
                                  t_0 := \sqrt{\frac{h}{\ell}}\\
                                  \mathbf{if}\;M \leq 1.85 \cdot 10^{-125}:\\
                                  \;\;\;\;\frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}}\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\frac{\mathsf{fma}\left(\left(\left(M \cdot M\right) \cdot -0.125\right) \cdot \frac{D \cdot D}{d}, \frac{h}{\ell} \cdot t\_0, t\_0 \cdot d\right)}{h}\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if M < 1.85e-125

                                    1. Initial program 71.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. Add Preprocessing
                                    3. Taylor expanded in d around inf

                                      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                    4. Step-by-step derivation
                                      1. *-commutativeN/A

                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                      2. lower-*.f64N/A

                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                      3. lower-sqrt.f64N/A

                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                                      4. lower-/.f64N/A

                                        \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                                      5. *-commutativeN/A

                                        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                      6. lower-*.f6431.9

                                        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                    5. Applied rewrites31.9%

                                      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                    6. Step-by-step derivation
                                      1. Applied rewrites46.2%

                                        \[\leadsto \frac{\sqrt{\frac{d}{h}}}{\color{blue}{\sqrt{\frac{\ell}{d}}}} \]

                                      if 1.85e-125 < M

                                      1. Initial program 62.7%

                                        \[\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. Add Preprocessing
                                      3. Taylor expanded in h around 0

                                        \[\leadsto \color{blue}{\frac{\frac{-1}{8} \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{{h}^{3}}{{\ell}^{3}}}\right) + d \cdot \sqrt{\frac{h}{\ell}}}{h}} \]
                                      4. Step-by-step derivation
                                        1. lower-/.f64N/A

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

                                        \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\left(\left(M \cdot M\right) \cdot -0.125\right) \cdot \frac{D \cdot D}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}} \]
                                      6. Step-by-step derivation
                                        1. Applied rewrites52.8%

                                          \[\leadsto \frac{\mathsf{fma}\left(\left(\left(M \cdot M\right) \cdot -0.125\right) \cdot \frac{D \cdot D}{d}, \frac{h}{\ell} \cdot \sqrt{\frac{h}{\ell}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h} \]
                                      7. Recombined 2 regimes into one program.
                                      8. Add Preprocessing

                                      Alternative 14: 26.0% accurate, 15.3× speedup?

                                      \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \frac{d}{\sqrt{\ell \cdot h}} \end{array} \]
                                      NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
                                      (FPCore (d h l M D) :precision binary64 (/ d (sqrt (* l h))))
                                      assert(d < h && h < l && l < M && M < D);
                                      double code(double d, double h, double l, double M, double D) {
                                      	return d / sqrt((l * h));
                                      }
                                      
                                      NOTE: d, h, l, M, and D should be sorted in increasing order before calling this 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
                                          code = d / sqrt((l * h))
                                      end function
                                      
                                      assert d < h && h < l && l < M && M < D;
                                      public static double code(double d, double h, double l, double M, double D) {
                                      	return d / Math.sqrt((l * h));
                                      }
                                      
                                      [d, h, l, M, D] = sort([d, h, l, M, D])
                                      def code(d, h, l, M, D):
                                      	return d / math.sqrt((l * h))
                                      
                                      d, h, l, M, D = sort([d, h, l, M, D])
                                      function code(d, h, l, M, D)
                                      	return Float64(d / sqrt(Float64(l * h)))
                                      end
                                      
                                      d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
                                      function tmp = code(d, h, l, M, D)
                                      	tmp = d / sqrt((l * h));
                                      end
                                      
                                      NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
                                      code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
                                      
                                      \begin{array}{l}
                                      [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
                                      \\
                                      \frac{d}{\sqrt{\ell \cdot h}}
                                      \end{array}
                                      
                                      Derivation
                                      1. Initial program 68.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. Add Preprocessing
                                      3. Taylor expanded in d around inf

                                        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                      4. Step-by-step derivation
                                        1. *-commutativeN/A

                                          \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                        2. lower-*.f64N/A

                                          \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                        3. lower-sqrt.f64N/A

                                          \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                                        4. lower-/.f64N/A

                                          \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                                        5. *-commutativeN/A

                                          \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                        6. lower-*.f6427.2

                                          \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                      5. Applied rewrites27.2%

                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                      6. Step-by-step derivation
                                        1. Applied rewrites27.8%

                                          \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                                        2. Add Preprocessing

                                        Reproduce

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