Henrywood and Agarwal, Equation (12)

Percentage Accurate: 65.8% → 80.3%
Time: 21.5s
Alternatives: 29
Speedup: 2.9×

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 29 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: 65.8% 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: 80.3% accurate, 1.5× speedup?

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

\mathbf{elif}\;d \leq 8 \cdot 10^{-289}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_0, d \cdot t\_0\right)}{h}\\

\mathbf{else}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(\sqrt{\frac{1}{\ell}} \cdot \sqrt{d}\right)\right) \cdot \left(1 + t\_1 \cdot \frac{\frac{M\_m \cdot D\_m}{d \cdot 2}}{\frac{-1}{h}}\right)\\


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

    1. Initial program 73.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. 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{\frac{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
      7. 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{\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}}{\frac{\ell}{h}}\right) \]
      8. associate-*r*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}{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}\right) \]
      9. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
      10. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
      11. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
    4. Applied rewrites80.1%

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

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
      4. unpow1/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{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
      5. lower-sqrt.f6480.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.20000000000000005e-193 < d < 8.0000000000000001e-289

    1. Initial program 31.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 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 rewrites17.7%

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

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

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

        if 8.0000000000000001e-289 < d

        1. Initial program 70.8%

          \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        2. 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. 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{\frac{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
          7. 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{\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}}{\frac{\ell}{h}}\right) \]
          8. associate-*r*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}{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}\right) \]
          9. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
          10. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
          11. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
        4. Applied rewrites79.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{\frac{M \cdot \left(D \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}}\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)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
          2. lift-pow.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\left(\sqrt{\frac{1}{\ell}} \cdot \sqrt{d}\right)}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
      3. Recombined 3 regimes into one program.
      4. Final simplification84.9%

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

      Alternative 2: 49.6% accurate, 0.2× speedup?

      \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{\ell}}\\ t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\ t_2 := \frac{d \cdot t\_0}{h}\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-180}:\\ \;\;\;\;\frac{\left(-d\right) \cdot t\_0}{h}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-158}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
      D_m = (fabs.f64 D)
      M_m = (fabs.f64 M)
      NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
      (FPCore (d h l M_m D_m)
       :precision binary64
       (let* ((t_0 (sqrt (/ h l)))
              (t_1
               (*
                (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                (+
                 1.0
                 (* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0))))))
              (t_2 (/ (* d t_0) h)))
         (if (<= t_1 -2e-180)
           (/ (* (- d) t_0) h)
           (if (<= t_1 2e-158)
             t_2
             (if (<= t_1 2e+136)
               (sqrt (* (/ d l) (/ d h)))
               (if (<= t_1 INFINITY) t_2 (* (- d) (sqrt (/ 1.0 (* h l))))))))))
      D_m = fabs(D);
      M_m = fabs(M);
      assert(d < h && h < l && l < M_m && M_m < D_m);
      double code(double d, double h, double l, double M_m, double D_m) {
      	double t_0 = sqrt((h / l));
      	double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
      	double t_2 = (d * t_0) / h;
      	double tmp;
      	if (t_1 <= -2e-180) {
      		tmp = (-d * t_0) / h;
      	} else if (t_1 <= 2e-158) {
      		tmp = t_2;
      	} else if (t_1 <= 2e+136) {
      		tmp = sqrt(((d / l) * (d / h)));
      	} else if (t_1 <= ((double) INFINITY)) {
      		tmp = t_2;
      	} else {
      		tmp = -d * sqrt((1.0 / (h * l)));
      	}
      	return tmp;
      }
      
      D_m = Math.abs(D);
      M_m = Math.abs(M);
      assert d < h && h < l && l < M_m && M_m < D_m;
      public static double code(double d, double h, double l, double M_m, double D_m) {
      	double t_0 = Math.sqrt((h / l));
      	double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
      	double t_2 = (d * t_0) / h;
      	double tmp;
      	if (t_1 <= -2e-180) {
      		tmp = (-d * t_0) / h;
      	} else if (t_1 <= 2e-158) {
      		tmp = t_2;
      	} else if (t_1 <= 2e+136) {
      		tmp = Math.sqrt(((d / l) * (d / h)));
      	} else if (t_1 <= Double.POSITIVE_INFINITY) {
      		tmp = t_2;
      	} else {
      		tmp = -d * Math.sqrt((1.0 / (h * l)));
      	}
      	return tmp;
      }
      
      D_m = math.fabs(D)
      M_m = math.fabs(M)
      [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
      def code(d, h, l, M_m, D_m):
      	t_0 = math.sqrt((h / l))
      	t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))))
      	t_2 = (d * t_0) / h
      	tmp = 0
      	if t_1 <= -2e-180:
      		tmp = (-d * t_0) / h
      	elif t_1 <= 2e-158:
      		tmp = t_2
      	elif t_1 <= 2e+136:
      		tmp = math.sqrt(((d / l) * (d / h)))
      	elif t_1 <= math.inf:
      		tmp = t_2
      	else:
      		tmp = -d * math.sqrt((1.0 / (h * l)))
      	return tmp
      
      D_m = abs(D)
      M_m = abs(M)
      d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
      function code(d, h, l, M_m, D_m)
      	t_0 = sqrt(Float64(h / l))
      	t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0)))))
      	t_2 = Float64(Float64(d * t_0) / h)
      	tmp = 0.0
      	if (t_1 <= -2e-180)
      		tmp = Float64(Float64(Float64(-d) * t_0) / h);
      	elseif (t_1 <= 2e-158)
      		tmp = t_2;
      	elseif (t_1 <= 2e+136)
      		tmp = sqrt(Float64(Float64(d / l) * Float64(d / h)));
      	elseif (t_1 <= Inf)
      		tmp = t_2;
      	else
      		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
      	end
      	return tmp
      end
      
      D_m = abs(D);
      M_m = abs(M);
      d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
      function tmp_2 = code(d, h, l, M_m, D_m)
      	t_0 = sqrt((h / l));
      	t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
      	t_2 = (d * t_0) / h;
      	tmp = 0.0;
      	if (t_1 <= -2e-180)
      		tmp = (-d * t_0) / h;
      	elseif (t_1 <= 2e-158)
      		tmp = t_2;
      	elseif (t_1 <= 2e+136)
      		tmp = sqrt(((d / l) * (d / h)));
      	elseif (t_1 <= Inf)
      		tmp = t_2;
      	else
      		tmp = -d * sqrt((1.0 / (h * l)));
      	end
      	tmp_2 = tmp;
      end
      
      D_m = N[Abs[D], $MachinePrecision]
      M_m = N[Abs[M], $MachinePrecision]
      NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
      code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * t$95$0), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-180], N[(N[((-d) * t$95$0), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$1, 2e-158], t$95$2, If[LessEqual[t$95$1, 2e+136], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]
      
      \begin{array}{l}
      D_m = \left|D\right|
      \\
      M_m = \left|M\right|
      \\
      [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
      \\
      \begin{array}{l}
      t_0 := \sqrt{\frac{h}{\ell}}\\
      t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
      t_2 := \frac{d \cdot t\_0}{h}\\
      \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-180}:\\
      \;\;\;\;\frac{\left(-d\right) \cdot t\_0}{h}\\
      
      \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-158}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+136}:\\
      \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
      
      \mathbf{elif}\;t\_1 \leq \infty:\\
      \;\;\;\;t\_2\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180

        1. Initial program 86.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 rewrites28.3%

          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(d, \sqrt{\frac{h}{\ell}}, \left(D \cdot \frac{D \cdot \left(M \cdot M\right)}{d}\right) \cdot \left(-0.125 \cdot \sqrt{\frac{h \cdot \left(h \cdot h\right)}{\ell \cdot \left(\ell \cdot \ell\right)}}\right)\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 rewrites22.4%

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

          if -2e-180 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000013e-158 or 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

          1. Initial program 63.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 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 rewrites26.3%

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

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

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

            if 2.00000000000000013e-158 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136

            1. Initial program 99.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. lower-*.f64N/A

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

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

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

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

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

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

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

                if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                1. Initial program 0.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 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. *-commutativeN/A

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

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

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

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

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

                    \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                  10. lower-neg.f6416.9

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

                  \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
              3. Recombined 4 regimes into one program.
              4. Final simplification49.6%

                \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq -2 \cdot 10^{-180}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq 2 \cdot 10^{-158}:\\ \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq \infty:\\ \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 3: 64.4% accurate, 0.3× speedup?

              \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \sqrt{\frac{h}{\ell}}\\ t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\ \mathbf{if}\;t\_3 \leq -2 \cdot 10^{-180}:\\ \;\;\;\;t\_0 \cdot \left(t\_1 \cdot \mathsf{fma}\left(\frac{M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right)\right)\\ \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+136}:\\ \;\;\;\;t\_1 \cdot t\_0\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;\frac{d \cdot t\_2}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(d, t\_2, \left(D\_m \cdot \frac{D\_m \cdot \left(M\_m \cdot M\_m\right)}{d}\right) \cdot \left(-0.125 \cdot \frac{h \cdot t\_2}{\ell}\right)\right)}{h}\\ \end{array} \end{array} \]
              D_m = (fabs.f64 D)
              M_m = (fabs.f64 M)
              NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
              (FPCore (d h l M_m D_m)
               :precision binary64
               (let* ((t_0 (sqrt (/ d h)))
                      (t_1 (sqrt (/ d l)))
                      (t_2 (sqrt (/ h l)))
                      (t_3
                       (*
                        (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                        (+
                         1.0
                         (* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
                 (if (<= t_3 -2e-180)
                   (*
                    t_0
                    (*
                     t_1
                     (fma
                      (/ (* M_m (* D_m (* M_m D_m))) (* 4.0 (* d d)))
                      (* (/ h l) -0.5)
                      1.0)))
                   (if (<= t_3 2e+136)
                     (* t_1 t_0)
                     (if (<= t_3 INFINITY)
                       (/ (* d t_2) h)
                       (/
                        (fma
                         d
                         t_2
                         (* (* D_m (/ (* D_m (* M_m M_m)) d)) (* -0.125 (/ (* h t_2) l))))
                        h))))))
              D_m = fabs(D);
              M_m = fabs(M);
              assert(d < h && h < l && l < M_m && M_m < D_m);
              double code(double d, double h, double l, double M_m, double D_m) {
              	double t_0 = sqrt((d / h));
              	double t_1 = sqrt((d / l));
              	double t_2 = sqrt((h / l));
              	double t_3 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
              	double tmp;
              	if (t_3 <= -2e-180) {
              		tmp = t_0 * (t_1 * fma(((M_m * (D_m * (M_m * D_m))) / (4.0 * (d * d))), ((h / l) * -0.5), 1.0));
              	} else if (t_3 <= 2e+136) {
              		tmp = t_1 * t_0;
              	} else if (t_3 <= ((double) INFINITY)) {
              		tmp = (d * t_2) / h;
              	} else {
              		tmp = fma(d, t_2, ((D_m * ((D_m * (M_m * M_m)) / d)) * (-0.125 * ((h * t_2) / l)))) / h;
              	}
              	return tmp;
              }
              
              D_m = abs(D)
              M_m = abs(M)
              d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
              function code(d, h, l, M_m, D_m)
              	t_0 = sqrt(Float64(d / h))
              	t_1 = sqrt(Float64(d / l))
              	t_2 = sqrt(Float64(h / l))
              	t_3 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0)))))
              	tmp = 0.0
              	if (t_3 <= -2e-180)
              		tmp = Float64(t_0 * Float64(t_1 * fma(Float64(Float64(M_m * Float64(D_m * Float64(M_m * D_m))) / Float64(4.0 * Float64(d * d))), Float64(Float64(h / l) * -0.5), 1.0)));
              	elseif (t_3 <= 2e+136)
              		tmp = Float64(t_1 * t_0);
              	elseif (t_3 <= Inf)
              		tmp = Float64(Float64(d * t_2) / h);
              	else
              		tmp = Float64(fma(d, t_2, Float64(Float64(D_m * Float64(Float64(D_m * Float64(M_m * M_m)) / d)) * Float64(-0.125 * Float64(Float64(h * t_2) / l)))) / h);
              	end
              	return tmp
              end
              
              D_m = N[Abs[D], $MachinePrecision]
              M_m = N[Abs[M], $MachinePrecision]
              NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
              code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e-180], N[(t$95$0 * N[(t$95$1 * N[(N[(N[(M$95$m * N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e+136], N[(t$95$1 * t$95$0), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[(d * t$95$2), $MachinePrecision] / h), $MachinePrecision], N[(N[(d * t$95$2 + N[(N[(D$95$m * N[(N[(D$95$m * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(-0.125 * N[(N[(h * t$95$2), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]]]]]]
              
              \begin{array}{l}
              D_m = \left|D\right|
              \\
              M_m = \left|M\right|
              \\
              [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
              \\
              \begin{array}{l}
              t_0 := \sqrt{\frac{d}{h}}\\
              t_1 := \sqrt{\frac{d}{\ell}}\\
              t_2 := \sqrt{\frac{h}{\ell}}\\
              t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
              \mathbf{if}\;t\_3 \leq -2 \cdot 10^{-180}:\\
              \;\;\;\;t\_0 \cdot \left(t\_1 \cdot \mathsf{fma}\left(\frac{M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right)\right)\\
              
              \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+136}:\\
              \;\;\;\;t\_1 \cdot t\_0\\
              
              \mathbf{elif}\;t\_3 \leq \infty:\\
              \;\;\;\;\frac{d \cdot t\_2}{h}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{\mathsf{fma}\left(d, t\_2, \left(D\_m \cdot \frac{D\_m \cdot \left(M\_m \cdot M\_m\right)}{d}\right) \cdot \left(-0.125 \cdot \frac{h \cdot t\_2}{\ell}\right)\right)}{h}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 4 regimes
              2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180

                1. Initial program 86.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 rewrites66.6%

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

                if -2e-180 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136

                1. Initial program 90.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 d around inf

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

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

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

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

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

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

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

                  if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

                  1. Initial program 64.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 rewrites30.8%

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

                    \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                  7. Step-by-step derivation
                    1. Applied rewrites80.8%

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

                    if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                    1. Initial program 0.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 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 rewrites10.7%

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

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq -2 \cdot 10^{-180}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{M \cdot \left(D \cdot \left(M \cdot D\right)\right)}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right)\right)\\ \mathbf{elif}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq \infty:\\ \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(d, \sqrt{\frac{h}{\ell}}, \left(D \cdot \frac{D \cdot \left(M \cdot M\right)}{d}\right) \cdot \left(-0.125 \cdot \frac{h \cdot \sqrt{\frac{h}{\ell}}}{\ell}\right)\right)}{h}\\ \end{array} \]
                    9. Add Preprocessing

                    Alternative 4: 62.8% accurate, 0.3× speedup?

                    \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{-180}:\\ \;\;\;\;t\_0 \cdot \left(t\_1 \cdot \mathsf{fma}\left(\frac{M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right)\right)\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+136}:\\ \;\;\;\;t\_1 \cdot t\_0\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
                    D_m = (fabs.f64 D)
                    M_m = (fabs.f64 M)
                    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                    (FPCore (d h l M_m D_m)
                     :precision binary64
                     (let* ((t_0 (sqrt (/ d h)))
                            (t_1 (sqrt (/ d l)))
                            (t_2
                             (*
                              (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                              (+
                               1.0
                               (* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
                       (if (<= t_2 -2e-180)
                         (*
                          t_0
                          (*
                           t_1
                           (fma
                            (/ (* M_m (* D_m (* M_m D_m))) (* 4.0 (* d d)))
                            (* (/ h l) -0.5)
                            1.0)))
                         (if (<= t_2 2e+136)
                           (* t_1 t_0)
                           (if (<= t_2 INFINITY)
                             (/ (* d (sqrt (/ h l))) h)
                             (* (- d) (sqrt (/ 1.0 (* h l)))))))))
                    D_m = fabs(D);
                    M_m = fabs(M);
                    assert(d < h && h < l && l < M_m && M_m < D_m);
                    double code(double d, double h, double l, double M_m, double D_m) {
                    	double t_0 = sqrt((d / h));
                    	double t_1 = sqrt((d / l));
                    	double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                    	double tmp;
                    	if (t_2 <= -2e-180) {
                    		tmp = t_0 * (t_1 * fma(((M_m * (D_m * (M_m * D_m))) / (4.0 * (d * d))), ((h / l) * -0.5), 1.0));
                    	} else if (t_2 <= 2e+136) {
                    		tmp = t_1 * t_0;
                    	} else if (t_2 <= ((double) INFINITY)) {
                    		tmp = (d * sqrt((h / l))) / h;
                    	} else {
                    		tmp = -d * sqrt((1.0 / (h * l)));
                    	}
                    	return tmp;
                    }
                    
                    D_m = abs(D)
                    M_m = abs(M)
                    d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                    function code(d, h, l, M_m, D_m)
                    	t_0 = sqrt(Float64(d / h))
                    	t_1 = sqrt(Float64(d / l))
                    	t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0)))))
                    	tmp = 0.0
                    	if (t_2 <= -2e-180)
                    		tmp = Float64(t_0 * Float64(t_1 * fma(Float64(Float64(M_m * Float64(D_m * Float64(M_m * D_m))) / Float64(4.0 * Float64(d * d))), Float64(Float64(h / l) * -0.5), 1.0)));
                    	elseif (t_2 <= 2e+136)
                    		tmp = Float64(t_1 * t_0);
                    	elseif (t_2 <= Inf)
                    		tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h);
                    	else
                    		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                    	end
                    	return tmp
                    end
                    
                    D_m = N[Abs[D], $MachinePrecision]
                    M_m = N[Abs[M], $MachinePrecision]
                    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                    code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-180], N[(t$95$0 * N[(t$95$1 * N[(N[(N[(M$95$m * N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+136], N[(t$95$1 * t$95$0), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
                    
                    \begin{array}{l}
                    D_m = \left|D\right|
                    \\
                    M_m = \left|M\right|
                    \\
                    [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                    \\
                    \begin{array}{l}
                    t_0 := \sqrt{\frac{d}{h}}\\
                    t_1 := \sqrt{\frac{d}{\ell}}\\
                    t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
                    \mathbf{if}\;t\_2 \leq -2 \cdot 10^{-180}:\\
                    \;\;\;\;t\_0 \cdot \left(t\_1 \cdot \mathsf{fma}\left(\frac{M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right)\right)\\
                    
                    \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+136}:\\
                    \;\;\;\;t\_1 \cdot t\_0\\
                    
                    \mathbf{elif}\;t\_2 \leq \infty:\\
                    \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 4 regimes
                    2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180

                      1. Initial program 86.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 rewrites66.6%

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

                      if -2e-180 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136

                      1. Initial program 90.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 d around inf

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

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

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

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

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

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

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

                        if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

                        1. Initial program 64.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 rewrites30.8%

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

                          \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                        7. Step-by-step derivation
                          1. Applied rewrites80.8%

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

                          if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                          1. Initial program 0.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 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. *-commutativeN/A

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

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

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

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

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

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                            10. lower-neg.f6416.9

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

                            \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
                        8. Recombined 4 regimes into one program.
                        9. Final simplification65.8%

                          \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq -2 \cdot 10^{-180}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{M \cdot \left(D \cdot \left(M \cdot D\right)\right)}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right)\right)\\ \mathbf{elif}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq \infty:\\ \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \]
                        10. Add Preprocessing

                        Alternative 5: 62.9% accurate, 0.3× speedup?

                        \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \sqrt{\frac{d}{h}}\\ t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{-180}:\\ \;\;\;\;t\_0 \cdot \left(t\_1 \cdot \mathsf{fma}\left(\frac{M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right)\right)\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+136}:\\ \;\;\;\;t\_0 \cdot t\_1\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
                        D_m = (fabs.f64 D)
                        M_m = (fabs.f64 M)
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        (FPCore (d h l M_m D_m)
                         :precision binary64
                         (let* ((t_0 (sqrt (/ d l)))
                                (t_1 (sqrt (/ d h)))
                                (t_2
                                 (*
                                  (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                                  (+
                                   1.0
                                   (* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
                           (if (<= t_2 -2e-180)
                             (*
                              t_0
                              (*
                               t_1
                               (fma
                                (/ (* M_m (* D_m (* M_m D_m))) (* 4.0 (* d d)))
                                (* (/ h l) -0.5)
                                1.0)))
                             (if (<= t_2 2e+136)
                               (* t_0 t_1)
                               (if (<= t_2 INFINITY)
                                 (/ (* d (sqrt (/ h l))) h)
                                 (* (- d) (sqrt (/ 1.0 (* h l)))))))))
                        D_m = fabs(D);
                        M_m = fabs(M);
                        assert(d < h && h < l && l < M_m && M_m < D_m);
                        double code(double d, double h, double l, double M_m, double D_m) {
                        	double t_0 = sqrt((d / l));
                        	double t_1 = sqrt((d / h));
                        	double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                        	double tmp;
                        	if (t_2 <= -2e-180) {
                        		tmp = t_0 * (t_1 * fma(((M_m * (D_m * (M_m * D_m))) / (4.0 * (d * d))), ((h / l) * -0.5), 1.0));
                        	} else if (t_2 <= 2e+136) {
                        		tmp = t_0 * t_1;
                        	} else if (t_2 <= ((double) INFINITY)) {
                        		tmp = (d * sqrt((h / l))) / h;
                        	} else {
                        		tmp = -d * sqrt((1.0 / (h * l)));
                        	}
                        	return tmp;
                        }
                        
                        D_m = abs(D)
                        M_m = abs(M)
                        d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                        function code(d, h, l, M_m, D_m)
                        	t_0 = sqrt(Float64(d / l))
                        	t_1 = sqrt(Float64(d / h))
                        	t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0)))))
                        	tmp = 0.0
                        	if (t_2 <= -2e-180)
                        		tmp = Float64(t_0 * Float64(t_1 * fma(Float64(Float64(M_m * Float64(D_m * Float64(M_m * D_m))) / Float64(4.0 * Float64(d * d))), Float64(Float64(h / l) * -0.5), 1.0)));
                        	elseif (t_2 <= 2e+136)
                        		tmp = Float64(t_0 * t_1);
                        	elseif (t_2 <= Inf)
                        		tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h);
                        	else
                        		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                        	end
                        	return tmp
                        end
                        
                        D_m = N[Abs[D], $MachinePrecision]
                        M_m = N[Abs[M], $MachinePrecision]
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-180], N[(t$95$0 * N[(t$95$1 * N[(N[(N[(M$95$m * N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+136], N[(t$95$0 * t$95$1), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
                        
                        \begin{array}{l}
                        D_m = \left|D\right|
                        \\
                        M_m = \left|M\right|
                        \\
                        [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                        \\
                        \begin{array}{l}
                        t_0 := \sqrt{\frac{d}{\ell}}\\
                        t_1 := \sqrt{\frac{d}{h}}\\
                        t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
                        \mathbf{if}\;t\_2 \leq -2 \cdot 10^{-180}:\\
                        \;\;\;\;t\_0 \cdot \left(t\_1 \cdot \mathsf{fma}\left(\frac{M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right)\right)\\
                        
                        \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+136}:\\
                        \;\;\;\;t\_0 \cdot t\_1\\
                        
                        \mathbf{elif}\;t\_2 \leq \infty:\\
                        \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 4 regimes
                        2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180

                          1. Initial program 86.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 rewrites66.6%

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

                          if -2e-180 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136

                          1. Initial program 90.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 d around inf

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

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

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

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

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

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

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

                            if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

                            1. Initial program 64.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 rewrites30.8%

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

                              \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                            7. Step-by-step derivation
                              1. Applied rewrites80.8%

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

                              if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                              1. Initial program 0.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 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. *-commutativeN/A

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

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

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

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

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

                                  \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                                10. lower-neg.f6416.9

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

                                \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
                            8. Recombined 4 regimes into one program.
                            9. Final simplification65.7%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq -2 \cdot 10^{-180}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left(\frac{M \cdot \left(D \cdot \left(M \cdot D\right)\right)}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right)\right)\\ \mathbf{elif}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq \infty:\\ \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \]
                            10. Add Preprocessing

                            Alternative 6: 60.1% accurate, 0.3× speedup?

                            \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-99}:\\ \;\;\;\;\frac{t\_0 \cdot \frac{\left(D\_m \cdot D\_m\right) \cdot \left(-0.125 \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)}}{\sqrt{\frac{\ell}{d}}}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot t\_0\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
                            D_m = (fabs.f64 D)
                            M_m = (fabs.f64 M)
                            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                            (FPCore (d h l M_m D_m)
                             :precision binary64
                             (let* ((t_0 (sqrt (/ d h)))
                                    (t_1
                                     (*
                                      (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                                      (+
                                       1.0
                                       (* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
                               (if (<= t_1 -2e-99)
                                 (/
                                  (* t_0 (/ (* (* D_m D_m) (* -0.125 (* h (* M_m M_m)))) (* d (* d l))))
                                  (sqrt (/ l d)))
                                 (if (<= t_1 2e+136)
                                   (* (sqrt (/ d l)) t_0)
                                   (if (<= t_1 INFINITY)
                                     (/ (* d (sqrt (/ h l))) h)
                                     (* (- d) (sqrt (/ 1.0 (* h l)))))))))
                            D_m = fabs(D);
                            M_m = fabs(M);
                            assert(d < h && h < l && l < M_m && M_m < D_m);
                            double code(double d, double h, double l, double M_m, double D_m) {
                            	double t_0 = sqrt((d / h));
                            	double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                            	double tmp;
                            	if (t_1 <= -2e-99) {
                            		tmp = (t_0 * (((D_m * D_m) * (-0.125 * (h * (M_m * M_m)))) / (d * (d * l)))) / sqrt((l / d));
                            	} else if (t_1 <= 2e+136) {
                            		tmp = sqrt((d / l)) * t_0;
                            	} else if (t_1 <= ((double) INFINITY)) {
                            		tmp = (d * sqrt((h / l))) / h;
                            	} else {
                            		tmp = -d * sqrt((1.0 / (h * l)));
                            	}
                            	return tmp;
                            }
                            
                            D_m = Math.abs(D);
                            M_m = Math.abs(M);
                            assert d < h && h < l && l < M_m && M_m < D_m;
                            public static double code(double d, double h, double l, double M_m, double D_m) {
                            	double t_0 = Math.sqrt((d / h));
                            	double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                            	double tmp;
                            	if (t_1 <= -2e-99) {
                            		tmp = (t_0 * (((D_m * D_m) * (-0.125 * (h * (M_m * M_m)))) / (d * (d * l)))) / Math.sqrt((l / d));
                            	} else if (t_1 <= 2e+136) {
                            		tmp = Math.sqrt((d / l)) * t_0;
                            	} else if (t_1 <= Double.POSITIVE_INFINITY) {
                            		tmp = (d * Math.sqrt((h / l))) / h;
                            	} else {
                            		tmp = -d * Math.sqrt((1.0 / (h * l)));
                            	}
                            	return tmp;
                            }
                            
                            D_m = math.fabs(D)
                            M_m = math.fabs(M)
                            [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                            def code(d, h, l, M_m, D_m):
                            	t_0 = math.sqrt((d / h))
                            	t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))))
                            	tmp = 0
                            	if t_1 <= -2e-99:
                            		tmp = (t_0 * (((D_m * D_m) * (-0.125 * (h * (M_m * M_m)))) / (d * (d * l)))) / math.sqrt((l / d))
                            	elif t_1 <= 2e+136:
                            		tmp = math.sqrt((d / l)) * t_0
                            	elif t_1 <= math.inf:
                            		tmp = (d * math.sqrt((h / l))) / h
                            	else:
                            		tmp = -d * math.sqrt((1.0 / (h * l)))
                            	return tmp
                            
                            D_m = abs(D)
                            M_m = abs(M)
                            d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                            function code(d, h, l, M_m, D_m)
                            	t_0 = sqrt(Float64(d / h))
                            	t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0)))))
                            	tmp = 0.0
                            	if (t_1 <= -2e-99)
                            		tmp = Float64(Float64(t_0 * Float64(Float64(Float64(D_m * D_m) * Float64(-0.125 * Float64(h * Float64(M_m * M_m)))) / Float64(d * Float64(d * l)))) / sqrt(Float64(l / d)));
                            	elseif (t_1 <= 2e+136)
                            		tmp = Float64(sqrt(Float64(d / l)) * t_0);
                            	elseif (t_1 <= Inf)
                            		tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h);
                            	else
                            		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                            	end
                            	return tmp
                            end
                            
                            D_m = abs(D);
                            M_m = abs(M);
                            d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                            function tmp_2 = code(d, h, l, M_m, D_m)
                            	t_0 = sqrt((d / h));
                            	t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
                            	tmp = 0.0;
                            	if (t_1 <= -2e-99)
                            		tmp = (t_0 * (((D_m * D_m) * (-0.125 * (h * (M_m * M_m)))) / (d * (d * l)))) / sqrt((l / d));
                            	elseif (t_1 <= 2e+136)
                            		tmp = sqrt((d / l)) * t_0;
                            	elseif (t_1 <= Inf)
                            		tmp = (d * sqrt((h / l))) / h;
                            	else
                            		tmp = -d * sqrt((1.0 / (h * l)));
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            D_m = N[Abs[D], $MachinePrecision]
                            M_m = N[Abs[M], $MachinePrecision]
                            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                            code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-99], N[(N[(t$95$0 * N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(-0.125 * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+136], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
                            
                            \begin{array}{l}
                            D_m = \left|D\right|
                            \\
                            M_m = \left|M\right|
                            \\
                            [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                            \\
                            \begin{array}{l}
                            t_0 := \sqrt{\frac{d}{h}}\\
                            t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
                            \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-99}:\\
                            \;\;\;\;\frac{t\_0 \cdot \frac{\left(D\_m \cdot D\_m\right) \cdot \left(-0.125 \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)}}{\sqrt{\frac{\ell}{d}}}\\
                            
                            \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+136}:\\
                            \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot t\_0\\
                            
                            \mathbf{elif}\;t\_1 \leq \infty:\\
                            \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 4 regimes
                            2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-99

                              1. Initial program 86.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. Applied rewrites66.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \frac{\sqrt{\frac{d}{h}} \cdot \frac{\left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \frac{-1}{8}\right) \cdot \left(D \cdot D\right)}{\color{blue}{d \cdot \left(d \cdot \ell\right)}}}{\sqrt{\frac{\ell}{d}}} \]
                                17. lower-*.f6457.4

                                  \[\leadsto \frac{\sqrt{\frac{d}{h}} \cdot \frac{\left(\left(h \cdot \left(M \cdot M\right)\right) \cdot -0.125\right) \cdot \left(D \cdot D\right)}{d \cdot \color{blue}{\left(d \cdot \ell\right)}}}{\sqrt{\frac{\ell}{d}}} \]
                              6. Applied rewrites57.4%

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

                              if -2e-99 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136

                              1. Initial program 90.8%

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

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

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

                                  \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                                4. lower-*.f6433.1

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

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

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

                                if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

                                1. Initial program 64.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 rewrites30.8%

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

                                  \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                                7. Step-by-step derivation
                                  1. Applied rewrites80.8%

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

                                  if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                                  1. Initial program 0.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 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. *-commutativeN/A

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

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

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

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

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

                                      \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                                    10. lower-neg.f6416.9

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

                                    \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
                                8. Recombined 4 regimes into one program.
                                9. Final simplification62.0%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq -2 \cdot 10^{-99}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}} \cdot \frac{\left(D \cdot D\right) \cdot \left(-0.125 \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)}}{\sqrt{\frac{\ell}{d}}}\\ \mathbf{elif}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq \infty:\\ \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \]
                                10. Add Preprocessing

                                Alternative 7: 53.5% accurate, 0.3× speedup?

                                \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\ \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{\left(M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)\right) \cdot 0.125}{d}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
                                D_m = (fabs.f64 D)
                                M_m = (fabs.f64 M)
                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                (FPCore (d h l M_m D_m)
                                 :precision binary64
                                 (let* ((t_0
                                         (*
                                          (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                                          (+
                                           1.0
                                           (* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
                                   (if (<= t_0 0.0)
                                     (* (sqrt (/ (/ h (* l l)) l)) (/ (* (* M_m (* D_m (* M_m D_m))) 0.125) d))
                                     (if (<= t_0 2e+136)
                                       (* (sqrt (/ d l)) (sqrt (/ d h)))
                                       (if (<= t_0 INFINITY)
                                         (/ (* d (sqrt (/ h l))) h)
                                         (* (- d) (sqrt (/ 1.0 (* h l)))))))))
                                D_m = fabs(D);
                                M_m = fabs(M);
                                assert(d < h && h < l && l < M_m && M_m < D_m);
                                double code(double d, double h, double l, double M_m, double D_m) {
                                	double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                                	double tmp;
                                	if (t_0 <= 0.0) {
                                		tmp = sqrt(((h / (l * l)) / l)) * (((M_m * (D_m * (M_m * D_m))) * 0.125) / d);
                                	} else if (t_0 <= 2e+136) {
                                		tmp = sqrt((d / l)) * sqrt((d / h));
                                	} else if (t_0 <= ((double) INFINITY)) {
                                		tmp = (d * sqrt((h / l))) / h;
                                	} else {
                                		tmp = -d * sqrt((1.0 / (h * l)));
                                	}
                                	return tmp;
                                }
                                
                                D_m = Math.abs(D);
                                M_m = Math.abs(M);
                                assert d < h && h < l && l < M_m && M_m < D_m;
                                public static double code(double d, double h, double l, double M_m, double D_m) {
                                	double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                                	double tmp;
                                	if (t_0 <= 0.0) {
                                		tmp = Math.sqrt(((h / (l * l)) / l)) * (((M_m * (D_m * (M_m * D_m))) * 0.125) / d);
                                	} else if (t_0 <= 2e+136) {
                                		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
                                	} else if (t_0 <= Double.POSITIVE_INFINITY) {
                                		tmp = (d * Math.sqrt((h / l))) / h;
                                	} else {
                                		tmp = -d * Math.sqrt((1.0 / (h * l)));
                                	}
                                	return tmp;
                                }
                                
                                D_m = math.fabs(D)
                                M_m = math.fabs(M)
                                [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                                def code(d, h, l, M_m, D_m):
                                	t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))))
                                	tmp = 0
                                	if t_0 <= 0.0:
                                		tmp = math.sqrt(((h / (l * l)) / l)) * (((M_m * (D_m * (M_m * D_m))) * 0.125) / d)
                                	elif t_0 <= 2e+136:
                                		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
                                	elif t_0 <= math.inf:
                                		tmp = (d * math.sqrt((h / l))) / h
                                	else:
                                		tmp = -d * math.sqrt((1.0 / (h * l)))
                                	return tmp
                                
                                D_m = abs(D)
                                M_m = abs(M)
                                d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                function code(d, h, l, M_m, D_m)
                                	t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0)))))
                                	tmp = 0.0
                                	if (t_0 <= 0.0)
                                		tmp = Float64(sqrt(Float64(Float64(h / Float64(l * l)) / l)) * Float64(Float64(Float64(M_m * Float64(D_m * Float64(M_m * D_m))) * 0.125) / d));
                                	elseif (t_0 <= 2e+136)
                                		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
                                	elseif (t_0 <= Inf)
                                		tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h);
                                	else
                                		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                	end
                                	return tmp
                                end
                                
                                D_m = abs(D);
                                M_m = abs(M);
                                d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                                function tmp_2 = code(d, h, l, M_m, D_m)
                                	t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
                                	tmp = 0.0;
                                	if (t_0 <= 0.0)
                                		tmp = sqrt(((h / (l * l)) / l)) * (((M_m * (D_m * (M_m * D_m))) * 0.125) / d);
                                	elseif (t_0 <= 2e+136)
                                		tmp = sqrt((d / l)) * sqrt((d / h));
                                	elseif (t_0 <= Inf)
                                		tmp = (d * sqrt((h / l))) / h;
                                	else
                                		tmp = -d * sqrt((1.0 / (h * l)));
                                	end
                                	tmp_2 = tmp;
                                end
                                
                                D_m = N[Abs[D], $MachinePrecision]
                                M_m = N[Abs[M], $MachinePrecision]
                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[Sqrt[N[(N[(h / N[(l * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(M$95$m * N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+136], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
                                
                                \begin{array}{l}
                                D_m = \left|D\right|
                                \\
                                M_m = \left|M\right|
                                \\
                                [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                \\
                                \begin{array}{l}
                                t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
                                \mathbf{if}\;t\_0 \leq 0:\\
                                \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{\left(M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)\right) \cdot 0.125}{d}\\
                                
                                \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+136}:\\
                                \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
                                
                                \mathbf{elif}\;t\_0 \leq \infty:\\
                                \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 4 regimes
                                2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0

                                  1. Initial program 82.8%

                                    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                  2. Add Preprocessing
                                  3. Applied rewrites36.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \color{blue}{\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d}\right)} \]
                                  7. Step-by-step derivation
                                    1. Applied rewrites30.5%

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

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

                                      if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136

                                      1. Initial program 97.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. lower-*.f64N/A

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

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

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

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

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

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

                                        if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

                                        1. Initial program 64.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 rewrites30.8%

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

                                          \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites80.8%

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

                                          if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                                          1. Initial program 0.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 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. *-commutativeN/A

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

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

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

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

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

                                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                                            10. lower-neg.f6416.9

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

                                            \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
                                        8. Recombined 4 regimes into one program.
                                        9. Final simplification56.3%

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

                                        Alternative 8: 53.0% accurate, 0.3× speedup?

                                        \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\ \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;\left(0.125 \cdot \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}}\right) \cdot \left(D\_m \cdot \frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
                                        D_m = (fabs.f64 D)
                                        M_m = (fabs.f64 M)
                                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                        (FPCore (d h l M_m D_m)
                                         :precision binary64
                                         (let* ((t_0
                                                 (*
                                                  (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                                                  (+
                                                   1.0
                                                   (* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
                                           (if (<= t_0 0.0)
                                             (* (* 0.125 (sqrt (/ h (* l (* l l))))) (* D_m (/ (* M_m (* M_m D_m)) d)))
                                             (if (<= t_0 2e+136)
                                               (* (sqrt (/ d l)) (sqrt (/ d h)))
                                               (if (<= t_0 INFINITY)
                                                 (/ (* d (sqrt (/ h l))) h)
                                                 (* (- d) (sqrt (/ 1.0 (* h l)))))))))
                                        D_m = fabs(D);
                                        M_m = fabs(M);
                                        assert(d < h && h < l && l < M_m && M_m < D_m);
                                        double code(double d, double h, double l, double M_m, double D_m) {
                                        	double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                                        	double tmp;
                                        	if (t_0 <= 0.0) {
                                        		tmp = (0.125 * sqrt((h / (l * (l * l))))) * (D_m * ((M_m * (M_m * D_m)) / d));
                                        	} else if (t_0 <= 2e+136) {
                                        		tmp = sqrt((d / l)) * sqrt((d / h));
                                        	} else if (t_0 <= ((double) INFINITY)) {
                                        		tmp = (d * sqrt((h / l))) / h;
                                        	} else {
                                        		tmp = -d * sqrt((1.0 / (h * l)));
                                        	}
                                        	return tmp;
                                        }
                                        
                                        D_m = Math.abs(D);
                                        M_m = Math.abs(M);
                                        assert d < h && h < l && l < M_m && M_m < D_m;
                                        public static double code(double d, double h, double l, double M_m, double D_m) {
                                        	double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                                        	double tmp;
                                        	if (t_0 <= 0.0) {
                                        		tmp = (0.125 * Math.sqrt((h / (l * (l * l))))) * (D_m * ((M_m * (M_m * D_m)) / d));
                                        	} else if (t_0 <= 2e+136) {
                                        		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
                                        	} else if (t_0 <= Double.POSITIVE_INFINITY) {
                                        		tmp = (d * Math.sqrt((h / l))) / h;
                                        	} else {
                                        		tmp = -d * Math.sqrt((1.0 / (h * l)));
                                        	}
                                        	return tmp;
                                        }
                                        
                                        D_m = math.fabs(D)
                                        M_m = math.fabs(M)
                                        [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                                        def code(d, h, l, M_m, D_m):
                                        	t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))))
                                        	tmp = 0
                                        	if t_0 <= 0.0:
                                        		tmp = (0.125 * math.sqrt((h / (l * (l * l))))) * (D_m * ((M_m * (M_m * D_m)) / d))
                                        	elif t_0 <= 2e+136:
                                        		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
                                        	elif t_0 <= math.inf:
                                        		tmp = (d * math.sqrt((h / l))) / h
                                        	else:
                                        		tmp = -d * math.sqrt((1.0 / (h * l)))
                                        	return tmp
                                        
                                        D_m = abs(D)
                                        M_m = abs(M)
                                        d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                        function code(d, h, l, M_m, D_m)
                                        	t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0)))))
                                        	tmp = 0.0
                                        	if (t_0 <= 0.0)
                                        		tmp = Float64(Float64(0.125 * sqrt(Float64(h / Float64(l * Float64(l * l))))) * Float64(D_m * Float64(Float64(M_m * Float64(M_m * D_m)) / d)));
                                        	elseif (t_0 <= 2e+136)
                                        		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
                                        	elseif (t_0 <= Inf)
                                        		tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h);
                                        	else
                                        		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                        	end
                                        	return tmp
                                        end
                                        
                                        D_m = abs(D);
                                        M_m = abs(M);
                                        d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                                        function tmp_2 = code(d, h, l, M_m, D_m)
                                        	t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
                                        	tmp = 0.0;
                                        	if (t_0 <= 0.0)
                                        		tmp = (0.125 * sqrt((h / (l * (l * l))))) * (D_m * ((M_m * (M_m * D_m)) / d));
                                        	elseif (t_0 <= 2e+136)
                                        		tmp = sqrt((d / l)) * sqrt((d / h));
                                        	elseif (t_0 <= Inf)
                                        		tmp = (d * sqrt((h / l))) / h;
                                        	else
                                        		tmp = -d * sqrt((1.0 / (h * l)));
                                        	end
                                        	tmp_2 = tmp;
                                        end
                                        
                                        D_m = N[Abs[D], $MachinePrecision]
                                        M_m = N[Abs[M], $MachinePrecision]
                                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                        code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[(0.125 * N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(D$95$m * N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+136], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
                                        
                                        \begin{array}{l}
                                        D_m = \left|D\right|
                                        \\
                                        M_m = \left|M\right|
                                        \\
                                        [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                        \\
                                        \begin{array}{l}
                                        t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
                                        \mathbf{if}\;t\_0 \leq 0:\\
                                        \;\;\;\;\left(0.125 \cdot \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}}\right) \cdot \left(D\_m \cdot \frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\\
                                        
                                        \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+136}:\\
                                        \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
                                        
                                        \mathbf{elif}\;t\_0 \leq \infty:\\
                                        \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 4 regimes
                                        2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0

                                          1. Initial program 82.8%

                                            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                          2. Add Preprocessing
                                          3. Applied rewrites36.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                            \[\leadsto \color{blue}{\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d}\right)} \]
                                          7. Step-by-step derivation
                                            1. Applied rewrites36.5%

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

                                            if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136

                                            1. Initial program 97.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. lower-*.f64N/A

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

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

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

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

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

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

                                              if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

                                              1. Initial program 64.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 rewrites30.8%

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

                                                \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                                              7. Step-by-step derivation
                                                1. Applied rewrites80.8%

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

                                                if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                                                1. Initial program 0.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 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. *-commutativeN/A

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

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

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

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

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

                                                    \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                                                  10. lower-neg.f6416.9

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

                                                  \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
                                              8. Recombined 4 regimes into one program.
                                              9. Final simplification54.8%

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

                                              Alternative 9: 51.7% accurate, 0.3× speedup?

                                              \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\ \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(D\_m \cdot \left(D\_m \cdot \left(M\_m \cdot M\_m\right)\right)\right) \cdot \frac{0.125}{d}\right)\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
                                              D_m = (fabs.f64 D)
                                              M_m = (fabs.f64 M)
                                              NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                              (FPCore (d h l M_m D_m)
                                               :precision binary64
                                               (let* ((t_0
                                                       (*
                                                        (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                                                        (+
                                                         1.0
                                                         (* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
                                                 (if (<= t_0 0.0)
                                                   (* (sqrt (/ h (* l (* l l)))) (* (* D_m (* D_m (* M_m M_m))) (/ 0.125 d)))
                                                   (if (<= t_0 2e+136)
                                                     (* (sqrt (/ d l)) (sqrt (/ d h)))
                                                     (if (<= t_0 INFINITY)
                                                       (/ (* d (sqrt (/ h l))) h)
                                                       (* (- d) (sqrt (/ 1.0 (* h l)))))))))
                                              D_m = fabs(D);
                                              M_m = fabs(M);
                                              assert(d < h && h < l && l < M_m && M_m < D_m);
                                              double code(double d, double h, double l, double M_m, double D_m) {
                                              	double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                                              	double tmp;
                                              	if (t_0 <= 0.0) {
                                              		tmp = sqrt((h / (l * (l * l)))) * ((D_m * (D_m * (M_m * M_m))) * (0.125 / d));
                                              	} else if (t_0 <= 2e+136) {
                                              		tmp = sqrt((d / l)) * sqrt((d / h));
                                              	} else if (t_0 <= ((double) INFINITY)) {
                                              		tmp = (d * sqrt((h / l))) / h;
                                              	} else {
                                              		tmp = -d * sqrt((1.0 / (h * l)));
                                              	}
                                              	return tmp;
                                              }
                                              
                                              D_m = Math.abs(D);
                                              M_m = Math.abs(M);
                                              assert d < h && h < l && l < M_m && M_m < D_m;
                                              public static double code(double d, double h, double l, double M_m, double D_m) {
                                              	double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                                              	double tmp;
                                              	if (t_0 <= 0.0) {
                                              		tmp = Math.sqrt((h / (l * (l * l)))) * ((D_m * (D_m * (M_m * M_m))) * (0.125 / d));
                                              	} else if (t_0 <= 2e+136) {
                                              		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
                                              	} else if (t_0 <= Double.POSITIVE_INFINITY) {
                                              		tmp = (d * Math.sqrt((h / l))) / h;
                                              	} else {
                                              		tmp = -d * Math.sqrt((1.0 / (h * l)));
                                              	}
                                              	return tmp;
                                              }
                                              
                                              D_m = math.fabs(D)
                                              M_m = math.fabs(M)
                                              [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                                              def code(d, h, l, M_m, D_m):
                                              	t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))))
                                              	tmp = 0
                                              	if t_0 <= 0.0:
                                              		tmp = math.sqrt((h / (l * (l * l)))) * ((D_m * (D_m * (M_m * M_m))) * (0.125 / d))
                                              	elif t_0 <= 2e+136:
                                              		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
                                              	elif t_0 <= math.inf:
                                              		tmp = (d * math.sqrt((h / l))) / h
                                              	else:
                                              		tmp = -d * math.sqrt((1.0 / (h * l)))
                                              	return tmp
                                              
                                              D_m = abs(D)
                                              M_m = abs(M)
                                              d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                              function code(d, h, l, M_m, D_m)
                                              	t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0)))))
                                              	tmp = 0.0
                                              	if (t_0 <= 0.0)
                                              		tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(Float64(D_m * Float64(D_m * Float64(M_m * M_m))) * Float64(0.125 / d)));
                                              	elseif (t_0 <= 2e+136)
                                              		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
                                              	elseif (t_0 <= Inf)
                                              		tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h);
                                              	else
                                              		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                              	end
                                              	return tmp
                                              end
                                              
                                              D_m = abs(D);
                                              M_m = abs(M);
                                              d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                                              function tmp_2 = code(d, h, l, M_m, D_m)
                                              	t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
                                              	tmp = 0.0;
                                              	if (t_0 <= 0.0)
                                              		tmp = sqrt((h / (l * (l * l)))) * ((D_m * (D_m * (M_m * M_m))) * (0.125 / d));
                                              	elseif (t_0 <= 2e+136)
                                              		tmp = sqrt((d / l)) * sqrt((d / h));
                                              	elseif (t_0 <= Inf)
                                              		tmp = (d * sqrt((h / l))) / h;
                                              	else
                                              		tmp = -d * sqrt((1.0 / (h * l)));
                                              	end
                                              	tmp_2 = tmp;
                                              end
                                              
                                              D_m = N[Abs[D], $MachinePrecision]
                                              M_m = N[Abs[M], $MachinePrecision]
                                              NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                              code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D$95$m * N[(D$95$m * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.125 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+136], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
                                              
                                              \begin{array}{l}
                                              D_m = \left|D\right|
                                              \\
                                              M_m = \left|M\right|
                                              \\
                                              [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                              \\
                                              \begin{array}{l}
                                              t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
                                              \mathbf{if}\;t\_0 \leq 0:\\
                                              \;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(D\_m \cdot \left(D\_m \cdot \left(M\_m \cdot M\_m\right)\right)\right) \cdot \frac{0.125}{d}\right)\\
                                              
                                              \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+136}:\\
                                              \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
                                              
                                              \mathbf{elif}\;t\_0 \leq \infty:\\
                                              \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                              
                                              
                                              \end{array}
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 4 regimes
                                              2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0

                                                1. Initial program 82.8%

                                                  \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                2. Add Preprocessing
                                                3. Taylor expanded in h around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136

                                                1. Initial program 97.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. lower-*.f64N/A

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

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

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

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

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

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

                                                  if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

                                                  1. Initial program 64.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 rewrites30.8%

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

                                                    \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                                                  7. Step-by-step derivation
                                                    1. Applied rewrites80.8%

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

                                                    if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                                                    1. Initial program 0.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 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. *-commutativeN/A

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

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

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

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

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

                                                        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                                                      10. lower-neg.f6416.9

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

                                                      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
                                                  8. Recombined 4 regimes into one program.
                                                  9. Final simplification54.0%

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

                                                  Alternative 10: 50.7% accurate, 0.3× speedup?

                                                  \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{+251}:\\ \;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot \frac{-0.125 \cdot \left(M\_m \cdot M\_m\right)}{d}\right)\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
                                                  D_m = (fabs.f64 D)
                                                  M_m = (fabs.f64 M)
                                                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                  (FPCore (d h l M_m D_m)
                                                   :precision binary64
                                                   (let* ((t_0
                                                           (*
                                                            (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                                                            (+
                                                             1.0
                                                             (* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
                                                     (if (<= t_0 -5e+251)
                                                       (*
                                                        (sqrt (/ h (* l (* l l))))
                                                        (* (* D_m D_m) (/ (* -0.125 (* M_m M_m)) d)))
                                                       (if (<= t_0 2e+136)
                                                         (* (sqrt (/ d l)) (sqrt (/ d h)))
                                                         (if (<= t_0 INFINITY)
                                                           (/ (* d (sqrt (/ h l))) h)
                                                           (* (- d) (sqrt (/ 1.0 (* h l)))))))))
                                                  D_m = fabs(D);
                                                  M_m = fabs(M);
                                                  assert(d < h && h < l && l < M_m && M_m < D_m);
                                                  double code(double d, double h, double l, double M_m, double D_m) {
                                                  	double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                                                  	double tmp;
                                                  	if (t_0 <= -5e+251) {
                                                  		tmp = sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d));
                                                  	} else if (t_0 <= 2e+136) {
                                                  		tmp = sqrt((d / l)) * sqrt((d / h));
                                                  	} else if (t_0 <= ((double) INFINITY)) {
                                                  		tmp = (d * sqrt((h / l))) / h;
                                                  	} else {
                                                  		tmp = -d * sqrt((1.0 / (h * l)));
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  D_m = Math.abs(D);
                                                  M_m = Math.abs(M);
                                                  assert d < h && h < l && l < M_m && M_m < D_m;
                                                  public static double code(double d, double h, double l, double M_m, double D_m) {
                                                  	double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                                                  	double tmp;
                                                  	if (t_0 <= -5e+251) {
                                                  		tmp = Math.sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d));
                                                  	} else if (t_0 <= 2e+136) {
                                                  		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
                                                  	} else if (t_0 <= Double.POSITIVE_INFINITY) {
                                                  		tmp = (d * Math.sqrt((h / l))) / h;
                                                  	} else {
                                                  		tmp = -d * Math.sqrt((1.0 / (h * l)));
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  D_m = math.fabs(D)
                                                  M_m = math.fabs(M)
                                                  [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                                                  def code(d, h, l, M_m, D_m):
                                                  	t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))))
                                                  	tmp = 0
                                                  	if t_0 <= -5e+251:
                                                  		tmp = math.sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d))
                                                  	elif t_0 <= 2e+136:
                                                  		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
                                                  	elif t_0 <= math.inf:
                                                  		tmp = (d * math.sqrt((h / l))) / h
                                                  	else:
                                                  		tmp = -d * math.sqrt((1.0 / (h * l)))
                                                  	return tmp
                                                  
                                                  D_m = abs(D)
                                                  M_m = abs(M)
                                                  d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                  function code(d, h, l, M_m, D_m)
                                                  	t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0)))))
                                                  	tmp = 0.0
                                                  	if (t_0 <= -5e+251)
                                                  		tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(Float64(D_m * D_m) * Float64(Float64(-0.125 * Float64(M_m * M_m)) / d)));
                                                  	elseif (t_0 <= 2e+136)
                                                  		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
                                                  	elseif (t_0 <= Inf)
                                                  		tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h);
                                                  	else
                                                  		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                                  	end
                                                  	return tmp
                                                  end
                                                  
                                                  D_m = abs(D);
                                                  M_m = abs(M);
                                                  d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                                                  function tmp_2 = code(d, h, l, M_m, D_m)
                                                  	t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
                                                  	tmp = 0.0;
                                                  	if (t_0 <= -5e+251)
                                                  		tmp = sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d));
                                                  	elseif (t_0 <= 2e+136)
                                                  		tmp = sqrt((d / l)) * sqrt((d / h));
                                                  	elseif (t_0 <= Inf)
                                                  		tmp = (d * sqrt((h / l))) / h;
                                                  	else
                                                  		tmp = -d * sqrt((1.0 / (h * l)));
                                                  	end
                                                  	tmp_2 = tmp;
                                                  end
                                                  
                                                  D_m = N[Abs[D], $MachinePrecision]
                                                  M_m = N[Abs[M], $MachinePrecision]
                                                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                  code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+251], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(-0.125 * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+136], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
                                                  
                                                  \begin{array}{l}
                                                  D_m = \left|D\right|
                                                  \\
                                                  M_m = \left|M\right|
                                                  \\
                                                  [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                  \\
                                                  \begin{array}{l}
                                                  t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
                                                  \mathbf{if}\;t\_0 \leq -5 \cdot 10^{+251}:\\
                                                  \;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot \frac{-0.125 \cdot \left(M\_m \cdot M\_m\right)}{d}\right)\\
                                                  
                                                  \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+136}:\\
                                                  \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
                                                  
                                                  \mathbf{elif}\;t\_0 \leq \infty:\\
                                                  \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
                                                  
                                                  \mathbf{else}:\\
                                                  \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                                  
                                                  
                                                  \end{array}
                                                  \end{array}
                                                  
                                                  Derivation
                                                  1. Split input into 4 regimes
                                                  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.0000000000000005e251

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                    if -5.0000000000000005e251 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136

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

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

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

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

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

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

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

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

                                                      if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

                                                      1. Initial program 64.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 rewrites30.8%

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

                                                        \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                                                      7. Step-by-step derivation
                                                        1. Applied rewrites80.8%

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

                                                        if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                                                        1. Initial program 0.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 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. *-commutativeN/A

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

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

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

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

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

                                                            \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                                                          10. lower-neg.f6416.9

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

                                                          \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
                                                      8. Recombined 4 regimes into one program.
                                                      9. Final simplification50.4%

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

                                                      Alternative 11: 48.8% accurate, 0.3× speedup?

                                                      \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{\ell}}\\ t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-180}:\\ \;\;\;\;\frac{\left(-d\right) \cdot t\_0}{h}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{d \cdot t\_0}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
                                                      D_m = (fabs.f64 D)
                                                      M_m = (fabs.f64 M)
                                                      NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                      (FPCore (d h l M_m D_m)
                                                       :precision binary64
                                                       (let* ((t_0 (sqrt (/ h l)))
                                                              (t_1
                                                               (*
                                                                (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                                                                (+
                                                                 1.0
                                                                 (* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
                                                         (if (<= t_1 -2e-180)
                                                           (/ (* (- d) t_0) h)
                                                           (if (<= t_1 2e+136)
                                                             (* (sqrt (/ d l)) (sqrt (/ d h)))
                                                             (if (<= t_1 INFINITY)
                                                               (/ (* d t_0) h)
                                                               (* (- d) (sqrt (/ 1.0 (* h l)))))))))
                                                      D_m = fabs(D);
                                                      M_m = fabs(M);
                                                      assert(d < h && h < l && l < M_m && M_m < D_m);
                                                      double code(double d, double h, double l, double M_m, double D_m) {
                                                      	double t_0 = sqrt((h / l));
                                                      	double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                                                      	double tmp;
                                                      	if (t_1 <= -2e-180) {
                                                      		tmp = (-d * t_0) / h;
                                                      	} else if (t_1 <= 2e+136) {
                                                      		tmp = sqrt((d / l)) * sqrt((d / h));
                                                      	} else if (t_1 <= ((double) INFINITY)) {
                                                      		tmp = (d * t_0) / h;
                                                      	} else {
                                                      		tmp = -d * sqrt((1.0 / (h * l)));
                                                      	}
                                                      	return tmp;
                                                      }
                                                      
                                                      D_m = Math.abs(D);
                                                      M_m = Math.abs(M);
                                                      assert d < h && h < l && l < M_m && M_m < D_m;
                                                      public static double code(double d, double h, double l, double M_m, double D_m) {
                                                      	double t_0 = Math.sqrt((h / l));
                                                      	double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                                                      	double tmp;
                                                      	if (t_1 <= -2e-180) {
                                                      		tmp = (-d * t_0) / h;
                                                      	} else if (t_1 <= 2e+136) {
                                                      		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
                                                      	} else if (t_1 <= Double.POSITIVE_INFINITY) {
                                                      		tmp = (d * t_0) / h;
                                                      	} else {
                                                      		tmp = -d * Math.sqrt((1.0 / (h * l)));
                                                      	}
                                                      	return tmp;
                                                      }
                                                      
                                                      D_m = math.fabs(D)
                                                      M_m = math.fabs(M)
                                                      [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                                                      def code(d, h, l, M_m, D_m):
                                                      	t_0 = math.sqrt((h / l))
                                                      	t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))))
                                                      	tmp = 0
                                                      	if t_1 <= -2e-180:
                                                      		tmp = (-d * t_0) / h
                                                      	elif t_1 <= 2e+136:
                                                      		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
                                                      	elif t_1 <= math.inf:
                                                      		tmp = (d * t_0) / h
                                                      	else:
                                                      		tmp = -d * math.sqrt((1.0 / (h * l)))
                                                      	return tmp
                                                      
                                                      D_m = abs(D)
                                                      M_m = abs(M)
                                                      d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                      function code(d, h, l, M_m, D_m)
                                                      	t_0 = sqrt(Float64(h / l))
                                                      	t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0)))))
                                                      	tmp = 0.0
                                                      	if (t_1 <= -2e-180)
                                                      		tmp = Float64(Float64(Float64(-d) * t_0) / h);
                                                      	elseif (t_1 <= 2e+136)
                                                      		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
                                                      	elseif (t_1 <= Inf)
                                                      		tmp = Float64(Float64(d * t_0) / h);
                                                      	else
                                                      		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                                      	end
                                                      	return tmp
                                                      end
                                                      
                                                      D_m = abs(D);
                                                      M_m = abs(M);
                                                      d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                                                      function tmp_2 = code(d, h, l, M_m, D_m)
                                                      	t_0 = sqrt((h / l));
                                                      	t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
                                                      	tmp = 0.0;
                                                      	if (t_1 <= -2e-180)
                                                      		tmp = (-d * t_0) / h;
                                                      	elseif (t_1 <= 2e+136)
                                                      		tmp = sqrt((d / l)) * sqrt((d / h));
                                                      	elseif (t_1 <= Inf)
                                                      		tmp = (d * t_0) / h;
                                                      	else
                                                      		tmp = -d * sqrt((1.0 / (h * l)));
                                                      	end
                                                      	tmp_2 = tmp;
                                                      end
                                                      
                                                      D_m = N[Abs[D], $MachinePrecision]
                                                      M_m = N[Abs[M], $MachinePrecision]
                                                      NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                      code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-180], N[(N[((-d) * t$95$0), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$1, 2e+136], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(d * t$95$0), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
                                                      
                                                      \begin{array}{l}
                                                      D_m = \left|D\right|
                                                      \\
                                                      M_m = \left|M\right|
                                                      \\
                                                      [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                      \\
                                                      \begin{array}{l}
                                                      t_0 := \sqrt{\frac{h}{\ell}}\\
                                                      t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
                                                      \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-180}:\\
                                                      \;\;\;\;\frac{\left(-d\right) \cdot t\_0}{h}\\
                                                      
                                                      \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+136}:\\
                                                      \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
                                                      
                                                      \mathbf{elif}\;t\_1 \leq \infty:\\
                                                      \;\;\;\;\frac{d \cdot t\_0}{h}\\
                                                      
                                                      \mathbf{else}:\\
                                                      \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                                      
                                                      
                                                      \end{array}
                                                      \end{array}
                                                      
                                                      Derivation
                                                      1. Split input into 4 regimes
                                                      2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180

                                                        1. Initial program 86.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 rewrites28.3%

                                                          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(d, \sqrt{\frac{h}{\ell}}, \left(D \cdot \frac{D \cdot \left(M \cdot M\right)}{d}\right) \cdot \left(-0.125 \cdot \sqrt{\frac{h \cdot \left(h \cdot h\right)}{\ell \cdot \left(\ell \cdot \ell\right)}}\right)\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 rewrites22.4%

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

                                                          if -2e-180 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136

                                                          1. Initial program 90.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 d around inf

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

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

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

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

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

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

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

                                                            if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

                                                            1. Initial program 64.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 rewrites30.8%

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

                                                              \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                                                            7. Step-by-step derivation
                                                              1. Applied rewrites80.8%

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

                                                              if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                                                              1. Initial program 0.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 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. *-commutativeN/A

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

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

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

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

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

                                                                  \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                                                                10. lower-neg.f6416.9

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

                                                                \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]
                                                            8. Recombined 4 regimes into one program.
                                                            9. Final simplification49.5%

                                                              \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq -2 \cdot 10^{-180}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq \infty:\\ \;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \]
                                                            10. Add Preprocessing

                                                            Alternative 12: 73.5% accurate, 0.4× speedup?

                                                            \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{\frac{h}{\ell}}\\ t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\ t_3 := \sqrt{\frac{\ell}{d}}\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;\frac{t\_0 \cdot \mathsf{fma}\left(\frac{\left(M\_m \cdot D\_m\right) \cdot -0.5}{\ell \cdot \left(d \cdot 2\right)}, \frac{h \cdot \left(M\_m \cdot \left(D\_m \cdot 0.5\right)\right)}{d}, 1\right)}{t\_3}\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+198}:\\ \;\;\;\;\frac{t\_0 \cdot \mathsf{fma}\left(\frac{M\_m \cdot D\_m}{d} \cdot \frac{M\_m \cdot D\_m}{d \cdot 4}, \frac{h}{\ell} \cdot -0.5, 1\right)}{t\_3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_1, d \cdot t\_1\right)}{h}\\ \end{array} \end{array} \]
                                                            D_m = (fabs.f64 D)
                                                            M_m = (fabs.f64 M)
                                                            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                            (FPCore (d h l M_m D_m)
                                                             :precision binary64
                                                             (let* ((t_0 (sqrt (/ d h)))
                                                                    (t_1 (sqrt (/ h l)))
                                                                    (t_2
                                                                     (*
                                                                      (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                                                                      (+
                                                                       1.0
                                                                       (* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0))))))
                                                                    (t_3 (sqrt (/ l d))))
                                                               (if (<= t_2 (- INFINITY))
                                                                 (/
                                                                  (*
                                                                   t_0
                                                                   (fma
                                                                    (/ (* (* M_m D_m) -0.5) (* l (* d 2.0)))
                                                                    (/ (* h (* M_m (* D_m 0.5))) d)
                                                                    1.0))
                                                                  t_3)
                                                                 (if (<= t_2 5e+198)
                                                                   (/
                                                                    (*
                                                                     t_0
                                                                     (fma
                                                                      (* (/ (* M_m D_m) d) (/ (* M_m D_m) (* d 4.0)))
                                                                      (* (/ h l) -0.5)
                                                                      1.0))
                                                                    t_3)
                                                                   (/
                                                                    (fma
                                                                     (* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
                                                                     t_1
                                                                     (* d t_1))
                                                                    h)))))
                                                            D_m = fabs(D);
                                                            M_m = fabs(M);
                                                            assert(d < h && h < l && l < M_m && M_m < D_m);
                                                            double code(double d, double h, double l, double M_m, double D_m) {
                                                            	double t_0 = sqrt((d / h));
                                                            	double t_1 = sqrt((h / l));
                                                            	double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
                                                            	double t_3 = sqrt((l / d));
                                                            	double tmp;
                                                            	if (t_2 <= -((double) INFINITY)) {
                                                            		tmp = (t_0 * fma((((M_m * D_m) * -0.5) / (l * (d * 2.0))), ((h * (M_m * (D_m * 0.5))) / d), 1.0)) / t_3;
                                                            	} else if (t_2 <= 5e+198) {
                                                            		tmp = (t_0 * fma((((M_m * D_m) / d) * ((M_m * D_m) / (d * 4.0))), ((h / l) * -0.5), 1.0)) / t_3;
                                                            	} else {
                                                            		tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_1, (d * t_1)) / h;
                                                            	}
                                                            	return tmp;
                                                            }
                                                            
                                                            D_m = abs(D)
                                                            M_m = abs(M)
                                                            d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                            function code(d, h, l, M_m, D_m)
                                                            	t_0 = sqrt(Float64(d / h))
                                                            	t_1 = sqrt(Float64(h / l))
                                                            	t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0)))))
                                                            	t_3 = sqrt(Float64(l / d))
                                                            	tmp = 0.0
                                                            	if (t_2 <= Float64(-Inf))
                                                            		tmp = Float64(Float64(t_0 * fma(Float64(Float64(Float64(M_m * D_m) * -0.5) / Float64(l * Float64(d * 2.0))), Float64(Float64(h * Float64(M_m * Float64(D_m * 0.5))) / d), 1.0)) / t_3);
                                                            	elseif (t_2 <= 5e+198)
                                                            		tmp = Float64(Float64(t_0 * fma(Float64(Float64(Float64(M_m * D_m) / d) * Float64(Float64(M_m * D_m) / Float64(d * 4.0))), Float64(Float64(h / l) * -0.5), 1.0)) / t_3);
                                                            	else
                                                            		tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_1, Float64(d * t_1)) / h);
                                                            	end
                                                            	return tmp
                                                            end
                                                            
                                                            D_m = N[Abs[D], $MachinePrecision]
                                                            M_m = N[Abs[M], $MachinePrecision]
                                                            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                            code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(t$95$0 * N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * -0.5), $MachinePrecision] / N[(l * N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[t$95$2, 5e+198], N[(N[(t$95$0 * N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] * N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$1 + N[(d * t$95$1), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]]]]]
                                                            
                                                            \begin{array}{l}
                                                            D_m = \left|D\right|
                                                            \\
                                                            M_m = \left|M\right|
                                                            \\
                                                            [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                            \\
                                                            \begin{array}{l}
                                                            t_0 := \sqrt{\frac{d}{h}}\\
                                                            t_1 := \sqrt{\frac{h}{\ell}}\\
                                                            t_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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
                                                            t_3 := \sqrt{\frac{\ell}{d}}\\
                                                            \mathbf{if}\;t\_2 \leq -\infty:\\
                                                            \;\;\;\;\frac{t\_0 \cdot \mathsf{fma}\left(\frac{\left(M\_m \cdot D\_m\right) \cdot -0.5}{\ell \cdot \left(d \cdot 2\right)}, \frac{h \cdot \left(M\_m \cdot \left(D\_m \cdot 0.5\right)\right)}{d}, 1\right)}{t\_3}\\
                                                            
                                                            \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+198}:\\
                                                            \;\;\;\;\frac{t\_0 \cdot \mathsf{fma}\left(\frac{M\_m \cdot D\_m}{d} \cdot \frac{M\_m \cdot D\_m}{d \cdot 4}, \frac{h}{\ell} \cdot -0.5, 1\right)}{t\_3}\\
                                                            
                                                            \mathbf{else}:\\
                                                            \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_1, d \cdot t\_1\right)}{h}\\
                                                            
                                                            
                                                            \end{array}
                                                            \end{array}
                                                            
                                                            Derivation
                                                            1. Split input into 3 regimes
                                                            2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -inf.0

                                                              1. Initial program 83.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 rewrites71.4%

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

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

                                                              if -inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.00000000000000049e198

                                                              1. Initial program 92.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 rewrites65.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                              if 5.00000000000000049e198 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                                                              1. Initial program 27.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. 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 rewrites18.7%

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

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

                                                                    \[\leadsto \frac{\mathsf{fma}\left(\left(D \cdot \left(\frac{M \cdot \left(M \cdot D\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, \sqrt{\frac{h}{\ell}}, d \cdot \sqrt{\frac{h}{\ell}}\right)}{h} \]
                                                                3. Recombined 3 regimes into one program.
                                                                4. Final simplification75.2%

                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq -\infty:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left(\frac{\left(M \cdot D\right) \cdot -0.5}{\ell \cdot \left(d \cdot 2\right)}, \frac{h \cdot \left(M \cdot \left(D \cdot 0.5\right)\right)}{d}, 1\right)}{\sqrt{\frac{\ell}{d}}}\\ \mathbf{elif}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq 5 \cdot 10^{+198}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left(\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d \cdot 4}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\frac{\ell}{d}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D \cdot \left(\frac{M \cdot \left(M \cdot D\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, \sqrt{\frac{h}{\ell}}, d \cdot \sqrt{\frac{h}{\ell}}\right)}{h}\\ \end{array} \]
                                                                5. Add Preprocessing

                                                                Alternative 13: 74.2% accurate, 0.8× speedup?

                                                                \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{\ell}}\\ \mathbf{if}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\left(1 - \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_0, d \cdot t\_0\right)}{h}\\ \end{array} \end{array} \]
                                                                D_m = (fabs.f64 D)
                                                                M_m = (fabs.f64 M)
                                                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                (FPCore (d h l M_m D_m)
                                                                 :precision binary64
                                                                 (let* ((t_0 (sqrt (/ h l))))
                                                                   (if (<=
                                                                        (*
                                                                         (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                                                                         (+
                                                                          1.0
                                                                          (* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))
                                                                        2e+136)
                                                                     (*
                                                                      (-
                                                                       1.0
                                                                       (*
                                                                        (/ (/ (* M_m (* D_m 0.5)) (* d 2.0)) l)
                                                                        (* h (/ (* 0.5 (* M_m D_m)) d))))
                                                                      (* (sqrt (/ d l)) (sqrt (/ d h))))
                                                                     (/
                                                                      (fma
                                                                       (* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
                                                                       t_0
                                                                       (* d t_0))
                                                                      h))))
                                                                D_m = fabs(D);
                                                                M_m = fabs(M);
                                                                assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                double code(double d, double h, double l, double M_m, double D_m) {
                                                                	double t_0 = sqrt((h / l));
                                                                	double tmp;
                                                                	if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))))) <= 2e+136) {
                                                                		tmp = (1.0 - ((((M_m * (D_m * 0.5)) / (d * 2.0)) / l) * (h * ((0.5 * (M_m * D_m)) / d)))) * (sqrt((d / l)) * sqrt((d / h)));
                                                                	} else {
                                                                		tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_0, (d * t_0)) / h;
                                                                	}
                                                                	return tmp;
                                                                }
                                                                
                                                                D_m = abs(D)
                                                                M_m = abs(M)
                                                                d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                function code(d, h, l, M_m, D_m)
                                                                	t_0 = sqrt(Float64(h / l))
                                                                	tmp = 0.0
                                                                	if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) <= 2e+136)
                                                                		tmp = Float64(Float64(1.0 - Float64(Float64(Float64(Float64(M_m * Float64(D_m * 0.5)) / Float64(d * 2.0)) / l) * Float64(h * Float64(Float64(0.5 * Float64(M_m * D_m)) / d)))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))));
                                                                	else
                                                                		tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_0, Float64(d * t_0)) / h);
                                                                	end
                                                                	return tmp
                                                                end
                                                                
                                                                D_m = N[Abs[D], $MachinePrecision]
                                                                M_m = N[Abs[M], $MachinePrecision]
                                                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+136], N[(N[(1.0 - N[(N[(N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(h * N[(N[(0.5 * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(d * t$95$0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]
                                                                
                                                                \begin{array}{l}
                                                                D_m = \left|D\right|
                                                                \\
                                                                M_m = \left|M\right|
                                                                \\
                                                                [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                \\
                                                                \begin{array}{l}
                                                                t_0 := \sqrt{\frac{h}{\ell}}\\
                                                                \mathbf{if}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq 2 \cdot 10^{+136}:\\
                                                                \;\;\;\;\left(1 - \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
                                                                
                                                                \mathbf{else}:\\
                                                                \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_0, d \cdot t\_0\right)}{h}\\
                                                                
                                                                
                                                                \end{array}
                                                                \end{array}
                                                                
                                                                Derivation
                                                                1. Split input into 2 regimes
                                                                2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136

                                                                  1. Initial program 88.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. 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. 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{\frac{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
                                                                    7. 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{\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}}{\frac{\ell}{h}}\right) \]
                                                                    8. associate-*r*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}{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}\right) \]
                                                                    9. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
                                                                    10. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                    11. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                  4. Applied rewrites92.8%

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

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

                                                                      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                    4. unpow1/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{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                    5. lower-sqrt.f6492.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                  if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                                                                  1. Initial program 32.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 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 rewrites20.7%

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

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

                                                                        \[\leadsto \frac{\mathsf{fma}\left(\left(D \cdot \left(\frac{M \cdot \left(M \cdot D\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, \sqrt{\frac{h}{\ell}}, d \cdot \sqrt{\frac{h}{\ell}}\right)}{h} \]
                                                                    3. Recombined 2 regimes into one program.
                                                                    4. Final simplification76.0%

                                                                      \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\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{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq 2 \cdot 10^{+136}:\\ \;\;\;\;\left(1 - \frac{\frac{M \cdot \left(D \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M \cdot D\right)}{d}\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D \cdot \left(\frac{M \cdot \left(M \cdot D\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, \sqrt{\frac{h}{\ell}}, d \cdot \sqrt{\frac{h}{\ell}}\right)}{h}\\ \end{array} \]
                                                                    5. Add Preprocessing

                                                                    Alternative 14: 80.2% accurate, 1.7× speedup?

                                                                    \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{\ell}}\\ t_1 := 1 - \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\\ \mathbf{if}\;d \leq -8.2 \cdot 10^{-193}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_1\\ \mathbf{elif}\;d \leq 8 \cdot 10^{-289}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_0, d \cdot t\_0\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\ \end{array} \end{array} \]
                                                                    D_m = (fabs.f64 D)
                                                                    M_m = (fabs.f64 M)
                                                                    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                    (FPCore (d h l M_m D_m)
                                                                     :precision binary64
                                                                     (let* ((t_0 (sqrt (/ h l)))
                                                                            (t_1
                                                                             (-
                                                                              1.0
                                                                              (*
                                                                               (/ (/ (* M_m (* D_m 0.5)) (* d 2.0)) l)
                                                                               (* h (/ (* 0.5 (* M_m D_m)) d))))))
                                                                       (if (<= d -8.2e-193)
                                                                         (* (* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l))) t_1)
                                                                         (if (<= d 8e-289)
                                                                           (/
                                                                            (fma
                                                                             (* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
                                                                             t_0
                                                                             (* d t_0))
                                                                            h)
                                                                           (* t_1 (* (pow (/ d h) (/ 1.0 2.0)) (/ (sqrt d) (sqrt l))))))))
                                                                    D_m = fabs(D);
                                                                    M_m = fabs(M);
                                                                    assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                    double code(double d, double h, double l, double M_m, double D_m) {
                                                                    	double t_0 = sqrt((h / l));
                                                                    	double t_1 = 1.0 - ((((M_m * (D_m * 0.5)) / (d * 2.0)) / l) * (h * ((0.5 * (M_m * D_m)) / d)));
                                                                    	double tmp;
                                                                    	if (d <= -8.2e-193) {
                                                                    		tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * t_1;
                                                                    	} else if (d <= 8e-289) {
                                                                    		tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_0, (d * t_0)) / h;
                                                                    	} else {
                                                                    		tmp = t_1 * (pow((d / h), (1.0 / 2.0)) * (sqrt(d) / sqrt(l)));
                                                                    	}
                                                                    	return tmp;
                                                                    }
                                                                    
                                                                    D_m = abs(D)
                                                                    M_m = abs(M)
                                                                    d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                    function code(d, h, l, M_m, D_m)
                                                                    	t_0 = sqrt(Float64(h / l))
                                                                    	t_1 = Float64(1.0 - Float64(Float64(Float64(Float64(M_m * Float64(D_m * 0.5)) / Float64(d * 2.0)) / l) * Float64(h * Float64(Float64(0.5 * Float64(M_m * D_m)) / d))))
                                                                    	tmp = 0.0
                                                                    	if (d <= -8.2e-193)
                                                                    		tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * t_1);
                                                                    	elseif (d <= 8e-289)
                                                                    		tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_0, Float64(d * t_0)) / h);
                                                                    	else
                                                                    		tmp = Float64(t_1 * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * Float64(sqrt(d) / sqrt(l))));
                                                                    	end
                                                                    	return tmp
                                                                    end
                                                                    
                                                                    D_m = N[Abs[D], $MachinePrecision]
                                                                    M_m = N[Abs[M], $MachinePrecision]
                                                                    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                    code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(N[(N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(h * N[(N[(0.5 * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.2e-193], 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, 8e-289], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(d * t$95$0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$1 * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
                                                                    
                                                                    \begin{array}{l}
                                                                    D_m = \left|D\right|
                                                                    \\
                                                                    M_m = \left|M\right|
                                                                    \\
                                                                    [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                    \\
                                                                    \begin{array}{l}
                                                                    t_0 := \sqrt{\frac{h}{\ell}}\\
                                                                    t_1 := 1 - \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\\
                                                                    \mathbf{if}\;d \leq -8.2 \cdot 10^{-193}:\\
                                                                    \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_1\\
                                                                    
                                                                    \mathbf{elif}\;d \leq 8 \cdot 10^{-289}:\\
                                                                    \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_0, d \cdot t\_0\right)}{h}\\
                                                                    
                                                                    \mathbf{else}:\\
                                                                    \;\;\;\;t\_1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
                                                                    
                                                                    
                                                                    \end{array}
                                                                    \end{array}
                                                                    
                                                                    Derivation
                                                                    1. Split input into 3 regimes
                                                                    2. if d < -8.20000000000000005e-193

                                                                      1. Initial program 73.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. 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{\frac{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
                                                                        7. 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{\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}}{\frac{\ell}{h}}\right) \]
                                                                        8. associate-*r*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}{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}\right) \]
                                                                        9. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
                                                                        10. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                        11. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                      4. Applied rewrites80.1%

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

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

                                                                          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                        4. unpow1/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{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                        5. lower-sqrt.f6480.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                      if -8.20000000000000005e-193 < d < 8.0000000000000001e-289

                                                                      1. Initial program 31.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 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 rewrites17.7%

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

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

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

                                                                          if 8.0000000000000001e-289 < d

                                                                          1. Initial program 70.8%

                                                                            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                          2. 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. 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{\frac{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
                                                                            7. 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{\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}}{\frac{\ell}{h}}\right) \]
                                                                            8. associate-*r*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}{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}\right) \]
                                                                            9. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
                                                                            10. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                            11. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                          4. Applied rewrites79.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{\frac{M \cdot \left(D \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}}\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)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                            2. lift-pow.f64N/A

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

                                                                              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                            4. unpow1/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{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                            5. lower-sqrt.f6479.4

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \color{blue}{\left(\frac{0.5 \cdot \left(M \cdot D\right)}{d} \cdot h\right)}\right) \]
                                                                          9. Step-by-step derivation
                                                                            1. lift-sqrt.f64N/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{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \left(\frac{\frac{1}{2} \cdot \left(M \cdot D\right)}{d} \cdot h\right)\right) \]
                                                                            2. 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{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \left(\frac{\frac{1}{2} \cdot \left(M \cdot D\right)}{d} \cdot h\right)\right) \]
                                                                            3. 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{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \left(\frac{\frac{1}{2} \cdot \left(M \cdot D\right)}{d} \cdot h\right)\right) \]
                                                                            4. lower-/.f64N/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{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \left(\frac{\frac{1}{2} \cdot \left(M \cdot D\right)}{d} \cdot h\right)\right) \]
                                                                            5. lower-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{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \left(\frac{\frac{1}{2} \cdot \left(M \cdot D\right)}{d} \cdot h\right)\right) \]
                                                                            6. lower-sqrt.f6485.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{\frac{M \cdot \left(D \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(\frac{0.5 \cdot \left(M \cdot D\right)}{d} \cdot h\right)\right) \]
                                                                          10. Applied rewrites85.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{\frac{M \cdot \left(D \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(\frac{0.5 \cdot \left(M \cdot D\right)}{d} \cdot h\right)\right) \]
                                                                        3. Recombined 3 regimes into one program.
                                                                        4. Final simplification84.8%

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

                                                                        Alternative 15: 76.5% accurate, 2.7× speedup?

                                                                        \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := 1 - \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \sqrt{\frac{h}{\ell}}\\ \mathbf{if}\;d \leq -6.2 \cdot 10^{+156}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -6.6 \cdot 10^{-188}:\\ \;\;\;\;t\_0 \cdot \left(t\_1 \cdot \sqrt{\frac{d}{h}}\right)\\ \mathbf{elif}\;d \leq 2.5 \cdot 10^{-237}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_2, d \cdot t\_2\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\ \end{array} \end{array} \]
                                                                        D_m = (fabs.f64 D)
                                                                        M_m = (fabs.f64 M)
                                                                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                        (FPCore (d h l M_m D_m)
                                                                         :precision binary64
                                                                         (let* ((t_0
                                                                                 (-
                                                                                  1.0
                                                                                  (*
                                                                                   (/ (/ (* M_m (* D_m 0.5)) (* d 2.0)) l)
                                                                                   (* h (/ (* 0.5 (* M_m D_m)) d)))))
                                                                                (t_1 (sqrt (/ d l)))
                                                                                (t_2 (sqrt (/ h l))))
                                                                           (if (<= d -6.2e+156)
                                                                             (* (- d) (sqrt (/ 1.0 (* h l))))
                                                                             (if (<= d -6.6e-188)
                                                                               (* t_0 (* t_1 (sqrt (/ d h))))
                                                                               (if (<= d 2.5e-237)
                                                                                 (/
                                                                                  (fma
                                                                                   (* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
                                                                                   t_2
                                                                                   (* d t_2))
                                                                                  h)
                                                                                 (* t_0 (* t_1 (/ (sqrt d) (sqrt h)))))))))
                                                                        D_m = fabs(D);
                                                                        M_m = fabs(M);
                                                                        assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                        double code(double d, double h, double l, double M_m, double D_m) {
                                                                        	double t_0 = 1.0 - ((((M_m * (D_m * 0.5)) / (d * 2.0)) / l) * (h * ((0.5 * (M_m * D_m)) / d)));
                                                                        	double t_1 = sqrt((d / l));
                                                                        	double t_2 = sqrt((h / l));
                                                                        	double tmp;
                                                                        	if (d <= -6.2e+156) {
                                                                        		tmp = -d * sqrt((1.0 / (h * l)));
                                                                        	} else if (d <= -6.6e-188) {
                                                                        		tmp = t_0 * (t_1 * sqrt((d / h)));
                                                                        	} else if (d <= 2.5e-237) {
                                                                        		tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_2, (d * t_2)) / h;
                                                                        	} else {
                                                                        		tmp = t_0 * (t_1 * (sqrt(d) / sqrt(h)));
                                                                        	}
                                                                        	return tmp;
                                                                        }
                                                                        
                                                                        D_m = abs(D)
                                                                        M_m = abs(M)
                                                                        d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                        function code(d, h, l, M_m, D_m)
                                                                        	t_0 = Float64(1.0 - Float64(Float64(Float64(Float64(M_m * Float64(D_m * 0.5)) / Float64(d * 2.0)) / l) * Float64(h * Float64(Float64(0.5 * Float64(M_m * D_m)) / d))))
                                                                        	t_1 = sqrt(Float64(d / l))
                                                                        	t_2 = sqrt(Float64(h / l))
                                                                        	tmp = 0.0
                                                                        	if (d <= -6.2e+156)
                                                                        		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                                                        	elseif (d <= -6.6e-188)
                                                                        		tmp = Float64(t_0 * Float64(t_1 * sqrt(Float64(d / h))));
                                                                        	elseif (d <= 2.5e-237)
                                                                        		tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_2, Float64(d * t_2)) / h);
                                                                        	else
                                                                        		tmp = Float64(t_0 * Float64(t_1 * Float64(sqrt(d) / sqrt(h))));
                                                                        	end
                                                                        	return tmp
                                                                        end
                                                                        
                                                                        D_m = N[Abs[D], $MachinePrecision]
                                                                        M_m = N[Abs[M], $MachinePrecision]
                                                                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                        code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(h * N[(N[(0.5 * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -6.2e+156], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -6.6e-188], N[(t$95$0 * N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.5e-237], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$2 + N[(d * t$95$2), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$0 * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
                                                                        
                                                                        \begin{array}{l}
                                                                        D_m = \left|D\right|
                                                                        \\
                                                                        M_m = \left|M\right|
                                                                        \\
                                                                        [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                        \\
                                                                        \begin{array}{l}
                                                                        t_0 := 1 - \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\\
                                                                        t_1 := \sqrt{\frac{d}{\ell}}\\
                                                                        t_2 := \sqrt{\frac{h}{\ell}}\\
                                                                        \mathbf{if}\;d \leq -6.2 \cdot 10^{+156}:\\
                                                                        \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                                                        
                                                                        \mathbf{elif}\;d \leq -6.6 \cdot 10^{-188}:\\
                                                                        \;\;\;\;t\_0 \cdot \left(t\_1 \cdot \sqrt{\frac{d}{h}}\right)\\
                                                                        
                                                                        \mathbf{elif}\;d \leq 2.5 \cdot 10^{-237}:\\
                                                                        \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_2, d \cdot t\_2\right)}{h}\\
                                                                        
                                                                        \mathbf{else}:\\
                                                                        \;\;\;\;t\_0 \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
                                                                        
                                                                        
                                                                        \end{array}
                                                                        \end{array}
                                                                        
                                                                        Derivation
                                                                        1. Split input into 4 regimes
                                                                        2. if d < -6.2000000000000004e156

                                                                          1. Initial program 61.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. *-commutativeN/A

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

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

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

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

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

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

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

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

                                                                          if -6.2000000000000004e156 < d < -6.6000000000000005e-188

                                                                          1. Initial program 79.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. 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. 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{\frac{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
                                                                            7. 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{\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}}{\frac{\ell}{h}}\right) \]
                                                                            8. associate-*r*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}{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}\right) \]
                                                                            9. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
                                                                            10. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                            11. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                          4. 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 - \color{blue}{\frac{\frac{M \cdot \left(D \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}}\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)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                            2. lift-pow.f64N/A

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

                                                                              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                            4. unpow1/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{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                            5. lower-sqrt.f6487.4

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                          if -6.6000000000000005e-188 < d < 2.5000000000000001e-237

                                                                          1. Initial program 36.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 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 rewrites18.9%

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

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

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

                                                                              if 2.5000000000000001e-237 < d

                                                                              1. Initial program 74.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. 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{\frac{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
                                                                                7. 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{\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}}{\frac{\ell}{h}}\right) \]
                                                                                8. associate-*r*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}{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}\right) \]
                                                                                9. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
                                                                                10. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                                11. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                              4. Applied rewrites85.1%

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

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

                                                                                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                                4. unpow1/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{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                                5. lower-sqrt.f6485.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(\frac{0.5 \cdot \left(M \cdot D\right)}{d} \cdot h\right)\right) \]
                                                                            3. Recombined 4 regimes into one program.
                                                                            4. Final simplification81.6%

                                                                              \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -6.2 \cdot 10^{+156}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -6.6 \cdot 10^{-188}:\\ \;\;\;\;\left(1 - \frac{\frac{M \cdot \left(D \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M \cdot D\right)}{d}\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\ \mathbf{elif}\;d \leq 2.5 \cdot 10^{-237}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D \cdot \left(\frac{M \cdot \left(M \cdot D\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, \sqrt{\frac{h}{\ell}}, d \cdot \sqrt{\frac{h}{\ell}}\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \frac{\frac{M \cdot \left(D \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M \cdot D\right)}{d}\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\ \end{array} \]
                                                                            5. Add Preprocessing

                                                                            Alternative 16: 70.6% accurate, 2.8× speedup?

                                                                            \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \frac{\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left(\frac{\left(M\_m \cdot D\_m\right) \cdot -0.5}{\ell \cdot \left(d \cdot 2\right)}, \frac{h \cdot \left(M\_m \cdot \left(D\_m \cdot 0.5\right)\right)}{d}, 1\right)}{\sqrt{\frac{\ell}{d}}}\\ t_1 := \sqrt{\frac{h}{\ell}}\\ \mathbf{if}\;d \leq -3.7 \cdot 10^{+149}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -6.8 \cdot 10^{-132}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 4.4 \cdot 10^{-231}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_1, d \cdot t\_1\right)}{h}\\ \mathbf{elif}\;d \leq 3.2 \cdot 10^{+224}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \end{array} \]
                                                                            D_m = (fabs.f64 D)
                                                                            M_m = (fabs.f64 M)
                                                                            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                            (FPCore (d h l M_m D_m)
                                                                             :precision binary64
                                                                             (let* ((t_0
                                                                                     (/
                                                                                      (*
                                                                                       (sqrt (/ d h))
                                                                                       (fma
                                                                                        (/ (* (* M_m D_m) -0.5) (* l (* d 2.0)))
                                                                                        (/ (* h (* M_m (* D_m 0.5))) d)
                                                                                        1.0))
                                                                                      (sqrt (/ l d))))
                                                                                    (t_1 (sqrt (/ h l))))
                                                                               (if (<= d -3.7e+149)
                                                                                 (* (- d) (sqrt (/ 1.0 (* h l))))
                                                                                 (if (<= d -6.8e-132)
                                                                                   t_0
                                                                                   (if (<= d 4.4e-231)
                                                                                     (/
                                                                                      (fma
                                                                                       (* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
                                                                                       t_1
                                                                                       (* d t_1))
                                                                                      h)
                                                                                     (if (<= d 3.2e+224) t_0 (/ d (* (sqrt l) (sqrt h)))))))))
                                                                            D_m = fabs(D);
                                                                            M_m = fabs(M);
                                                                            assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                            double code(double d, double h, double l, double M_m, double D_m) {
                                                                            	double t_0 = (sqrt((d / h)) * fma((((M_m * D_m) * -0.5) / (l * (d * 2.0))), ((h * (M_m * (D_m * 0.5))) / d), 1.0)) / sqrt((l / d));
                                                                            	double t_1 = sqrt((h / l));
                                                                            	double tmp;
                                                                            	if (d <= -3.7e+149) {
                                                                            		tmp = -d * sqrt((1.0 / (h * l)));
                                                                            	} else if (d <= -6.8e-132) {
                                                                            		tmp = t_0;
                                                                            	} else if (d <= 4.4e-231) {
                                                                            		tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_1, (d * t_1)) / h;
                                                                            	} else if (d <= 3.2e+224) {
                                                                            		tmp = t_0;
                                                                            	} else {
                                                                            		tmp = d / (sqrt(l) * sqrt(h));
                                                                            	}
                                                                            	return tmp;
                                                                            }
                                                                            
                                                                            D_m = abs(D)
                                                                            M_m = abs(M)
                                                                            d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                            function code(d, h, l, M_m, D_m)
                                                                            	t_0 = Float64(Float64(sqrt(Float64(d / h)) * fma(Float64(Float64(Float64(M_m * D_m) * -0.5) / Float64(l * Float64(d * 2.0))), Float64(Float64(h * Float64(M_m * Float64(D_m * 0.5))) / d), 1.0)) / sqrt(Float64(l / d)))
                                                                            	t_1 = sqrt(Float64(h / l))
                                                                            	tmp = 0.0
                                                                            	if (d <= -3.7e+149)
                                                                            		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                                                            	elseif (d <= -6.8e-132)
                                                                            		tmp = t_0;
                                                                            	elseif (d <= 4.4e-231)
                                                                            		tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_1, Float64(d * t_1)) / h);
                                                                            	elseif (d <= 3.2e+224)
                                                                            		tmp = t_0;
                                                                            	else
                                                                            		tmp = Float64(d / Float64(sqrt(l) * sqrt(h)));
                                                                            	end
                                                                            	return tmp
                                                                            end
                                                                            
                                                                            D_m = N[Abs[D], $MachinePrecision]
                                                                            M_m = N[Abs[M], $MachinePrecision]
                                                                            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                            code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * -0.5), $MachinePrecision] / N[(l * N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -3.7e+149], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -6.8e-132], t$95$0, If[LessEqual[d, 4.4e-231], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$1 + N[(d * t$95$1), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 3.2e+224], t$95$0, N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
                                                                            
                                                                            \begin{array}{l}
                                                                            D_m = \left|D\right|
                                                                            \\
                                                                            M_m = \left|M\right|
                                                                            \\
                                                                            [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                            \\
                                                                            \begin{array}{l}
                                                                            t_0 := \frac{\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left(\frac{\left(M\_m \cdot D\_m\right) \cdot -0.5}{\ell \cdot \left(d \cdot 2\right)}, \frac{h \cdot \left(M\_m \cdot \left(D\_m \cdot 0.5\right)\right)}{d}, 1\right)}{\sqrt{\frac{\ell}{d}}}\\
                                                                            t_1 := \sqrt{\frac{h}{\ell}}\\
                                                                            \mathbf{if}\;d \leq -3.7 \cdot 10^{+149}:\\
                                                                            \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                                                            
                                                                            \mathbf{elif}\;d \leq -6.8 \cdot 10^{-132}:\\
                                                                            \;\;\;\;t\_0\\
                                                                            
                                                                            \mathbf{elif}\;d \leq 4.4 \cdot 10^{-231}:\\
                                                                            \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_1, d \cdot t\_1\right)}{h}\\
                                                                            
                                                                            \mathbf{elif}\;d \leq 3.2 \cdot 10^{+224}:\\
                                                                            \;\;\;\;t\_0\\
                                                                            
                                                                            \mathbf{else}:\\
                                                                            \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
                                                                            
                                                                            
                                                                            \end{array}
                                                                            \end{array}
                                                                            
                                                                            Derivation
                                                                            1. Split input into 4 regimes
                                                                            2. if d < -3.69999999999999978e149

                                                                              1. Initial program 61.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. *-commutativeN/A

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

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

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

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

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

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

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

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

                                                                              if -3.69999999999999978e149 < d < -6.79999999999999965e-132 or 4.40000000000000018e-231 < d < 3.20000000000000015e224

                                                                              1. Initial program 79.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 rewrites69.3%

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

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

                                                                              if -6.79999999999999965e-132 < d < 4.40000000000000018e-231

                                                                              1. Initial program 40.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 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 rewrites21.6%

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

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

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

                                                                                  if 3.20000000000000015e224 < d

                                                                                  1. Initial program 61.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 d around inf

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

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

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

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

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

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

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

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

                                                                                      \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -3.7 \cdot 10^{+149}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -6.8 \cdot 10^{-132}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left(\frac{\left(M \cdot D\right) \cdot -0.5}{\ell \cdot \left(d \cdot 2\right)}, \frac{h \cdot \left(M \cdot \left(D \cdot 0.5\right)\right)}{d}, 1\right)}{\sqrt{\frac{\ell}{d}}}\\ \mathbf{elif}\;d \leq 4.4 \cdot 10^{-231}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D \cdot \left(\frac{M \cdot \left(M \cdot D\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, \sqrt{\frac{h}{\ell}}, d \cdot \sqrt{\frac{h}{\ell}}\right)}{h}\\ \mathbf{elif}\;d \leq 3.2 \cdot 10^{+224}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left(\frac{\left(M \cdot D\right) \cdot -0.5}{\ell \cdot \left(d \cdot 2\right)}, \frac{h \cdot \left(M \cdot \left(D \cdot 0.5\right)\right)}{d}, 1\right)}{\sqrt{\frac{\ell}{d}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
                                                                                    5. Add Preprocessing

                                                                                    Alternative 17: 81.0% accurate, 2.8× speedup?

                                                                                    \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{\ell}}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := 1 - \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\\ \mathbf{if}\;d \leq -8.2 \cdot 10^{-193}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_1\right) \cdot t\_2\\ \mathbf{elif}\;d \leq 2.5 \cdot 10^{-237}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_0, d \cdot t\_0\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;t\_2 \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\ \end{array} \end{array} \]
                                                                                    D_m = (fabs.f64 D)
                                                                                    M_m = (fabs.f64 M)
                                                                                    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                    (FPCore (d h l M_m D_m)
                                                                                     :precision binary64
                                                                                     (let* ((t_0 (sqrt (/ h l)))
                                                                                            (t_1 (sqrt (/ d l)))
                                                                                            (t_2
                                                                                             (-
                                                                                              1.0
                                                                                              (*
                                                                                               (/ (/ (* M_m (* D_m 0.5)) (* d 2.0)) l)
                                                                                               (* h (/ (* 0.5 (* M_m D_m)) d))))))
                                                                                       (if (<= d -8.2e-193)
                                                                                         (* (* (/ (sqrt (- d)) (sqrt (- h))) t_1) t_2)
                                                                                         (if (<= d 2.5e-237)
                                                                                           (/
                                                                                            (fma
                                                                                             (* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
                                                                                             t_0
                                                                                             (* d t_0))
                                                                                            h)
                                                                                           (* t_2 (* t_1 (/ (sqrt d) (sqrt h))))))))
                                                                                    D_m = fabs(D);
                                                                                    M_m = fabs(M);
                                                                                    assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                                    double code(double d, double h, double l, double M_m, double D_m) {
                                                                                    	double t_0 = sqrt((h / l));
                                                                                    	double t_1 = sqrt((d / l));
                                                                                    	double t_2 = 1.0 - ((((M_m * (D_m * 0.5)) / (d * 2.0)) / l) * (h * ((0.5 * (M_m * D_m)) / d)));
                                                                                    	double tmp;
                                                                                    	if (d <= -8.2e-193) {
                                                                                    		tmp = ((sqrt(-d) / sqrt(-h)) * t_1) * t_2;
                                                                                    	} else if (d <= 2.5e-237) {
                                                                                    		tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_0, (d * t_0)) / h;
                                                                                    	} else {
                                                                                    		tmp = t_2 * (t_1 * (sqrt(d) / sqrt(h)));
                                                                                    	}
                                                                                    	return tmp;
                                                                                    }
                                                                                    
                                                                                    D_m = abs(D)
                                                                                    M_m = abs(M)
                                                                                    d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                                    function code(d, h, l, M_m, D_m)
                                                                                    	t_0 = sqrt(Float64(h / l))
                                                                                    	t_1 = sqrt(Float64(d / l))
                                                                                    	t_2 = Float64(1.0 - Float64(Float64(Float64(Float64(M_m * Float64(D_m * 0.5)) / Float64(d * 2.0)) / l) * Float64(h * Float64(Float64(0.5 * Float64(M_m * D_m)) / d))))
                                                                                    	tmp = 0.0
                                                                                    	if (d <= -8.2e-193)
                                                                                    		tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_1) * t_2);
                                                                                    	elseif (d <= 2.5e-237)
                                                                                    		tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_0, Float64(d * t_0)) / h);
                                                                                    	else
                                                                                    		tmp = Float64(t_2 * Float64(t_1 * Float64(sqrt(d) / sqrt(h))));
                                                                                    	end
                                                                                    	return tmp
                                                                                    end
                                                                                    
                                                                                    D_m = N[Abs[D], $MachinePrecision]
                                                                                    M_m = N[Abs[M], $MachinePrecision]
                                                                                    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                    code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(N[(N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(h * N[(N[(0.5 * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.2e-193], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[d, 2.5e-237], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(d * t$95$0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$2 * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
                                                                                    
                                                                                    \begin{array}{l}
                                                                                    D_m = \left|D\right|
                                                                                    \\
                                                                                    M_m = \left|M\right|
                                                                                    \\
                                                                                    [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                                    \\
                                                                                    \begin{array}{l}
                                                                                    t_0 := \sqrt{\frac{h}{\ell}}\\
                                                                                    t_1 := \sqrt{\frac{d}{\ell}}\\
                                                                                    t_2 := 1 - \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\\
                                                                                    \mathbf{if}\;d \leq -8.2 \cdot 10^{-193}:\\
                                                                                    \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_1\right) \cdot t\_2\\
                                                                                    
                                                                                    \mathbf{elif}\;d \leq 2.5 \cdot 10^{-237}:\\
                                                                                    \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_0, d \cdot t\_0\right)}{h}\\
                                                                                    
                                                                                    \mathbf{else}:\\
                                                                                    \;\;\;\;t\_2 \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
                                                                                    
                                                                                    
                                                                                    \end{array}
                                                                                    \end{array}
                                                                                    
                                                                                    Derivation
                                                                                    1. Split input into 3 regimes
                                                                                    2. if d < -8.20000000000000005e-193

                                                                                      1. Initial program 73.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. 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{\frac{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
                                                                                        7. 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{\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}}{\frac{\ell}{h}}\right) \]
                                                                                        8. associate-*r*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}{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}\right) \]
                                                                                        9. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
                                                                                        10. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                                        11. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                                      4. Applied rewrites80.1%

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

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

                                                                                          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                                        4. unpow1/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{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                                        5. lower-sqrt.f6480.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                      if -8.20000000000000005e-193 < d < 2.5000000000000001e-237

                                                                                      1. Initial program 36.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 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 rewrites18.9%

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

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

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

                                                                                          if 2.5000000000000001e-237 < d

                                                                                          1. Initial program 74.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. 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{\frac{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
                                                                                            7. 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{\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}}{\frac{\ell}{h}}\right) \]
                                                                                            8. associate-*r*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}{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}\right) \]
                                                                                            9. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
                                                                                            10. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                                            11. 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{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                                          4. Applied rewrites85.1%

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

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

                                                                                              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                                            4. unpow1/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{\frac{M \cdot \left(D \cdot \frac{1}{2}\right)}{d \cdot 2}}{\ell} \cdot \frac{\frac{M \cdot D}{d \cdot 2}}{\frac{1}{h}}\right) \]
                                                                                            5. lower-sqrt.f6485.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                            \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\frac{M \cdot \left(D \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(\frac{0.5 \cdot \left(M \cdot D\right)}{d} \cdot h\right)\right) \]
                                                                                        3. Recombined 3 regimes into one program.
                                                                                        4. Final simplification84.6%

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

                                                                                        Alternative 18: 69.3% accurate, 2.9× speedup?

                                                                                        \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := M\_m \cdot \left(D\_m \cdot 0.5\right)\\ t_2 := \frac{t\_0 \cdot \left(1 - \frac{t\_1 \cdot \left(h \cdot t\_1\right)}{d \cdot \left(\ell \cdot \left(d \cdot 2\right)\right)}\right)}{\sqrt{\frac{\ell}{d}}}\\ t_3 := \sqrt{\frac{h}{\ell}}\\ \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -7.3 \cdot 10^{-131}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;d \leq 6.6 \cdot 10^{-161}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_3, d \cdot t\_3\right)}{h}\\ \mathbf{elif}\;d \leq 4.8 \cdot 10^{+130}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_0\right) \cdot \left(1 - \left(\frac{D\_m}{d} \cdot \left(\left(M\_m \cdot M\_m\right) \cdot 0.25\right)\right) \cdot \left(\frac{D\_m}{d} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\right)\\ \end{array} \end{array} \]
                                                                                        D_m = (fabs.f64 D)
                                                                                        M_m = (fabs.f64 M)
                                                                                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                        (FPCore (d h l M_m D_m)
                                                                                         :precision binary64
                                                                                         (let* ((t_0 (sqrt (/ d h)))
                                                                                                (t_1 (* M_m (* D_m 0.5)))
                                                                                                (t_2
                                                                                                 (/
                                                                                                  (* t_0 (- 1.0 (/ (* t_1 (* h t_1)) (* d (* l (* d 2.0))))))
                                                                                                  (sqrt (/ l d))))
                                                                                                (t_3 (sqrt (/ h l))))
                                                                                           (if (<= d -1.66e+146)
                                                                                             (* (- d) (sqrt (/ 1.0 (* h l))))
                                                                                             (if (<= d -7.3e-131)
                                                                                               t_2
                                                                                               (if (<= d 6.6e-161)
                                                                                                 (/
                                                                                                  (fma
                                                                                                   (* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
                                                                                                   t_3
                                                                                                   (* d t_3))
                                                                                                  h)
                                                                                                 (if (<= d 4.8e+130)
                                                                                                   t_2
                                                                                                   (*
                                                                                                    (* (sqrt (/ d l)) t_0)
                                                                                                    (-
                                                                                                     1.0
                                                                                                     (*
                                                                                                      (* (/ D_m d) (* (* M_m M_m) 0.25))
                                                                                                      (* (/ D_m d) (* 0.5 (/ h l))))))))))))
                                                                                        D_m = fabs(D);
                                                                                        M_m = fabs(M);
                                                                                        assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                                        double code(double d, double h, double l, double M_m, double D_m) {
                                                                                        	double t_0 = sqrt((d / h));
                                                                                        	double t_1 = M_m * (D_m * 0.5);
                                                                                        	double t_2 = (t_0 * (1.0 - ((t_1 * (h * t_1)) / (d * (l * (d * 2.0)))))) / sqrt((l / d));
                                                                                        	double t_3 = sqrt((h / l));
                                                                                        	double tmp;
                                                                                        	if (d <= -1.66e+146) {
                                                                                        		tmp = -d * sqrt((1.0 / (h * l)));
                                                                                        	} else if (d <= -7.3e-131) {
                                                                                        		tmp = t_2;
                                                                                        	} else if (d <= 6.6e-161) {
                                                                                        		tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_3, (d * t_3)) / h;
                                                                                        	} else if (d <= 4.8e+130) {
                                                                                        		tmp = t_2;
                                                                                        	} else {
                                                                                        		tmp = (sqrt((d / l)) * t_0) * (1.0 - (((D_m / d) * ((M_m * M_m) * 0.25)) * ((D_m / d) * (0.5 * (h / l)))));
                                                                                        	}
                                                                                        	return tmp;
                                                                                        }
                                                                                        
                                                                                        D_m = abs(D)
                                                                                        M_m = abs(M)
                                                                                        d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                                        function code(d, h, l, M_m, D_m)
                                                                                        	t_0 = sqrt(Float64(d / h))
                                                                                        	t_1 = Float64(M_m * Float64(D_m * 0.5))
                                                                                        	t_2 = Float64(Float64(t_0 * Float64(1.0 - Float64(Float64(t_1 * Float64(h * t_1)) / Float64(d * Float64(l * Float64(d * 2.0)))))) / sqrt(Float64(l / d)))
                                                                                        	t_3 = sqrt(Float64(h / l))
                                                                                        	tmp = 0.0
                                                                                        	if (d <= -1.66e+146)
                                                                                        		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                                                                        	elseif (d <= -7.3e-131)
                                                                                        		tmp = t_2;
                                                                                        	elseif (d <= 6.6e-161)
                                                                                        		tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_3, Float64(d * t_3)) / h);
                                                                                        	elseif (d <= 4.8e+130)
                                                                                        		tmp = t_2;
                                                                                        	else
                                                                                        		tmp = Float64(Float64(sqrt(Float64(d / l)) * t_0) * Float64(1.0 - Float64(Float64(Float64(D_m / d) * Float64(Float64(M_m * M_m) * 0.25)) * Float64(Float64(D_m / d) * Float64(0.5 * Float64(h / l))))));
                                                                                        	end
                                                                                        	return tmp
                                                                                        end
                                                                                        
                                                                                        D_m = N[Abs[D], $MachinePrecision]
                                                                                        M_m = N[Abs[M], $MachinePrecision]
                                                                                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                        code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$0 * N[(1.0 - N[(N[(t$95$1 * N[(h * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.66e+146], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.3e-131], t$95$2, If[LessEqual[d, 6.6e-161], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$3 + N[(d * t$95$3), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 4.8e+130], t$95$2, N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(D$95$m / d), $MachinePrecision] * N[(N[(M$95$m * M$95$m), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
                                                                                        
                                                                                        \begin{array}{l}
                                                                                        D_m = \left|D\right|
                                                                                        \\
                                                                                        M_m = \left|M\right|
                                                                                        \\
                                                                                        [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                                        \\
                                                                                        \begin{array}{l}
                                                                                        t_0 := \sqrt{\frac{d}{h}}\\
                                                                                        t_1 := M\_m \cdot \left(D\_m \cdot 0.5\right)\\
                                                                                        t_2 := \frac{t\_0 \cdot \left(1 - \frac{t\_1 \cdot \left(h \cdot t\_1\right)}{d \cdot \left(\ell \cdot \left(d \cdot 2\right)\right)}\right)}{\sqrt{\frac{\ell}{d}}}\\
                                                                                        t_3 := \sqrt{\frac{h}{\ell}}\\
                                                                                        \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\
                                                                                        \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                                                                        
                                                                                        \mathbf{elif}\;d \leq -7.3 \cdot 10^{-131}:\\
                                                                                        \;\;\;\;t\_2\\
                                                                                        
                                                                                        \mathbf{elif}\;d \leq 6.6 \cdot 10^{-161}:\\
                                                                                        \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_3, d \cdot t\_3\right)}{h}\\
                                                                                        
                                                                                        \mathbf{elif}\;d \leq 4.8 \cdot 10^{+130}:\\
                                                                                        \;\;\;\;t\_2\\
                                                                                        
                                                                                        \mathbf{else}:\\
                                                                                        \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_0\right) \cdot \left(1 - \left(\frac{D\_m}{d} \cdot \left(\left(M\_m \cdot M\_m\right) \cdot 0.25\right)\right) \cdot \left(\frac{D\_m}{d} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\right)\\
                                                                                        
                                                                                        
                                                                                        \end{array}
                                                                                        \end{array}
                                                                                        
                                                                                        Derivation
                                                                                        1. Split input into 4 regimes
                                                                                        2. if d < -1.6600000000000001e146

                                                                                          1. Initial program 61.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. *-commutativeN/A

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

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

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

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

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

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

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

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

                                                                                          if -1.6600000000000001e146 < d < -7.3000000000000001e-131 or 6.5999999999999997e-161 < d < 4.80000000000000048e130

                                                                                          1. Initial program 82.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 rewrites75.8%

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

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

                                                                                          if -7.3000000000000001e-131 < d < 6.5999999999999997e-161

                                                                                          1. Initial program 38.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. 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 rewrites18.7%

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

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

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

                                                                                              if 4.80000000000000048e130 < d

                                                                                              1. Initial program 79.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 rewrites72.8%

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

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

                                                                                                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}}\right) \cdot \left(1 - \left(\frac{D}{d} \cdot \left(\left(M \cdot M\right) \cdot \frac{1}{4}\right)\right) \cdot \left(\frac{D}{d} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
                                                                                                4. unpow1/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 - \left(\frac{D}{d} \cdot \left(\left(M \cdot M\right) \cdot \frac{1}{4}\right)\right) \cdot \left(\frac{D}{d} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
                                                                                                5. lower-sqrt.f6472.8

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

                                                                                                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{\sqrt{\frac{d}{\ell}}}\right) \cdot \left(1 - \left(\frac{D}{d} \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)\right) \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\right) \]
                                                                                              6. 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 - \left(\frac{D}{d} \cdot \left(\left(M \cdot M\right) \cdot \frac{1}{4}\right)\right) \cdot \left(\frac{D}{d} \cdot \left(\frac{1}{2} \cdot \frac{h}{\ell}\right)\right)\right) \]
                                                                                                2. metadata-eval72.8

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

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

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

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

                                                                                              \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -7.3 \cdot 10^{-131}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}} \cdot \left(1 - \frac{\left(M \cdot \left(D \cdot 0.5\right)\right) \cdot \left(h \cdot \left(M \cdot \left(D \cdot 0.5\right)\right)\right)}{d \cdot \left(\ell \cdot \left(d \cdot 2\right)\right)}\right)}{\sqrt{\frac{\ell}{d}}}\\ \mathbf{elif}\;d \leq 6.6 \cdot 10^{-161}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D \cdot \left(\frac{M \cdot \left(M \cdot D\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, \sqrt{\frac{h}{\ell}}, d \cdot \sqrt{\frac{h}{\ell}}\right)}{h}\\ \mathbf{elif}\;d \leq 4.8 \cdot 10^{+130}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}} \cdot \left(1 - \frac{\left(M \cdot \left(D \cdot 0.5\right)\right) \cdot \left(h \cdot \left(M \cdot \left(D \cdot 0.5\right)\right)\right)}{d \cdot \left(\ell \cdot \left(d \cdot 2\right)\right)}\right)}{\sqrt{\frac{\ell}{d}}}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(\frac{D}{d} \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)\right) \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\right)\\ \end{array} \]
                                                                                            5. Add Preprocessing

                                                                                            Alternative 19: 69.6% accurate, 2.9× speedup?

                                                                                            \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := M\_m \cdot \left(D\_m \cdot 0.5\right)\\ t_1 := \frac{\sqrt{\frac{d}{h}} \cdot \left(1 - \frac{t\_0 \cdot \left(h \cdot t\_0\right)}{d \cdot \left(\ell \cdot \left(d \cdot 2\right)\right)}\right)}{\sqrt{\frac{\ell}{d}}}\\ t_2 := \sqrt{\frac{h}{\ell}}\\ \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -7.3 \cdot 10^{-131}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq 6.6 \cdot 10^{-161}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_2, d \cdot t\_2\right)}{h}\\ \mathbf{elif}\;d \leq 2.1 \cdot 10^{+191}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
                                                                                            D_m = (fabs.f64 D)
                                                                                            M_m = (fabs.f64 M)
                                                                                            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                            (FPCore (d h l M_m D_m)
                                                                                             :precision binary64
                                                                                             (let* ((t_0 (* M_m (* D_m 0.5)))
                                                                                                    (t_1
                                                                                                     (/
                                                                                                      (*
                                                                                                       (sqrt (/ d h))
                                                                                                       (- 1.0 (/ (* t_0 (* h t_0)) (* d (* l (* d 2.0))))))
                                                                                                      (sqrt (/ l d))))
                                                                                                    (t_2 (sqrt (/ h l))))
                                                                                               (if (<= d -1.66e+146)
                                                                                                 (* (- d) (sqrt (/ 1.0 (* h l))))
                                                                                                 (if (<= d -7.3e-131)
                                                                                                   t_1
                                                                                                   (if (<= d 6.6e-161)
                                                                                                     (/
                                                                                                      (fma
                                                                                                       (* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
                                                                                                       t_2
                                                                                                       (* d t_2))
                                                                                                      h)
                                                                                                     (if (<= d 2.1e+191) t_1 (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))))
                                                                                            D_m = fabs(D);
                                                                                            M_m = fabs(M);
                                                                                            assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                                            double code(double d, double h, double l, double M_m, double D_m) {
                                                                                            	double t_0 = M_m * (D_m * 0.5);
                                                                                            	double t_1 = (sqrt((d / h)) * (1.0 - ((t_0 * (h * t_0)) / (d * (l * (d * 2.0)))))) / sqrt((l / d));
                                                                                            	double t_2 = sqrt((h / l));
                                                                                            	double tmp;
                                                                                            	if (d <= -1.66e+146) {
                                                                                            		tmp = -d * sqrt((1.0 / (h * l)));
                                                                                            	} else if (d <= -7.3e-131) {
                                                                                            		tmp = t_1;
                                                                                            	} else if (d <= 6.6e-161) {
                                                                                            		tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_2, (d * t_2)) / h;
                                                                                            	} else if (d <= 2.1e+191) {
                                                                                            		tmp = t_1;
                                                                                            	} else {
                                                                                            		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
                                                                                            	}
                                                                                            	return tmp;
                                                                                            }
                                                                                            
                                                                                            D_m = abs(D)
                                                                                            M_m = abs(M)
                                                                                            d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                                            function code(d, h, l, M_m, D_m)
                                                                                            	t_0 = Float64(M_m * Float64(D_m * 0.5))
                                                                                            	t_1 = Float64(Float64(sqrt(Float64(d / h)) * Float64(1.0 - Float64(Float64(t_0 * Float64(h * t_0)) / Float64(d * Float64(l * Float64(d * 2.0)))))) / sqrt(Float64(l / d)))
                                                                                            	t_2 = sqrt(Float64(h / l))
                                                                                            	tmp = 0.0
                                                                                            	if (d <= -1.66e+146)
                                                                                            		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                                                                            	elseif (d <= -7.3e-131)
                                                                                            		tmp = t_1;
                                                                                            	elseif (d <= 6.6e-161)
                                                                                            		tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_2, Float64(d * t_2)) / h);
                                                                                            	elseif (d <= 2.1e+191)
                                                                                            		tmp = t_1;
                                                                                            	else
                                                                                            		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
                                                                                            	end
                                                                                            	return tmp
                                                                                            end
                                                                                            
                                                                                            D_m = N[Abs[D], $MachinePrecision]
                                                                                            M_m = N[Abs[M], $MachinePrecision]
                                                                                            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                            code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(t$95$0 * N[(h * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.66e+146], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.3e-131], t$95$1, If[LessEqual[d, 6.6e-161], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$2 + N[(d * t$95$2), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 2.1e+191], t$95$1, N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
                                                                                            
                                                                                            \begin{array}{l}
                                                                                            D_m = \left|D\right|
                                                                                            \\
                                                                                            M_m = \left|M\right|
                                                                                            \\
                                                                                            [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                                            \\
                                                                                            \begin{array}{l}
                                                                                            t_0 := M\_m \cdot \left(D\_m \cdot 0.5\right)\\
                                                                                            t_1 := \frac{\sqrt{\frac{d}{h}} \cdot \left(1 - \frac{t\_0 \cdot \left(h \cdot t\_0\right)}{d \cdot \left(\ell \cdot \left(d \cdot 2\right)\right)}\right)}{\sqrt{\frac{\ell}{d}}}\\
                                                                                            t_2 := \sqrt{\frac{h}{\ell}}\\
                                                                                            \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\
                                                                                            \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                                                                            
                                                                                            \mathbf{elif}\;d \leq -7.3 \cdot 10^{-131}:\\
                                                                                            \;\;\;\;t\_1\\
                                                                                            
                                                                                            \mathbf{elif}\;d \leq 6.6 \cdot 10^{-161}:\\
                                                                                            \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_2, d \cdot t\_2\right)}{h}\\
                                                                                            
                                                                                            \mathbf{elif}\;d \leq 2.1 \cdot 10^{+191}:\\
                                                                                            \;\;\;\;t\_1\\
                                                                                            
                                                                                            \mathbf{else}:\\
                                                                                            \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
                                                                                            
                                                                                            
                                                                                            \end{array}
                                                                                            \end{array}
                                                                                            
                                                                                            Derivation
                                                                                            1. Split input into 4 regimes
                                                                                            2. if d < -1.6600000000000001e146

                                                                                              1. Initial program 61.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. *-commutativeN/A

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

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

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

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

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

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

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

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

                                                                                              if -1.6600000000000001e146 < d < -7.3000000000000001e-131 or 6.5999999999999997e-161 < d < 2.1000000000000001e191

                                                                                              1. Initial program 83.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. Applied rewrites74.8%

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

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

                                                                                              if -7.3000000000000001e-131 < d < 6.5999999999999997e-161

                                                                                              1. Initial program 38.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. 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 rewrites18.7%

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

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

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

                                                                                                  if 2.1000000000000001e191 < d

                                                                                                  1. Initial program 68.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. lower-*.f64N/A

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

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

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

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

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

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

                                                                                                    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -7.3 \cdot 10^{-131}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}} \cdot \left(1 - \frac{\left(M \cdot \left(D \cdot 0.5\right)\right) \cdot \left(h \cdot \left(M \cdot \left(D \cdot 0.5\right)\right)\right)}{d \cdot \left(\ell \cdot \left(d \cdot 2\right)\right)}\right)}{\sqrt{\frac{\ell}{d}}}\\ \mathbf{elif}\;d \leq 6.6 \cdot 10^{-161}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D \cdot \left(\frac{M \cdot \left(M \cdot D\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, \sqrt{\frac{h}{\ell}}, d \cdot \sqrt{\frac{h}{\ell}}\right)}{h}\\ \mathbf{elif}\;d \leq 2.1 \cdot 10^{+191}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}} \cdot \left(1 - \frac{\left(M \cdot \left(D \cdot 0.5\right)\right) \cdot \left(h \cdot \left(M \cdot \left(D \cdot 0.5\right)\right)\right)}{d \cdot \left(\ell \cdot \left(d \cdot 2\right)\right)}\right)}{\sqrt{\frac{\ell}{d}}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]
                                                                                                  9. Add Preprocessing

                                                                                                  Alternative 20: 64.2% accurate, 3.0× speedup?

                                                                                                  \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := d \cdot \left(d \cdot 4\right)\\ t_1 := \sqrt{\frac{d}{h}}\\ t_2 := \sqrt{\frac{d}{\ell}}\\ t_3 := D\_m \cdot \left(M\_m \cdot D\_m\right)\\ t_4 := M\_m \cdot t\_3\\ \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -5.7 \cdot 10^{-133}:\\ \;\;\;\;t\_1 \cdot \left(t\_2 \cdot \mathsf{fma}\left(0.5, \frac{t\_3 \cdot \left(h \cdot M\_m\right)}{t\_0 \cdot \left(-\ell\right)}, 1\right)\right)\\ \mathbf{elif}\;d \leq 9.2 \cdot 10^{-294}:\\ \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_4 \cdot 0.125}{d}\\ \mathbf{elif}\;d \leq 1.8 \cdot 10^{-189}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{t\_4}{d} \cdot \left(h \cdot \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}}\right), -0.125, d \cdot \sqrt{\frac{h}{\ell}}\right)}{h}\\ \mathbf{elif}\;d \leq 3 \cdot 10^{+108}:\\ \;\;\;\;t\_2 \cdot \left(t\_1 \cdot \left(1 + \frac{t\_4 \cdot \left(h \cdot -0.5\right)}{\ell \cdot t\_0}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
                                                                                                  D_m = (fabs.f64 D)
                                                                                                  M_m = (fabs.f64 M)
                                                                                                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                  (FPCore (d h l M_m D_m)
                                                                                                   :precision binary64
                                                                                                   (let* ((t_0 (* d (* d 4.0)))
                                                                                                          (t_1 (sqrt (/ d h)))
                                                                                                          (t_2 (sqrt (/ d l)))
                                                                                                          (t_3 (* D_m (* M_m D_m)))
                                                                                                          (t_4 (* M_m t_3)))
                                                                                                     (if (<= d -1.66e+146)
                                                                                                       (* (- d) (sqrt (/ 1.0 (* h l))))
                                                                                                       (if (<= d -5.7e-133)
                                                                                                         (* t_1 (* t_2 (fma 0.5 (/ (* t_3 (* h M_m)) (* t_0 (- l))) 1.0)))
                                                                                                         (if (<= d 9.2e-294)
                                                                                                           (* (sqrt (/ (/ h (* l l)) l)) (/ (* t_4 0.125) d))
                                                                                                           (if (<= d 1.8e-189)
                                                                                                             (/
                                                                                                              (fma
                                                                                                               (* (/ t_4 d) (* h (sqrt (/ h (* l (* l l))))))
                                                                                                               -0.125
                                                                                                               (* d (sqrt (/ h l))))
                                                                                                              h)
                                                                                                             (if (<= d 3e+108)
                                                                                                               (* t_2 (* t_1 (+ 1.0 (/ (* t_4 (* h -0.5)) (* l t_0)))))
                                                                                                               (* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))))
                                                                                                  D_m = fabs(D);
                                                                                                  M_m = fabs(M);
                                                                                                  assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                                                  double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                  	double t_0 = d * (d * 4.0);
                                                                                                  	double t_1 = sqrt((d / h));
                                                                                                  	double t_2 = sqrt((d / l));
                                                                                                  	double t_3 = D_m * (M_m * D_m);
                                                                                                  	double t_4 = M_m * t_3;
                                                                                                  	double tmp;
                                                                                                  	if (d <= -1.66e+146) {
                                                                                                  		tmp = -d * sqrt((1.0 / (h * l)));
                                                                                                  	} else if (d <= -5.7e-133) {
                                                                                                  		tmp = t_1 * (t_2 * fma(0.5, ((t_3 * (h * M_m)) / (t_0 * -l)), 1.0));
                                                                                                  	} else if (d <= 9.2e-294) {
                                                                                                  		tmp = sqrt(((h / (l * l)) / l)) * ((t_4 * 0.125) / d);
                                                                                                  	} else if (d <= 1.8e-189) {
                                                                                                  		tmp = fma(((t_4 / d) * (h * sqrt((h / (l * (l * l)))))), -0.125, (d * sqrt((h / l)))) / h;
                                                                                                  	} else if (d <= 3e+108) {
                                                                                                  		tmp = t_2 * (t_1 * (1.0 + ((t_4 * (h * -0.5)) / (l * t_0))));
                                                                                                  	} else {
                                                                                                  		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
                                                                                                  	}
                                                                                                  	return tmp;
                                                                                                  }
                                                                                                  
                                                                                                  D_m = abs(D)
                                                                                                  M_m = abs(M)
                                                                                                  d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                                                  function code(d, h, l, M_m, D_m)
                                                                                                  	t_0 = Float64(d * Float64(d * 4.0))
                                                                                                  	t_1 = sqrt(Float64(d / h))
                                                                                                  	t_2 = sqrt(Float64(d / l))
                                                                                                  	t_3 = Float64(D_m * Float64(M_m * D_m))
                                                                                                  	t_4 = Float64(M_m * t_3)
                                                                                                  	tmp = 0.0
                                                                                                  	if (d <= -1.66e+146)
                                                                                                  		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                                                                                  	elseif (d <= -5.7e-133)
                                                                                                  		tmp = Float64(t_1 * Float64(t_2 * fma(0.5, Float64(Float64(t_3 * Float64(h * M_m)) / Float64(t_0 * Float64(-l))), 1.0)));
                                                                                                  	elseif (d <= 9.2e-294)
                                                                                                  		tmp = Float64(sqrt(Float64(Float64(h / Float64(l * l)) / l)) * Float64(Float64(t_4 * 0.125) / d));
                                                                                                  	elseif (d <= 1.8e-189)
                                                                                                  		tmp = Float64(fma(Float64(Float64(t_4 / d) * Float64(h * sqrt(Float64(h / Float64(l * Float64(l * l)))))), -0.125, Float64(d * sqrt(Float64(h / l)))) / h);
                                                                                                  	elseif (d <= 3e+108)
                                                                                                  		tmp = Float64(t_2 * Float64(t_1 * Float64(1.0 + Float64(Float64(t_4 * Float64(h * -0.5)) / Float64(l * t_0)))));
                                                                                                  	else
                                                                                                  		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
                                                                                                  	end
                                                                                                  	return tmp
                                                                                                  end
                                                                                                  
                                                                                                  D_m = N[Abs[D], $MachinePrecision]
                                                                                                  M_m = N[Abs[M], $MachinePrecision]
                                                                                                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                  code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(M$95$m * t$95$3), $MachinePrecision]}, If[LessEqual[d, -1.66e+146], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.7e-133], N[(t$95$1 * N[(t$95$2 * N[(0.5 * N[(N[(t$95$3 * N[(h * M$95$m), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * (-l)), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.2e-294], N[(N[Sqrt[N[(N[(h / N[(l * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$4 * 0.125), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.8e-189], N[(N[(N[(N[(t$95$4 / d), $MachinePrecision] * N[(h * N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125 + N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 3e+108], N[(t$95$2 * N[(t$95$1 * N[(1.0 + N[(N[(t$95$4 * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
                                                                                                  
                                                                                                  \begin{array}{l}
                                                                                                  D_m = \left|D\right|
                                                                                                  \\
                                                                                                  M_m = \left|M\right|
                                                                                                  \\
                                                                                                  [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                                                  \\
                                                                                                  \begin{array}{l}
                                                                                                  t_0 := d \cdot \left(d \cdot 4\right)\\
                                                                                                  t_1 := \sqrt{\frac{d}{h}}\\
                                                                                                  t_2 := \sqrt{\frac{d}{\ell}}\\
                                                                                                  t_3 := D\_m \cdot \left(M\_m \cdot D\_m\right)\\
                                                                                                  t_4 := M\_m \cdot t\_3\\
                                                                                                  \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\
                                                                                                  \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                                                                                  
                                                                                                  \mathbf{elif}\;d \leq -5.7 \cdot 10^{-133}:\\
                                                                                                  \;\;\;\;t\_1 \cdot \left(t\_2 \cdot \mathsf{fma}\left(0.5, \frac{t\_3 \cdot \left(h \cdot M\_m\right)}{t\_0 \cdot \left(-\ell\right)}, 1\right)\right)\\
                                                                                                  
                                                                                                  \mathbf{elif}\;d \leq 9.2 \cdot 10^{-294}:\\
                                                                                                  \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_4 \cdot 0.125}{d}\\
                                                                                                  
                                                                                                  \mathbf{elif}\;d \leq 1.8 \cdot 10^{-189}:\\
                                                                                                  \;\;\;\;\frac{\mathsf{fma}\left(\frac{t\_4}{d} \cdot \left(h \cdot \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}}\right), -0.125, d \cdot \sqrt{\frac{h}{\ell}}\right)}{h}\\
                                                                                                  
                                                                                                  \mathbf{elif}\;d \leq 3 \cdot 10^{+108}:\\
                                                                                                  \;\;\;\;t\_2 \cdot \left(t\_1 \cdot \left(1 + \frac{t\_4 \cdot \left(h \cdot -0.5\right)}{\ell \cdot t\_0}\right)\right)\\
                                                                                                  
                                                                                                  \mathbf{else}:\\
                                                                                                  \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
                                                                                                  
                                                                                                  
                                                                                                  \end{array}
                                                                                                  \end{array}
                                                                                                  
                                                                                                  Derivation
                                                                                                  1. Split input into 6 regimes
                                                                                                  2. if d < -1.6600000000000001e146

                                                                                                    1. Initial program 61.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. *-commutativeN/A

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

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

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

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

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

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

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

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

                                                                                                    if -1.6600000000000001e146 < d < -5.6999999999999997e-133

                                                                                                    1. Initial program 82.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 rewrites57.3%

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

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

                                                                                                    if -5.6999999999999997e-133 < d < 9.20000000000000064e-294

                                                                                                    1. Initial program 37.8%

                                                                                                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                                                    2. Add Preprocessing
                                                                                                    3. Applied rewrites2.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                      \[\leadsto \color{blue}{\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d}\right)} \]
                                                                                                    7. Step-by-step derivation
                                                                                                      1. Applied rewrites30.8%

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

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

                                                                                                        if 9.20000000000000064e-294 < d < 1.80000000000000008e-189

                                                                                                        1. Initial program 41.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. 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 rewrites24.6%

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

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

                                                                                                          if 1.80000000000000008e-189 < d < 2.99999999999999984e108

                                                                                                          1. Initial program 77.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 rewrites69.0%

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

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

                                                                                                          if 2.99999999999999984e108 < d

                                                                                                          1. Initial program 78.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. lower-*.f64N/A

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

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

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

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

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

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

                                                                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -5.7 \cdot 10^{-133}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(0.5, \frac{\left(D \cdot \left(M \cdot D\right)\right) \cdot \left(h \cdot M\right)}{\left(d \cdot \left(d \cdot 4\right)\right) \cdot \left(-\ell\right)}, 1\right)\right)\\ \mathbf{elif}\;d \leq 9.2 \cdot 10^{-294}:\\ \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot 0.125}{d}\\ \mathbf{elif}\;d \leq 1.8 \cdot 10^{-189}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{M \cdot \left(D \cdot \left(M \cdot D\right)\right)}{d} \cdot \left(h \cdot \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}}\right), -0.125, d \cdot \sqrt{\frac{h}{\ell}}\right)}{h}\\ \mathbf{elif}\;d \leq 3 \cdot 10^{+108}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]
                                                                                                          9. Add Preprocessing

                                                                                                          Alternative 21: 63.6% accurate, 3.0× speedup?

                                                                                                          \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := d \cdot \left(d \cdot 4\right)\\ t_1 := \sqrt{\frac{d}{h}}\\ t_2 := \sqrt{\frac{d}{\ell}}\\ t_3 := D\_m \cdot \left(M\_m \cdot D\_m\right)\\ t_4 := M\_m \cdot t\_3\\ \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -5.7 \cdot 10^{-133}:\\ \;\;\;\;t\_1 \cdot \left(t\_2 \cdot \mathsf{fma}\left(0.5, \frac{t\_3 \cdot \left(h \cdot M\_m\right)}{t\_0 \cdot \left(-\ell\right)}, 1\right)\right)\\ \mathbf{elif}\;d \leq 9.2 \cdot 10^{-302}:\\ \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_4 \cdot 0.125}{d}\\ \mathbf{elif}\;d \leq 1.15 \cdot 10^{-231}:\\ \;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot \frac{-0.125 \cdot \left(M\_m \cdot M\_m\right)}{d}\right)\\ \mathbf{elif}\;d \leq 3 \cdot 10^{+108}:\\ \;\;\;\;t\_2 \cdot \left(t\_1 \cdot \left(1 + \frac{t\_4 \cdot \left(h \cdot -0.5\right)}{\ell \cdot t\_0}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
                                                                                                          D_m = (fabs.f64 D)
                                                                                                          M_m = (fabs.f64 M)
                                                                                                          NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                          (FPCore (d h l M_m D_m)
                                                                                                           :precision binary64
                                                                                                           (let* ((t_0 (* d (* d 4.0)))
                                                                                                                  (t_1 (sqrt (/ d h)))
                                                                                                                  (t_2 (sqrt (/ d l)))
                                                                                                                  (t_3 (* D_m (* M_m D_m)))
                                                                                                                  (t_4 (* M_m t_3)))
                                                                                                             (if (<= d -1.66e+146)
                                                                                                               (* (- d) (sqrt (/ 1.0 (* h l))))
                                                                                                               (if (<= d -5.7e-133)
                                                                                                                 (* t_1 (* t_2 (fma 0.5 (/ (* t_3 (* h M_m)) (* t_0 (- l))) 1.0)))
                                                                                                                 (if (<= d 9.2e-302)
                                                                                                                   (* (sqrt (/ (/ h (* l l)) l)) (/ (* t_4 0.125) d))
                                                                                                                   (if (<= d 1.15e-231)
                                                                                                                     (*
                                                                                                                      (sqrt (/ h (* l (* l l))))
                                                                                                                      (* (* D_m D_m) (/ (* -0.125 (* M_m M_m)) d)))
                                                                                                                     (if (<= d 3e+108)
                                                                                                                       (* t_2 (* t_1 (+ 1.0 (/ (* t_4 (* h -0.5)) (* l t_0)))))
                                                                                                                       (* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))))
                                                                                                          D_m = fabs(D);
                                                                                                          M_m = fabs(M);
                                                                                                          assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                                                          double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                          	double t_0 = d * (d * 4.0);
                                                                                                          	double t_1 = sqrt((d / h));
                                                                                                          	double t_2 = sqrt((d / l));
                                                                                                          	double t_3 = D_m * (M_m * D_m);
                                                                                                          	double t_4 = M_m * t_3;
                                                                                                          	double tmp;
                                                                                                          	if (d <= -1.66e+146) {
                                                                                                          		tmp = -d * sqrt((1.0 / (h * l)));
                                                                                                          	} else if (d <= -5.7e-133) {
                                                                                                          		tmp = t_1 * (t_2 * fma(0.5, ((t_3 * (h * M_m)) / (t_0 * -l)), 1.0));
                                                                                                          	} else if (d <= 9.2e-302) {
                                                                                                          		tmp = sqrt(((h / (l * l)) / l)) * ((t_4 * 0.125) / d);
                                                                                                          	} else if (d <= 1.15e-231) {
                                                                                                          		tmp = sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d));
                                                                                                          	} else if (d <= 3e+108) {
                                                                                                          		tmp = t_2 * (t_1 * (1.0 + ((t_4 * (h * -0.5)) / (l * t_0))));
                                                                                                          	} else {
                                                                                                          		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
                                                                                                          	}
                                                                                                          	return tmp;
                                                                                                          }
                                                                                                          
                                                                                                          D_m = abs(D)
                                                                                                          M_m = abs(M)
                                                                                                          d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                                                          function code(d, h, l, M_m, D_m)
                                                                                                          	t_0 = Float64(d * Float64(d * 4.0))
                                                                                                          	t_1 = sqrt(Float64(d / h))
                                                                                                          	t_2 = sqrt(Float64(d / l))
                                                                                                          	t_3 = Float64(D_m * Float64(M_m * D_m))
                                                                                                          	t_4 = Float64(M_m * t_3)
                                                                                                          	tmp = 0.0
                                                                                                          	if (d <= -1.66e+146)
                                                                                                          		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                                                                                          	elseif (d <= -5.7e-133)
                                                                                                          		tmp = Float64(t_1 * Float64(t_2 * fma(0.5, Float64(Float64(t_3 * Float64(h * M_m)) / Float64(t_0 * Float64(-l))), 1.0)));
                                                                                                          	elseif (d <= 9.2e-302)
                                                                                                          		tmp = Float64(sqrt(Float64(Float64(h / Float64(l * l)) / l)) * Float64(Float64(t_4 * 0.125) / d));
                                                                                                          	elseif (d <= 1.15e-231)
                                                                                                          		tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(Float64(D_m * D_m) * Float64(Float64(-0.125 * Float64(M_m * M_m)) / d)));
                                                                                                          	elseif (d <= 3e+108)
                                                                                                          		tmp = Float64(t_2 * Float64(t_1 * Float64(1.0 + Float64(Float64(t_4 * Float64(h * -0.5)) / Float64(l * t_0)))));
                                                                                                          	else
                                                                                                          		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
                                                                                                          	end
                                                                                                          	return tmp
                                                                                                          end
                                                                                                          
                                                                                                          D_m = N[Abs[D], $MachinePrecision]
                                                                                                          M_m = N[Abs[M], $MachinePrecision]
                                                                                                          NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                          code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(M$95$m * t$95$3), $MachinePrecision]}, If[LessEqual[d, -1.66e+146], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.7e-133], N[(t$95$1 * N[(t$95$2 * N[(0.5 * N[(N[(t$95$3 * N[(h * M$95$m), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * (-l)), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.2e-302], N[(N[Sqrt[N[(N[(h / N[(l * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$4 * 0.125), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-231], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(-0.125 * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3e+108], N[(t$95$2 * N[(t$95$1 * N[(1.0 + N[(N[(t$95$4 * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
                                                                                                          
                                                                                                          \begin{array}{l}
                                                                                                          D_m = \left|D\right|
                                                                                                          \\
                                                                                                          M_m = \left|M\right|
                                                                                                          \\
                                                                                                          [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                                                          \\
                                                                                                          \begin{array}{l}
                                                                                                          t_0 := d \cdot \left(d \cdot 4\right)\\
                                                                                                          t_1 := \sqrt{\frac{d}{h}}\\
                                                                                                          t_2 := \sqrt{\frac{d}{\ell}}\\
                                                                                                          t_3 := D\_m \cdot \left(M\_m \cdot D\_m\right)\\
                                                                                                          t_4 := M\_m \cdot t\_3\\
                                                                                                          \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\
                                                                                                          \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                                                                                          
                                                                                                          \mathbf{elif}\;d \leq -5.7 \cdot 10^{-133}:\\
                                                                                                          \;\;\;\;t\_1 \cdot \left(t\_2 \cdot \mathsf{fma}\left(0.5, \frac{t\_3 \cdot \left(h \cdot M\_m\right)}{t\_0 \cdot \left(-\ell\right)}, 1\right)\right)\\
                                                                                                          
                                                                                                          \mathbf{elif}\;d \leq 9.2 \cdot 10^{-302}:\\
                                                                                                          \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_4 \cdot 0.125}{d}\\
                                                                                                          
                                                                                                          \mathbf{elif}\;d \leq 1.15 \cdot 10^{-231}:\\
                                                                                                          \;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot \frac{-0.125 \cdot \left(M\_m \cdot M\_m\right)}{d}\right)\\
                                                                                                          
                                                                                                          \mathbf{elif}\;d \leq 3 \cdot 10^{+108}:\\
                                                                                                          \;\;\;\;t\_2 \cdot \left(t\_1 \cdot \left(1 + \frac{t\_4 \cdot \left(h \cdot -0.5\right)}{\ell \cdot t\_0}\right)\right)\\
                                                                                                          
                                                                                                          \mathbf{else}:\\
                                                                                                          \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
                                                                                                          
                                                                                                          
                                                                                                          \end{array}
                                                                                                          \end{array}
                                                                                                          
                                                                                                          Derivation
                                                                                                          1. Split input into 6 regimes
                                                                                                          2. if d < -1.6600000000000001e146

                                                                                                            1. Initial program 61.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. *-commutativeN/A

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

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

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

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

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

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

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

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

                                                                                                            if -1.6600000000000001e146 < d < -5.6999999999999997e-133

                                                                                                            1. Initial program 82.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 rewrites57.3%

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

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

                                                                                                            if -5.6999999999999997e-133 < d < 9.20000000000000007e-302

                                                                                                            1. Initial program 38.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. Applied rewrites2.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                              \[\leadsto \color{blue}{\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d}\right)} \]
                                                                                                            7. Step-by-step derivation
                                                                                                              1. Applied rewrites31.5%

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

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

                                                                                                                if 9.20000000000000007e-302 < d < 1.15e-231

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                                if 1.15e-231 < d < 2.99999999999999984e108

                                                                                                                1. Initial program 74.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. Applied rewrites66.1%

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

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

                                                                                                                if 2.99999999999999984e108 < d

                                                                                                                1. Initial program 78.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. lower-*.f64N/A

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

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

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

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

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

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

                                                                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -5.7 \cdot 10^{-133}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(0.5, \frac{\left(D \cdot \left(M \cdot D\right)\right) \cdot \left(h \cdot M\right)}{\left(d \cdot \left(d \cdot 4\right)\right) \cdot \left(-\ell\right)}, 1\right)\right)\\ \mathbf{elif}\;d \leq 9.2 \cdot 10^{-302}:\\ \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot 0.125}{d}\\ \mathbf{elif}\;d \leq 1.15 \cdot 10^{-231}:\\ \;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(D \cdot D\right) \cdot \frac{-0.125 \cdot \left(M \cdot M\right)}{d}\right)\\ \mathbf{elif}\;d \leq 3 \cdot 10^{+108}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]
                                                                                                                9. Add Preprocessing

                                                                                                                Alternative 22: 63.8% accurate, 3.0× speedup?

                                                                                                                \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)\\ t_1 := \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{t\_0 \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)\right)\\ \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -5.7 \cdot 10^{-133}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq 9.2 \cdot 10^{-302}:\\ \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_0 \cdot 0.125}{d}\\ \mathbf{elif}\;d \leq 1.15 \cdot 10^{-231}:\\ \;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot \frac{-0.125 \cdot \left(M\_m \cdot M\_m\right)}{d}\right)\\ \mathbf{elif}\;d \leq 3 \cdot 10^{+108}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
                                                                                                                D_m = (fabs.f64 D)
                                                                                                                M_m = (fabs.f64 M)
                                                                                                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                (FPCore (d h l M_m D_m)
                                                                                                                 :precision binary64
                                                                                                                 (let* ((t_0 (* M_m (* D_m (* M_m D_m))))
                                                                                                                        (t_1
                                                                                                                         (*
                                                                                                                          (sqrt (/ d l))
                                                                                                                          (*
                                                                                                                           (sqrt (/ d h))
                                                                                                                           (+ 1.0 (/ (* t_0 (* h -0.5)) (* l (* d (* d 4.0)))))))))
                                                                                                                   (if (<= d -1.66e+146)
                                                                                                                     (* (- d) (sqrt (/ 1.0 (* h l))))
                                                                                                                     (if (<= d -5.7e-133)
                                                                                                                       t_1
                                                                                                                       (if (<= d 9.2e-302)
                                                                                                                         (* (sqrt (/ (/ h (* l l)) l)) (/ (* t_0 0.125) d))
                                                                                                                         (if (<= d 1.15e-231)
                                                                                                                           (*
                                                                                                                            (sqrt (/ h (* l (* l l))))
                                                                                                                            (* (* D_m D_m) (/ (* -0.125 (* M_m M_m)) d)))
                                                                                                                           (if (<= d 3e+108) t_1 (* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))))
                                                                                                                D_m = fabs(D);
                                                                                                                M_m = fabs(M);
                                                                                                                assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                                                                double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                                	double t_0 = M_m * (D_m * (M_m * D_m));
                                                                                                                	double t_1 = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0))))));
                                                                                                                	double tmp;
                                                                                                                	if (d <= -1.66e+146) {
                                                                                                                		tmp = -d * sqrt((1.0 / (h * l)));
                                                                                                                	} else if (d <= -5.7e-133) {
                                                                                                                		tmp = t_1;
                                                                                                                	} else if (d <= 9.2e-302) {
                                                                                                                		tmp = sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d);
                                                                                                                	} else if (d <= 1.15e-231) {
                                                                                                                		tmp = sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d));
                                                                                                                	} else if (d <= 3e+108) {
                                                                                                                		tmp = t_1;
                                                                                                                	} else {
                                                                                                                		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
                                                                                                                	}
                                                                                                                	return tmp;
                                                                                                                }
                                                                                                                
                                                                                                                D_m = abs(d)
                                                                                                                M_m = abs(m)
                                                                                                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                real(8) function code(d, h, l, m_m, d_m)
                                                                                                                    real(8), intent (in) :: d
                                                                                                                    real(8), intent (in) :: h
                                                                                                                    real(8), intent (in) :: l
                                                                                                                    real(8), intent (in) :: m_m
                                                                                                                    real(8), intent (in) :: d_m
                                                                                                                    real(8) :: t_0
                                                                                                                    real(8) :: t_1
                                                                                                                    real(8) :: tmp
                                                                                                                    t_0 = m_m * (d_m * (m_m * d_m))
                                                                                                                    t_1 = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((t_0 * (h * (-0.5d0))) / (l * (d * (d * 4.0d0))))))
                                                                                                                    if (d <= (-1.66d+146)) then
                                                                                                                        tmp = -d * sqrt((1.0d0 / (h * l)))
                                                                                                                    else if (d <= (-5.7d-133)) then
                                                                                                                        tmp = t_1
                                                                                                                    else if (d <= 9.2d-302) then
                                                                                                                        tmp = sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125d0) / d)
                                                                                                                    else if (d <= 1.15d-231) then
                                                                                                                        tmp = sqrt((h / (l * (l * l)))) * ((d_m * d_m) * (((-0.125d0) * (m_m * m_m)) / d))
                                                                                                                    else if (d <= 3d+108) then
                                                                                                                        tmp = t_1
                                                                                                                    else
                                                                                                                        tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
                                                                                                                    end if
                                                                                                                    code = tmp
                                                                                                                end function
                                                                                                                
                                                                                                                D_m = Math.abs(D);
                                                                                                                M_m = Math.abs(M);
                                                                                                                assert d < h && h < l && l < M_m && M_m < D_m;
                                                                                                                public static double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                                	double t_0 = M_m * (D_m * (M_m * D_m));
                                                                                                                	double t_1 = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0))))));
                                                                                                                	double tmp;
                                                                                                                	if (d <= -1.66e+146) {
                                                                                                                		tmp = -d * Math.sqrt((1.0 / (h * l)));
                                                                                                                	} else if (d <= -5.7e-133) {
                                                                                                                		tmp = t_1;
                                                                                                                	} else if (d <= 9.2e-302) {
                                                                                                                		tmp = Math.sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d);
                                                                                                                	} else if (d <= 1.15e-231) {
                                                                                                                		tmp = Math.sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d));
                                                                                                                	} else if (d <= 3e+108) {
                                                                                                                		tmp = t_1;
                                                                                                                	} else {
                                                                                                                		tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
                                                                                                                	}
                                                                                                                	return tmp;
                                                                                                                }
                                                                                                                
                                                                                                                D_m = math.fabs(D)
                                                                                                                M_m = math.fabs(M)
                                                                                                                [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                                                                                                                def code(d, h, l, M_m, D_m):
                                                                                                                	t_0 = M_m * (D_m * (M_m * D_m))
                                                                                                                	t_1 = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0))))))
                                                                                                                	tmp = 0
                                                                                                                	if d <= -1.66e+146:
                                                                                                                		tmp = -d * math.sqrt((1.0 / (h * l)))
                                                                                                                	elif d <= -5.7e-133:
                                                                                                                		tmp = t_1
                                                                                                                	elif d <= 9.2e-302:
                                                                                                                		tmp = math.sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d)
                                                                                                                	elif d <= 1.15e-231:
                                                                                                                		tmp = math.sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d))
                                                                                                                	elif d <= 3e+108:
                                                                                                                		tmp = t_1
                                                                                                                	else:
                                                                                                                		tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l))
                                                                                                                	return tmp
                                                                                                                
                                                                                                                D_m = abs(D)
                                                                                                                M_m = abs(M)
                                                                                                                d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                                                                function code(d, h, l, M_m, D_m)
                                                                                                                	t_0 = Float64(M_m * Float64(D_m * Float64(M_m * D_m)))
                                                                                                                	t_1 = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(t_0 * Float64(h * -0.5)) / Float64(l * Float64(d * Float64(d * 4.0)))))))
                                                                                                                	tmp = 0.0
                                                                                                                	if (d <= -1.66e+146)
                                                                                                                		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                                                                                                	elseif (d <= -5.7e-133)
                                                                                                                		tmp = t_1;
                                                                                                                	elseif (d <= 9.2e-302)
                                                                                                                		tmp = Float64(sqrt(Float64(Float64(h / Float64(l * l)) / l)) * Float64(Float64(t_0 * 0.125) / d));
                                                                                                                	elseif (d <= 1.15e-231)
                                                                                                                		tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(Float64(D_m * D_m) * Float64(Float64(-0.125 * Float64(M_m * M_m)) / d)));
                                                                                                                	elseif (d <= 3e+108)
                                                                                                                		tmp = t_1;
                                                                                                                	else
                                                                                                                		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
                                                                                                                	end
                                                                                                                	return tmp
                                                                                                                end
                                                                                                                
                                                                                                                D_m = abs(D);
                                                                                                                M_m = abs(M);
                                                                                                                d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                                                                                                                function tmp_2 = code(d, h, l, M_m, D_m)
                                                                                                                	t_0 = M_m * (D_m * (M_m * D_m));
                                                                                                                	t_1 = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0))))));
                                                                                                                	tmp = 0.0;
                                                                                                                	if (d <= -1.66e+146)
                                                                                                                		tmp = -d * sqrt((1.0 / (h * l)));
                                                                                                                	elseif (d <= -5.7e-133)
                                                                                                                		tmp = t_1;
                                                                                                                	elseif (d <= 9.2e-302)
                                                                                                                		tmp = sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d);
                                                                                                                	elseif (d <= 1.15e-231)
                                                                                                                		tmp = sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d));
                                                                                                                	elseif (d <= 3e+108)
                                                                                                                		tmp = t_1;
                                                                                                                	else
                                                                                                                		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
                                                                                                                	end
                                                                                                                	tmp_2 = tmp;
                                                                                                                end
                                                                                                                
                                                                                                                D_m = N[Abs[D], $MachinePrecision]
                                                                                                                M_m = N[Abs[M], $MachinePrecision]
                                                                                                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(M$95$m * N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(t$95$0 * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.66e+146], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.7e-133], t$95$1, If[LessEqual[d, 9.2e-302], N[(N[Sqrt[N[(N[(h / N[(l * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 * 0.125), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-231], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(-0.125 * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3e+108], t$95$1, N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
                                                                                                                
                                                                                                                \begin{array}{l}
                                                                                                                D_m = \left|D\right|
                                                                                                                \\
                                                                                                                M_m = \left|M\right|
                                                                                                                \\
                                                                                                                [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                                                                \\
                                                                                                                \begin{array}{l}
                                                                                                                t_0 := M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)\\
                                                                                                                t_1 := \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{t\_0 \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)\right)\\
                                                                                                                \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\
                                                                                                                \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                                                                                                
                                                                                                                \mathbf{elif}\;d \leq -5.7 \cdot 10^{-133}:\\
                                                                                                                \;\;\;\;t\_1\\
                                                                                                                
                                                                                                                \mathbf{elif}\;d \leq 9.2 \cdot 10^{-302}:\\
                                                                                                                \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_0 \cdot 0.125}{d}\\
                                                                                                                
                                                                                                                \mathbf{elif}\;d \leq 1.15 \cdot 10^{-231}:\\
                                                                                                                \;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot \frac{-0.125 \cdot \left(M\_m \cdot M\_m\right)}{d}\right)\\
                                                                                                                
                                                                                                                \mathbf{elif}\;d \leq 3 \cdot 10^{+108}:\\
                                                                                                                \;\;\;\;t\_1\\
                                                                                                                
                                                                                                                \mathbf{else}:\\
                                                                                                                \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
                                                                                                                
                                                                                                                
                                                                                                                \end{array}
                                                                                                                \end{array}
                                                                                                                
                                                                                                                Derivation
                                                                                                                1. Split input into 5 regimes
                                                                                                                2. if d < -1.6600000000000001e146

                                                                                                                  1. Initial program 61.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. *-commutativeN/A

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

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

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

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

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

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

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

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

                                                                                                                  if -1.6600000000000001e146 < d < -5.6999999999999997e-133 or 1.15e-231 < d < 2.99999999999999984e108

                                                                                                                  1. Initial program 78.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. Applied rewrites71.4%

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

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

                                                                                                                  if -5.6999999999999997e-133 < d < 9.20000000000000007e-302

                                                                                                                  1. Initial program 38.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. Applied rewrites2.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                                    \[\leadsto \color{blue}{\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d}\right)} \]
                                                                                                                  7. Step-by-step derivation
                                                                                                                    1. Applied rewrites31.5%

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

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

                                                                                                                      if 9.20000000000000007e-302 < d < 1.15e-231

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                                      if 2.99999999999999984e108 < d

                                                                                                                      1. Initial program 78.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. lower-*.f64N/A

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

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

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

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

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

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

                                                                                                                        \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -5.7 \cdot 10^{-133}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)\right)\\ \mathbf{elif}\;d \leq 9.2 \cdot 10^{-302}:\\ \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot 0.125}{d}\\ \mathbf{elif}\;d \leq 1.15 \cdot 10^{-231}:\\ \;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(D \cdot D\right) \cdot \frac{-0.125 \cdot \left(M \cdot M\right)}{d}\right)\\ \mathbf{elif}\;d \leq 3 \cdot 10^{+108}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]
                                                                                                                      9. Add Preprocessing

                                                                                                                      Alternative 23: 65.5% accurate, 3.3× speedup?

                                                                                                                      \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{\ell}}\\ \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -7.3 \cdot 10^{-131}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(0.5, \frac{\left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right) \cdot \left(h \cdot M\_m\right)}{\left(d \cdot \left(d \cdot 4\right)\right) \cdot \left(-\ell\right)}, 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_0, d \cdot t\_0\right)}{h}\\ \end{array} \end{array} \]
                                                                                                                      D_m = (fabs.f64 D)
                                                                                                                      M_m = (fabs.f64 M)
                                                                                                                      NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                      (FPCore (d h l M_m D_m)
                                                                                                                       :precision binary64
                                                                                                                       (let* ((t_0 (sqrt (/ h l))))
                                                                                                                         (if (<= d -1.66e+146)
                                                                                                                           (* (- d) (sqrt (/ 1.0 (* h l))))
                                                                                                                           (if (<= d -7.3e-131)
                                                                                                                             (*
                                                                                                                              (sqrt (/ d h))
                                                                                                                              (*
                                                                                                                               (sqrt (/ d l))
                                                                                                                               (fma
                                                                                                                                0.5
                                                                                                                                (/ (* (* D_m (* M_m D_m)) (* h M_m)) (* (* d (* d 4.0)) (- l)))
                                                                                                                                1.0)))
                                                                                                                             (/
                                                                                                                              (fma
                                                                                                                               (* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
                                                                                                                               t_0
                                                                                                                               (* d t_0))
                                                                                                                              h)))))
                                                                                                                      D_m = fabs(D);
                                                                                                                      M_m = fabs(M);
                                                                                                                      assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                                                                      double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                                      	double t_0 = sqrt((h / l));
                                                                                                                      	double tmp;
                                                                                                                      	if (d <= -1.66e+146) {
                                                                                                                      		tmp = -d * sqrt((1.0 / (h * l)));
                                                                                                                      	} else if (d <= -7.3e-131) {
                                                                                                                      		tmp = sqrt((d / h)) * (sqrt((d / l)) * fma(0.5, (((D_m * (M_m * D_m)) * (h * M_m)) / ((d * (d * 4.0)) * -l)), 1.0));
                                                                                                                      	} else {
                                                                                                                      		tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_0, (d * t_0)) / h;
                                                                                                                      	}
                                                                                                                      	return tmp;
                                                                                                                      }
                                                                                                                      
                                                                                                                      D_m = abs(D)
                                                                                                                      M_m = abs(M)
                                                                                                                      d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                                                                      function code(d, h, l, M_m, D_m)
                                                                                                                      	t_0 = sqrt(Float64(h / l))
                                                                                                                      	tmp = 0.0
                                                                                                                      	if (d <= -1.66e+146)
                                                                                                                      		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                                                                                                      	elseif (d <= -7.3e-131)
                                                                                                                      		tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * fma(0.5, Float64(Float64(Float64(D_m * Float64(M_m * D_m)) * Float64(h * M_m)) / Float64(Float64(d * Float64(d * 4.0)) * Float64(-l))), 1.0)));
                                                                                                                      	else
                                                                                                                      		tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_0, Float64(d * t_0)) / h);
                                                                                                                      	end
                                                                                                                      	return tmp
                                                                                                                      end
                                                                                                                      
                                                                                                                      D_m = N[Abs[D], $MachinePrecision]
                                                                                                                      M_m = N[Abs[M], $MachinePrecision]
                                                                                                                      NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                      code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.66e+146], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.3e-131], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(0.5 * N[(N[(N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(h * M$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision] * (-l)), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(d * t$95$0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]]
                                                                                                                      
                                                                                                                      \begin{array}{l}
                                                                                                                      D_m = \left|D\right|
                                                                                                                      \\
                                                                                                                      M_m = \left|M\right|
                                                                                                                      \\
                                                                                                                      [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                                                                      \\
                                                                                                                      \begin{array}{l}
                                                                                                                      t_0 := \sqrt{\frac{h}{\ell}}\\
                                                                                                                      \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\
                                                                                                                      \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                                                                                                      
                                                                                                                      \mathbf{elif}\;d \leq -7.3 \cdot 10^{-131}:\\
                                                                                                                      \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(0.5, \frac{\left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right) \cdot \left(h \cdot M\_m\right)}{\left(d \cdot \left(d \cdot 4\right)\right) \cdot \left(-\ell\right)}, 1\right)\right)\\
                                                                                                                      
                                                                                                                      \mathbf{else}:\\
                                                                                                                      \;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_0, d \cdot t\_0\right)}{h}\\
                                                                                                                      
                                                                                                                      
                                                                                                                      \end{array}
                                                                                                                      \end{array}
                                                                                                                      
                                                                                                                      Derivation
                                                                                                                      1. Split input into 3 regimes
                                                                                                                      2. if d < -1.6600000000000001e146

                                                                                                                        1. Initial program 61.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. *-commutativeN/A

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

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

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

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

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

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

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

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

                                                                                                                        if -1.6600000000000001e146 < d < -7.3000000000000001e-131

                                                                                                                        1. Initial program 82.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 rewrites57.3%

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

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

                                                                                                                        if -7.3000000000000001e-131 < d

                                                                                                                        1. Initial program 61.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. 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 rewrites24.2%

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

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

                                                                                                                              \[\leadsto \frac{\mathsf{fma}\left(\left(D \cdot \left(\frac{M \cdot \left(M \cdot D\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, \sqrt{\frac{h}{\ell}}, d \cdot \sqrt{\frac{h}{\ell}}\right)}{h} \]
                                                                                                                          3. Recombined 3 regimes into one program.
                                                                                                                          4. Final simplification68.3%

                                                                                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -7.3 \cdot 10^{-131}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(0.5, \frac{\left(D \cdot \left(M \cdot D\right)\right) \cdot \left(h \cdot M\right)}{\left(d \cdot \left(d \cdot 4\right)\right) \cdot \left(-\ell\right)}, 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(D \cdot \left(\frac{M \cdot \left(M \cdot D\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, \sqrt{\frac{h}{\ell}}, d \cdot \sqrt{\frac{h}{\ell}}\right)}{h}\\ \end{array} \]
                                                                                                                          5. Add Preprocessing

                                                                                                                          Alternative 24: 60.6% accurate, 3.8× speedup?

                                                                                                                          \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)\\ \mathbf{if}\;d \leq -1.65 \cdot 10^{+146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -2.15 \cdot 10^{-156}:\\ \;\;\;\;\mathsf{fma}\left(\frac{t\_0}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \sqrt{\frac{d \cdot d}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 3.5 \cdot 10^{-246}:\\ \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_0 \cdot 0.125}{d}\\ \mathbf{elif}\;d \leq 3 \cdot 10^{+113}:\\ \;\;\;\;\frac{d \cdot \left(1 + \frac{t\_0 \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
                                                                                                                          D_m = (fabs.f64 D)
                                                                                                                          M_m = (fabs.f64 M)
                                                                                                                          NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                          (FPCore (d h l M_m D_m)
                                                                                                                           :precision binary64
                                                                                                                           (let* ((t_0 (* M_m (* D_m (* M_m D_m)))))
                                                                                                                             (if (<= d -1.65e+146)
                                                                                                                               (* (- d) (sqrt (/ 1.0 (* h l))))
                                                                                                                               (if (<= d -2.15e-156)
                                                                                                                                 (*
                                                                                                                                  (fma (/ t_0 (* 4.0 (* d d))) (* (/ h l) -0.5) 1.0)
                                                                                                                                  (sqrt (/ (* d d) (* h l))))
                                                                                                                                 (if (<= d 3.5e-246)
                                                                                                                                   (* (sqrt (/ (/ h (* l l)) l)) (/ (* t_0 0.125) d))
                                                                                                                                   (if (<= d 3e+113)
                                                                                                                                     (/
                                                                                                                                      (* d (+ 1.0 (/ (* t_0 (* h -0.5)) (* l (* d (* d 4.0))))))
                                                                                                                                      (sqrt (* h l)))
                                                                                                                                     (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))))
                                                                                                                          D_m = fabs(D);
                                                                                                                          M_m = fabs(M);
                                                                                                                          assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                                                                          double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                                          	double t_0 = M_m * (D_m * (M_m * D_m));
                                                                                                                          	double tmp;
                                                                                                                          	if (d <= -1.65e+146) {
                                                                                                                          		tmp = -d * sqrt((1.0 / (h * l)));
                                                                                                                          	} else if (d <= -2.15e-156) {
                                                                                                                          		tmp = fma((t_0 / (4.0 * (d * d))), ((h / l) * -0.5), 1.0) * sqrt(((d * d) / (h * l)));
                                                                                                                          	} else if (d <= 3.5e-246) {
                                                                                                                          		tmp = sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d);
                                                                                                                          	} else if (d <= 3e+113) {
                                                                                                                          		tmp = (d * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0)))))) / sqrt((h * l));
                                                                                                                          	} else {
                                                                                                                          		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
                                                                                                                          	}
                                                                                                                          	return tmp;
                                                                                                                          }
                                                                                                                          
                                                                                                                          D_m = abs(D)
                                                                                                                          M_m = abs(M)
                                                                                                                          d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                                                                          function code(d, h, l, M_m, D_m)
                                                                                                                          	t_0 = Float64(M_m * Float64(D_m * Float64(M_m * D_m)))
                                                                                                                          	tmp = 0.0
                                                                                                                          	if (d <= -1.65e+146)
                                                                                                                          		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                                                                                                          	elseif (d <= -2.15e-156)
                                                                                                                          		tmp = Float64(fma(Float64(t_0 / Float64(4.0 * Float64(d * d))), Float64(Float64(h / l) * -0.5), 1.0) * sqrt(Float64(Float64(d * d) / Float64(h * l))));
                                                                                                                          	elseif (d <= 3.5e-246)
                                                                                                                          		tmp = Float64(sqrt(Float64(Float64(h / Float64(l * l)) / l)) * Float64(Float64(t_0 * 0.125) / d));
                                                                                                                          	elseif (d <= 3e+113)
                                                                                                                          		tmp = Float64(Float64(d * Float64(1.0 + Float64(Float64(t_0 * Float64(h * -0.5)) / Float64(l * Float64(d * Float64(d * 4.0)))))) / sqrt(Float64(h * l)));
                                                                                                                          	else
                                                                                                                          		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
                                                                                                                          	end
                                                                                                                          	return tmp
                                                                                                                          end
                                                                                                                          
                                                                                                                          D_m = N[Abs[D], $MachinePrecision]
                                                                                                                          M_m = N[Abs[M], $MachinePrecision]
                                                                                                                          NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                          code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(M$95$m * N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.65e+146], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.15e-156], N[(N[(N[(t$95$0 / N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d * d), $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.5e-246], N[(N[Sqrt[N[(N[(h / N[(l * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 * 0.125), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3e+113], N[(N[(d * N[(1.0 + N[(N[(t$95$0 * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
                                                                                                                          
                                                                                                                          \begin{array}{l}
                                                                                                                          D_m = \left|D\right|
                                                                                                                          \\
                                                                                                                          M_m = \left|M\right|
                                                                                                                          \\
                                                                                                                          [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                                                                          \\
                                                                                                                          \begin{array}{l}
                                                                                                                          t_0 := M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)\\
                                                                                                                          \mathbf{if}\;d \leq -1.65 \cdot 10^{+146}:\\
                                                                                                                          \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                                                                                                          
                                                                                                                          \mathbf{elif}\;d \leq -2.15 \cdot 10^{-156}:\\
                                                                                                                          \;\;\;\;\mathsf{fma}\left(\frac{t\_0}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \sqrt{\frac{d \cdot d}{h \cdot \ell}}\\
                                                                                                                          
                                                                                                                          \mathbf{elif}\;d \leq 3.5 \cdot 10^{-246}:\\
                                                                                                                          \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_0 \cdot 0.125}{d}\\
                                                                                                                          
                                                                                                                          \mathbf{elif}\;d \leq 3 \cdot 10^{+113}:\\
                                                                                                                          \;\;\;\;\frac{d \cdot \left(1 + \frac{t\_0 \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)}{\sqrt{h \cdot \ell}}\\
                                                                                                                          
                                                                                                                          \mathbf{else}:\\
                                                                                                                          \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
                                                                                                                          
                                                                                                                          
                                                                                                                          \end{array}
                                                                                                                          \end{array}
                                                                                                                          
                                                                                                                          Derivation
                                                                                                                          1. Split input into 5 regimes
                                                                                                                          2. if d < -1.65000000000000008e146

                                                                                                                            1. Initial program 61.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. *-commutativeN/A

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

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

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

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

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

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

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

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

                                                                                                                            if -1.65000000000000008e146 < d < -2.14999999999999989e-156

                                                                                                                            1. Initial program 81.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 rewrites57.6%

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

                                                                                                                            if -2.14999999999999989e-156 < d < 3.5000000000000002e-246

                                                                                                                            1. Initial program 37.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. Applied rewrites0.0%

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

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

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

                                                                                                                                \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right)} \]
                                                                                                                              3. lower-*.f64N/A

                                                                                                                                \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right)} \]
                                                                                                                              4. lower-sqrt.f64N/A

                                                                                                                                \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                              5. lower-/.f64N/A

                                                                                                                                \[\leadsto \sqrt{\color{blue}{\frac{h}{{\ell}^{3}}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                              6. cube-multN/A

                                                                                                                                \[\leadsto \sqrt{\frac{h}{\color{blue}{\ell \cdot \left(\ell \cdot \ell\right)}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                              7. unpow2N/A

                                                                                                                                \[\leadsto \sqrt{\frac{h}{\ell \cdot \color{blue}{{\ell}^{2}}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                              8. lower-*.f64N/A

                                                                                                                                \[\leadsto \sqrt{\frac{h}{\color{blue}{\ell \cdot {\ell}^{2}}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                              9. unpow2N/A

                                                                                                                                \[\leadsto \sqrt{\frac{h}{\ell \cdot \color{blue}{\left(\ell \cdot \ell\right)}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                              10. lower-*.f64N/A

                                                                                                                                \[\leadsto \sqrt{\frac{h}{\ell \cdot \color{blue}{\left(\ell \cdot \ell\right)}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                              11. metadata-evalN/A

                                                                                                                                \[\leadsto \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{8}\right)\right)} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                              12. distribute-lft-neg-inN/A

                                                                                                                                \[\leadsto \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right)\right)} \]
                                                                                                                              13. associate-/l*N/A

                                                                                                                                \[\leadsto \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\mathsf{neg}\left(\frac{1}{8} \cdot \color{blue}{\left({D}^{2} \cdot \frac{{M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}}{d}\right)}\right)\right) \]
                                                                                                                              14. associate-*r*N/A

                                                                                                                                \[\leadsto \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\frac{1}{8} \cdot {D}^{2}\right) \cdot \frac{{M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}}{d}}\right)\right) \]
                                                                                                                              15. distribute-rgt-neg-inN/A

                                                                                                                                \[\leadsto \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \color{blue}{\left(\left(\frac{1}{8} \cdot {D}^{2}\right) \cdot \left(\mathsf{neg}\left(\frac{{M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}}{d}\right)\right)\right)} \]
                                                                                                                            6. Applied rewrites28.4%

                                                                                                                              \[\leadsto \color{blue}{\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d}\right)} \]
                                                                                                                            7. Step-by-step derivation
                                                                                                                              1. Applied rewrites28.5%

                                                                                                                                \[\leadsto \sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \left(\left(\color{blue}{0.125} \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d}\right) \]
                                                                                                                              2. Step-by-step derivation
                                                                                                                                1. Applied rewrites41.5%

                                                                                                                                  \[\leadsto \sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{0.125 \cdot \left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right)}{\color{blue}{d}} \]

                                                                                                                                if 3.5000000000000002e-246 < d < 3e113

                                                                                                                                1. Initial program 73.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 rewrites64.7%

                                                                                                                                  \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left(\frac{M \cdot \left(D \cdot \left(M \cdot D\right)\right)}{\left(d \cdot d\right) \cdot 4}, -0.5 \cdot \frac{h}{\ell}, 1\right)}{\sqrt{\frac{\ell}{d}}}} \]
                                                                                                                                4. Applied rewrites64.6%

                                                                                                                                  \[\leadsto \color{blue}{\frac{\left(1 + \frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot \left(h \cdot -0.5\right)}{\left(d \cdot \left(d \cdot 4\right)\right) \cdot \ell}\right) \cdot d}{\sqrt{h \cdot \ell}}} \]

                                                                                                                                if 3e113 < 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. Taylor expanded in d around inf

                                                                                                                                  \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                4. Step-by-step derivation
                                                                                                                                  1. lower-*.f64N/A

                                                                                                                                    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                  2. lower-sqrt.f64N/A

                                                                                                                                    \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                  3. lower-/.f64N/A

                                                                                                                                    \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                  4. lower-*.f6459.2

                                                                                                                                    \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
                                                                                                                                5. Applied rewrites59.2%

                                                                                                                                  \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                6. Step-by-step derivation
                                                                                                                                  1. Applied rewrites73.2%

                                                                                                                                    \[\leadsto d \cdot \frac{\sqrt{\frac{1}{h}}}{\color{blue}{\sqrt{\ell}}} \]
                                                                                                                                7. Recombined 5 regimes into one program.
                                                                                                                                8. Final simplification60.8%

                                                                                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.65 \cdot 10^{+146}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq -2.15 \cdot 10^{-156}:\\ \;\;\;\;\mathsf{fma}\left(\frac{M \cdot \left(D \cdot \left(M \cdot D\right)\right)}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \sqrt{\frac{d \cdot d}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 3.5 \cdot 10^{-246}:\\ \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot 0.125}{d}\\ \mathbf{elif}\;d \leq 3 \cdot 10^{+113}:\\ \;\;\;\;\frac{d \cdot \left(1 + \frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]
                                                                                                                                9. Add Preprocessing

                                                                                                                                Alternative 25: 57.0% accurate, 4.0× speedup?

                                                                                                                                \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)\\ \mathbf{if}\;d \leq -1.9 \cdot 10^{+45}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 3.5 \cdot 10^{-246}:\\ \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_0 \cdot 0.125}{d}\\ \mathbf{elif}\;d \leq 3 \cdot 10^{+113}:\\ \;\;\;\;\frac{d \cdot \left(1 + \frac{t\_0 \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \end{array} \]
                                                                                                                                D_m = (fabs.f64 D)
                                                                                                                                M_m = (fabs.f64 M)
                                                                                                                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                (FPCore (d h l M_m D_m)
                                                                                                                                 :precision binary64
                                                                                                                                 (let* ((t_0 (* M_m (* D_m (* M_m D_m)))))
                                                                                                                                   (if (<= d -1.9e+45)
                                                                                                                                     (* (- d) (sqrt (/ 1.0 (* h l))))
                                                                                                                                     (if (<= d 3.5e-246)
                                                                                                                                       (* (sqrt (/ (/ h (* l l)) l)) (/ (* t_0 0.125) d))
                                                                                                                                       (if (<= d 3e+113)
                                                                                                                                         (/
                                                                                                                                          (* d (+ 1.0 (/ (* t_0 (* h -0.5)) (* l (* d (* d 4.0))))))
                                                                                                                                          (sqrt (* h l)))
                                                                                                                                         (* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))
                                                                                                                                D_m = fabs(D);
                                                                                                                                M_m = fabs(M);
                                                                                                                                assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                                                                                double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                                                	double t_0 = M_m * (D_m * (M_m * D_m));
                                                                                                                                	double tmp;
                                                                                                                                	if (d <= -1.9e+45) {
                                                                                                                                		tmp = -d * sqrt((1.0 / (h * l)));
                                                                                                                                	} else if (d <= 3.5e-246) {
                                                                                                                                		tmp = sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d);
                                                                                                                                	} else if (d <= 3e+113) {
                                                                                                                                		tmp = (d * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0)))))) / sqrt((h * l));
                                                                                                                                	} else {
                                                                                                                                		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
                                                                                                                                	}
                                                                                                                                	return tmp;
                                                                                                                                }
                                                                                                                                
                                                                                                                                D_m = abs(d)
                                                                                                                                M_m = abs(m)
                                                                                                                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                real(8) function code(d, h, l, m_m, d_m)
                                                                                                                                    real(8), intent (in) :: d
                                                                                                                                    real(8), intent (in) :: h
                                                                                                                                    real(8), intent (in) :: l
                                                                                                                                    real(8), intent (in) :: m_m
                                                                                                                                    real(8), intent (in) :: d_m
                                                                                                                                    real(8) :: t_0
                                                                                                                                    real(8) :: tmp
                                                                                                                                    t_0 = m_m * (d_m * (m_m * d_m))
                                                                                                                                    if (d <= (-1.9d+45)) then
                                                                                                                                        tmp = -d * sqrt((1.0d0 / (h * l)))
                                                                                                                                    else if (d <= 3.5d-246) then
                                                                                                                                        tmp = sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125d0) / d)
                                                                                                                                    else if (d <= 3d+113) then
                                                                                                                                        tmp = (d * (1.0d0 + ((t_0 * (h * (-0.5d0))) / (l * (d * (d * 4.0d0)))))) / sqrt((h * l))
                                                                                                                                    else
                                                                                                                                        tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
                                                                                                                                    end if
                                                                                                                                    code = tmp
                                                                                                                                end function
                                                                                                                                
                                                                                                                                D_m = Math.abs(D);
                                                                                                                                M_m = Math.abs(M);
                                                                                                                                assert d < h && h < l && l < M_m && M_m < D_m;
                                                                                                                                public static double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                                                	double t_0 = M_m * (D_m * (M_m * D_m));
                                                                                                                                	double tmp;
                                                                                                                                	if (d <= -1.9e+45) {
                                                                                                                                		tmp = -d * Math.sqrt((1.0 / (h * l)));
                                                                                                                                	} else if (d <= 3.5e-246) {
                                                                                                                                		tmp = Math.sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d);
                                                                                                                                	} else if (d <= 3e+113) {
                                                                                                                                		tmp = (d * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0)))))) / Math.sqrt((h * l));
                                                                                                                                	} else {
                                                                                                                                		tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
                                                                                                                                	}
                                                                                                                                	return tmp;
                                                                                                                                }
                                                                                                                                
                                                                                                                                D_m = math.fabs(D)
                                                                                                                                M_m = math.fabs(M)
                                                                                                                                [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                                                                                                                                def code(d, h, l, M_m, D_m):
                                                                                                                                	t_0 = M_m * (D_m * (M_m * D_m))
                                                                                                                                	tmp = 0
                                                                                                                                	if d <= -1.9e+45:
                                                                                                                                		tmp = -d * math.sqrt((1.0 / (h * l)))
                                                                                                                                	elif d <= 3.5e-246:
                                                                                                                                		tmp = math.sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d)
                                                                                                                                	elif d <= 3e+113:
                                                                                                                                		tmp = (d * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0)))))) / math.sqrt((h * l))
                                                                                                                                	else:
                                                                                                                                		tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l))
                                                                                                                                	return tmp
                                                                                                                                
                                                                                                                                D_m = abs(D)
                                                                                                                                M_m = abs(M)
                                                                                                                                d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                                                                                function code(d, h, l, M_m, D_m)
                                                                                                                                	t_0 = Float64(M_m * Float64(D_m * Float64(M_m * D_m)))
                                                                                                                                	tmp = 0.0
                                                                                                                                	if (d <= -1.9e+45)
                                                                                                                                		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                                                                                                                	elseif (d <= 3.5e-246)
                                                                                                                                		tmp = Float64(sqrt(Float64(Float64(h / Float64(l * l)) / l)) * Float64(Float64(t_0 * 0.125) / d));
                                                                                                                                	elseif (d <= 3e+113)
                                                                                                                                		tmp = Float64(Float64(d * Float64(1.0 + Float64(Float64(t_0 * Float64(h * -0.5)) / Float64(l * Float64(d * Float64(d * 4.0)))))) / sqrt(Float64(h * l)));
                                                                                                                                	else
                                                                                                                                		tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l)));
                                                                                                                                	end
                                                                                                                                	return tmp
                                                                                                                                end
                                                                                                                                
                                                                                                                                D_m = abs(D);
                                                                                                                                M_m = abs(M);
                                                                                                                                d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                                                                                                                                function tmp_2 = code(d, h, l, M_m, D_m)
                                                                                                                                	t_0 = M_m * (D_m * (M_m * D_m));
                                                                                                                                	tmp = 0.0;
                                                                                                                                	if (d <= -1.9e+45)
                                                                                                                                		tmp = -d * sqrt((1.0 / (h * l)));
                                                                                                                                	elseif (d <= 3.5e-246)
                                                                                                                                		tmp = sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d);
                                                                                                                                	elseif (d <= 3e+113)
                                                                                                                                		tmp = (d * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0)))))) / sqrt((h * l));
                                                                                                                                	else
                                                                                                                                		tmp = d * (sqrt((1.0 / h)) / sqrt(l));
                                                                                                                                	end
                                                                                                                                	tmp_2 = tmp;
                                                                                                                                end
                                                                                                                                
                                                                                                                                D_m = N[Abs[D], $MachinePrecision]
                                                                                                                                M_m = N[Abs[M], $MachinePrecision]
                                                                                                                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(M$95$m * N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.9e+45], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.5e-246], N[(N[Sqrt[N[(N[(h / N[(l * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 * 0.125), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3e+113], N[(N[(d * N[(1.0 + N[(N[(t$95$0 * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
                                                                                                                                
                                                                                                                                \begin{array}{l}
                                                                                                                                D_m = \left|D\right|
                                                                                                                                \\
                                                                                                                                M_m = \left|M\right|
                                                                                                                                \\
                                                                                                                                [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                                                                                \\
                                                                                                                                \begin{array}{l}
                                                                                                                                t_0 := M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)\\
                                                                                                                                \mathbf{if}\;d \leq -1.9 \cdot 10^{+45}:\\
                                                                                                                                \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                                                                                                                
                                                                                                                                \mathbf{elif}\;d \leq 3.5 \cdot 10^{-246}:\\
                                                                                                                                \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_0 \cdot 0.125}{d}\\
                                                                                                                                
                                                                                                                                \mathbf{elif}\;d \leq 3 \cdot 10^{+113}:\\
                                                                                                                                \;\;\;\;\frac{d \cdot \left(1 + \frac{t\_0 \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)}{\sqrt{h \cdot \ell}}\\
                                                                                                                                
                                                                                                                                \mathbf{else}:\\
                                                                                                                                \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
                                                                                                                                
                                                                                                                                
                                                                                                                                \end{array}
                                                                                                                                \end{array}
                                                                                                                                
                                                                                                                                Derivation
                                                                                                                                1. Split input into 4 regimes
                                                                                                                                2. if d < -1.9000000000000001e45

                                                                                                                                  1. Initial program 70.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. 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. *-commutativeN/A

                                                                                                                                      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-1 \cdot d\right)} \]
                                                                                                                                    5. lower-*.f64N/A

                                                                                                                                      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-1 \cdot d\right)} \]
                                                                                                                                    6. lower-sqrt.f64N/A

                                                                                                                                      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
                                                                                                                                    7. lower-/.f64N/A

                                                                                                                                      \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
                                                                                                                                    8. lower-*.f64N/A

                                                                                                                                      \[\leadsto \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
                                                                                                                                    9. mul-1-negN/A

                                                                                                                                      \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                                                                                                                                    10. lower-neg.f6468.0

                                                                                                                                      \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(-d\right)} \]
                                                                                                                                  5. Applied rewrites68.0%

                                                                                                                                    \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]

                                                                                                                                  if -1.9000000000000001e45 < d < 3.5000000000000002e-246

                                                                                                                                  1. Initial program 56.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 rewrites26.5%

                                                                                                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(\sqrt{\frac{d \cdot d}{h \cdot \ell}} \cdot 0.5, \frac{\frac{M \cdot \left(D \cdot \left(M \cdot D\right)\right)}{\left(d \cdot d\right) \cdot 4} \cdot \left(-h\right)}{\ell}, \sqrt{\frac{d \cdot d}{h \cdot \ell}}\right)} \]
                                                                                                                                  4. Taylor expanded in h around -inf

                                                                                                                                    \[\leadsto \color{blue}{\frac{-1}{8} \cdot \left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
                                                                                                                                  5. Step-by-step derivation
                                                                                                                                    1. associate-*r*N/A

                                                                                                                                      \[\leadsto \color{blue}{\left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
                                                                                                                                    2. *-commutativeN/A

                                                                                                                                      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right)} \]
                                                                                                                                    3. lower-*.f64N/A

                                                                                                                                      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right)} \]
                                                                                                                                    4. lower-sqrt.f64N/A

                                                                                                                                      \[\leadsto \color{blue}{\sqrt{\frac{h}{{\ell}^{3}}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                                    5. lower-/.f64N/A

                                                                                                                                      \[\leadsto \sqrt{\color{blue}{\frac{h}{{\ell}^{3}}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                                    6. cube-multN/A

                                                                                                                                      \[\leadsto \sqrt{\frac{h}{\color{blue}{\ell \cdot \left(\ell \cdot \ell\right)}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                                    7. unpow2N/A

                                                                                                                                      \[\leadsto \sqrt{\frac{h}{\ell \cdot \color{blue}{{\ell}^{2}}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                                    8. lower-*.f64N/A

                                                                                                                                      \[\leadsto \sqrt{\frac{h}{\color{blue}{\ell \cdot {\ell}^{2}}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                                    9. unpow2N/A

                                                                                                                                      \[\leadsto \sqrt{\frac{h}{\ell \cdot \color{blue}{\left(\ell \cdot \ell\right)}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                                    10. lower-*.f64N/A

                                                                                                                                      \[\leadsto \sqrt{\frac{h}{\ell \cdot \color{blue}{\left(\ell \cdot \ell\right)}}} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                                    11. metadata-evalN/A

                                                                                                                                      \[\leadsto \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{8}\right)\right)} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \]
                                                                                                                                    12. distribute-lft-neg-inN/A

                                                                                                                                      \[\leadsto \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right)\right)} \]
                                                                                                                                    13. associate-/l*N/A

                                                                                                                                      \[\leadsto \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\mathsf{neg}\left(\frac{1}{8} \cdot \color{blue}{\left({D}^{2} \cdot \frac{{M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}}{d}\right)}\right)\right) \]
                                                                                                                                    14. associate-*r*N/A

                                                                                                                                      \[\leadsto \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\frac{1}{8} \cdot {D}^{2}\right) \cdot \frac{{M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}}{d}}\right)\right) \]
                                                                                                                                    15. distribute-rgt-neg-inN/A

                                                                                                                                      \[\leadsto \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \color{blue}{\left(\left(\frac{1}{8} \cdot {D}^{2}\right) \cdot \left(\mathsf{neg}\left(\frac{{M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}}{d}\right)\right)\right)} \]
                                                                                                                                  6. Applied rewrites30.5%

                                                                                                                                    \[\leadsto \color{blue}{\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d}\right)} \]
                                                                                                                                  7. Step-by-step derivation
                                                                                                                                    1. Applied rewrites31.6%

                                                                                                                                      \[\leadsto \sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \left(\left(\color{blue}{0.125} \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d}\right) \]
                                                                                                                                    2. Step-by-step derivation
                                                                                                                                      1. Applied rewrites41.9%

                                                                                                                                        \[\leadsto \sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{0.125 \cdot \left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right)}{\color{blue}{d}} \]

                                                                                                                                      if 3.5000000000000002e-246 < d < 3e113

                                                                                                                                      1. Initial program 73.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 rewrites64.7%

                                                                                                                                        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left(\frac{M \cdot \left(D \cdot \left(M \cdot D\right)\right)}{\left(d \cdot d\right) \cdot 4}, -0.5 \cdot \frac{h}{\ell}, 1\right)}{\sqrt{\frac{\ell}{d}}}} \]
                                                                                                                                      4. Applied rewrites64.6%

                                                                                                                                        \[\leadsto \color{blue}{\frac{\left(1 + \frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot \left(h \cdot -0.5\right)}{\left(d \cdot \left(d \cdot 4\right)\right) \cdot \ell}\right) \cdot d}{\sqrt{h \cdot \ell}}} \]

                                                                                                                                      if 3e113 < 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. Taylor expanded in d around inf

                                                                                                                                        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                      4. Step-by-step derivation
                                                                                                                                        1. lower-*.f64N/A

                                                                                                                                          \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                        2. lower-sqrt.f64N/A

                                                                                                                                          \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                        3. lower-/.f64N/A

                                                                                                                                          \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                        4. lower-*.f6459.2

                                                                                                                                          \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
                                                                                                                                      5. Applied rewrites59.2%

                                                                                                                                        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                      6. Step-by-step derivation
                                                                                                                                        1. Applied rewrites73.2%

                                                                                                                                          \[\leadsto d \cdot \frac{\sqrt{\frac{1}{h}}}{\color{blue}{\sqrt{\ell}}} \]
                                                                                                                                      7. Recombined 4 regimes into one program.
                                                                                                                                      8. Final simplification57.8%

                                                                                                                                        \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.9 \cdot 10^{+45}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{elif}\;d \leq 3.5 \cdot 10^{-246}:\\ \;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot 0.125}{d}\\ \mathbf{elif}\;d \leq 3 \cdot 10^{+113}:\\ \;\;\;\;\frac{d \cdot \left(1 + \frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\ \end{array} \]
                                                                                                                                      9. Add Preprocessing

                                                                                                                                      Alternative 26: 46.8% accurate, 9.6× speedup?

                                                                                                                                      \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 5.5 \cdot 10^{-262}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \end{array} \]
                                                                                                                                      D_m = (fabs.f64 D)
                                                                                                                                      M_m = (fabs.f64 M)
                                                                                                                                      NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                      (FPCore (d h l M_m D_m)
                                                                                                                                       :precision binary64
                                                                                                                                       (if (<= l 5.5e-262)
                                                                                                                                         (* (- d) (sqrt (/ 1.0 (* h l))))
                                                                                                                                         (/ d (* (sqrt l) (sqrt h)))))
                                                                                                                                      D_m = fabs(D);
                                                                                                                                      M_m = fabs(M);
                                                                                                                                      assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                                                                                      double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                                                      	double tmp;
                                                                                                                                      	if (l <= 5.5e-262) {
                                                                                                                                      		tmp = -d * sqrt((1.0 / (h * l)));
                                                                                                                                      	} else {
                                                                                                                                      		tmp = d / (sqrt(l) * sqrt(h));
                                                                                                                                      	}
                                                                                                                                      	return tmp;
                                                                                                                                      }
                                                                                                                                      
                                                                                                                                      D_m = abs(d)
                                                                                                                                      M_m = abs(m)
                                                                                                                                      NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                      real(8) function code(d, h, l, m_m, d_m)
                                                                                                                                          real(8), intent (in) :: d
                                                                                                                                          real(8), intent (in) :: h
                                                                                                                                          real(8), intent (in) :: l
                                                                                                                                          real(8), intent (in) :: m_m
                                                                                                                                          real(8), intent (in) :: d_m
                                                                                                                                          real(8) :: tmp
                                                                                                                                          if (l <= 5.5d-262) then
                                                                                                                                              tmp = -d * sqrt((1.0d0 / (h * l)))
                                                                                                                                          else
                                                                                                                                              tmp = d / (sqrt(l) * sqrt(h))
                                                                                                                                          end if
                                                                                                                                          code = tmp
                                                                                                                                      end function
                                                                                                                                      
                                                                                                                                      D_m = Math.abs(D);
                                                                                                                                      M_m = Math.abs(M);
                                                                                                                                      assert d < h && h < l && l < M_m && M_m < D_m;
                                                                                                                                      public static double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                                                      	double tmp;
                                                                                                                                      	if (l <= 5.5e-262) {
                                                                                                                                      		tmp = -d * Math.sqrt((1.0 / (h * l)));
                                                                                                                                      	} else {
                                                                                                                                      		tmp = d / (Math.sqrt(l) * Math.sqrt(h));
                                                                                                                                      	}
                                                                                                                                      	return tmp;
                                                                                                                                      }
                                                                                                                                      
                                                                                                                                      D_m = math.fabs(D)
                                                                                                                                      M_m = math.fabs(M)
                                                                                                                                      [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                                                                                                                                      def code(d, h, l, M_m, D_m):
                                                                                                                                      	tmp = 0
                                                                                                                                      	if l <= 5.5e-262:
                                                                                                                                      		tmp = -d * math.sqrt((1.0 / (h * l)))
                                                                                                                                      	else:
                                                                                                                                      		tmp = d / (math.sqrt(l) * math.sqrt(h))
                                                                                                                                      	return tmp
                                                                                                                                      
                                                                                                                                      D_m = abs(D)
                                                                                                                                      M_m = abs(M)
                                                                                                                                      d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                                                                                      function code(d, h, l, M_m, D_m)
                                                                                                                                      	tmp = 0.0
                                                                                                                                      	if (l <= 5.5e-262)
                                                                                                                                      		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                                                                                                                      	else
                                                                                                                                      		tmp = Float64(d / Float64(sqrt(l) * sqrt(h)));
                                                                                                                                      	end
                                                                                                                                      	return tmp
                                                                                                                                      end
                                                                                                                                      
                                                                                                                                      D_m = abs(D);
                                                                                                                                      M_m = abs(M);
                                                                                                                                      d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                                                                                                                                      function tmp_2 = code(d, h, l, M_m, D_m)
                                                                                                                                      	tmp = 0.0;
                                                                                                                                      	if (l <= 5.5e-262)
                                                                                                                                      		tmp = -d * sqrt((1.0 / (h * l)));
                                                                                                                                      	else
                                                                                                                                      		tmp = d / (sqrt(l) * sqrt(h));
                                                                                                                                      	end
                                                                                                                                      	tmp_2 = tmp;
                                                                                                                                      end
                                                                                                                                      
                                                                                                                                      D_m = N[Abs[D], $MachinePrecision]
                                                                                                                                      M_m = N[Abs[M], $MachinePrecision]
                                                                                                                                      NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                      code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 5.5e-262], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                                                                                                      
                                                                                                                                      \begin{array}{l}
                                                                                                                                      D_m = \left|D\right|
                                                                                                                                      \\
                                                                                                                                      M_m = \left|M\right|
                                                                                                                                      \\
                                                                                                                                      [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                                                                                      \\
                                                                                                                                      \begin{array}{l}
                                                                                                                                      \mathbf{if}\;\ell \leq 5.5 \cdot 10^{-262}:\\
                                                                                                                                      \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                                                                                                                      
                                                                                                                                      \mathbf{else}:\\
                                                                                                                                      \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
                                                                                                                                      
                                                                                                                                      
                                                                                                                                      \end{array}
                                                                                                                                      \end{array}
                                                                                                                                      
                                                                                                                                      Derivation
                                                                                                                                      1. Split input into 2 regimes
                                                                                                                                      2. if l < 5.5000000000000004e-262

                                                                                                                                        1. Initial program 65.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 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. *-commutativeN/A

                                                                                                                                            \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-1 \cdot d\right)} \]
                                                                                                                                          5. lower-*.f64N/A

                                                                                                                                            \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-1 \cdot d\right)} \]
                                                                                                                                          6. lower-sqrt.f64N/A

                                                                                                                                            \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
                                                                                                                                          7. lower-/.f64N/A

                                                                                                                                            \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
                                                                                                                                          8. lower-*.f64N/A

                                                                                                                                            \[\leadsto \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
                                                                                                                                          9. mul-1-negN/A

                                                                                                                                            \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                                                                                                                                          10. lower-neg.f6438.7

                                                                                                                                            \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(-d\right)} \]
                                                                                                                                        5. Applied rewrites38.7%

                                                                                                                                          \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]

                                                                                                                                        if 5.5000000000000004e-262 < l

                                                                                                                                        1. Initial program 69.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. lower-*.f64N/A

                                                                                                                                            \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                          2. lower-sqrt.f64N/A

                                                                                                                                            \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                          3. lower-/.f64N/A

                                                                                                                                            \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                          4. lower-*.f6438.4

                                                                                                                                            \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
                                                                                                                                        5. Applied rewrites38.4%

                                                                                                                                          \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                        6. Step-by-step derivation
                                                                                                                                          1. Applied rewrites38.6%

                                                                                                                                            \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
                                                                                                                                          2. Step-by-step derivation
                                                                                                                                            1. Applied rewrites47.5%

                                                                                                                                              \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
                                                                                                                                          3. Recombined 2 regimes into one program.
                                                                                                                                          4. Final simplification42.7%

                                                                                                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 5.5 \cdot 10^{-262}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \]
                                                                                                                                          5. Add Preprocessing

                                                                                                                                          Alternative 27: 43.2% accurate, 10.3× speedup?

                                                                                                                                          \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -1.95 \cdot 10^{-193}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \end{array} \end{array} \]
                                                                                                                                          D_m = (fabs.f64 D)
                                                                                                                                          M_m = (fabs.f64 M)
                                                                                                                                          NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                          (FPCore (d h l M_m D_m)
                                                                                                                                           :precision binary64
                                                                                                                                           (if (<= d -1.95e-193) (* (- d) (sqrt (/ 1.0 (* h l)))) (/ d (sqrt (* h l)))))
                                                                                                                                          D_m = fabs(D);
                                                                                                                                          M_m = fabs(M);
                                                                                                                                          assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                                                                                          double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                                                          	double tmp;
                                                                                                                                          	if (d <= -1.95e-193) {
                                                                                                                                          		tmp = -d * sqrt((1.0 / (h * l)));
                                                                                                                                          	} else {
                                                                                                                                          		tmp = d / sqrt((h * l));
                                                                                                                                          	}
                                                                                                                                          	return tmp;
                                                                                                                                          }
                                                                                                                                          
                                                                                                                                          D_m = abs(d)
                                                                                                                                          M_m = abs(m)
                                                                                                                                          NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                          real(8) function code(d, h, l, m_m, d_m)
                                                                                                                                              real(8), intent (in) :: d
                                                                                                                                              real(8), intent (in) :: h
                                                                                                                                              real(8), intent (in) :: l
                                                                                                                                              real(8), intent (in) :: m_m
                                                                                                                                              real(8), intent (in) :: d_m
                                                                                                                                              real(8) :: tmp
                                                                                                                                              if (d <= (-1.95d-193)) then
                                                                                                                                                  tmp = -d * sqrt((1.0d0 / (h * l)))
                                                                                                                                              else
                                                                                                                                                  tmp = d / sqrt((h * l))
                                                                                                                                              end if
                                                                                                                                              code = tmp
                                                                                                                                          end function
                                                                                                                                          
                                                                                                                                          D_m = Math.abs(D);
                                                                                                                                          M_m = Math.abs(M);
                                                                                                                                          assert d < h && h < l && l < M_m && M_m < D_m;
                                                                                                                                          public static double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                                                          	double tmp;
                                                                                                                                          	if (d <= -1.95e-193) {
                                                                                                                                          		tmp = -d * Math.sqrt((1.0 / (h * l)));
                                                                                                                                          	} else {
                                                                                                                                          		tmp = d / Math.sqrt((h * l));
                                                                                                                                          	}
                                                                                                                                          	return tmp;
                                                                                                                                          }
                                                                                                                                          
                                                                                                                                          D_m = math.fabs(D)
                                                                                                                                          M_m = math.fabs(M)
                                                                                                                                          [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                                                                                                                                          def code(d, h, l, M_m, D_m):
                                                                                                                                          	tmp = 0
                                                                                                                                          	if d <= -1.95e-193:
                                                                                                                                          		tmp = -d * math.sqrt((1.0 / (h * l)))
                                                                                                                                          	else:
                                                                                                                                          		tmp = d / math.sqrt((h * l))
                                                                                                                                          	return tmp
                                                                                                                                          
                                                                                                                                          D_m = abs(D)
                                                                                                                                          M_m = abs(M)
                                                                                                                                          d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                                                                                          function code(d, h, l, M_m, D_m)
                                                                                                                                          	tmp = 0.0
                                                                                                                                          	if (d <= -1.95e-193)
                                                                                                                                          		tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l))));
                                                                                                                                          	else
                                                                                                                                          		tmp = Float64(d / sqrt(Float64(h * l)));
                                                                                                                                          	end
                                                                                                                                          	return tmp
                                                                                                                                          end
                                                                                                                                          
                                                                                                                                          D_m = abs(D);
                                                                                                                                          M_m = abs(M);
                                                                                                                                          d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                                                                                                                                          function tmp_2 = code(d, h, l, M_m, D_m)
                                                                                                                                          	tmp = 0.0;
                                                                                                                                          	if (d <= -1.95e-193)
                                                                                                                                          		tmp = -d * sqrt((1.0 / (h * l)));
                                                                                                                                          	else
                                                                                                                                          		tmp = d / sqrt((h * l));
                                                                                                                                          	end
                                                                                                                                          	tmp_2 = tmp;
                                                                                                                                          end
                                                                                                                                          
                                                                                                                                          D_m = N[Abs[D], $MachinePrecision]
                                                                                                                                          M_m = N[Abs[M], $MachinePrecision]
                                                                                                                                          NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                          code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.95e-193], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
                                                                                                                                          
                                                                                                                                          \begin{array}{l}
                                                                                                                                          D_m = \left|D\right|
                                                                                                                                          \\
                                                                                                                                          M_m = \left|M\right|
                                                                                                                                          \\
                                                                                                                                          [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                                                                                          \\
                                                                                                                                          \begin{array}{l}
                                                                                                                                          \mathbf{if}\;d \leq -1.95 \cdot 10^{-193}:\\
                                                                                                                                          \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                                                                                                                                          
                                                                                                                                          \mathbf{else}:\\
                                                                                                                                          \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
                                                                                                                                          
                                                                                                                                          
                                                                                                                                          \end{array}
                                                                                                                                          \end{array}
                                                                                                                                          
                                                                                                                                          Derivation
                                                                                                                                          1. Split input into 2 regimes
                                                                                                                                          2. if d < -1.9499999999999999e-193

                                                                                                                                            1. Initial program 73.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. *-commutativeN/A

                                                                                                                                                \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-1 \cdot d\right)} \]
                                                                                                                                              5. lower-*.f64N/A

                                                                                                                                                \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-1 \cdot d\right)} \]
                                                                                                                                              6. lower-sqrt.f64N/A

                                                                                                                                                \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
                                                                                                                                              7. lower-/.f64N/A

                                                                                                                                                \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
                                                                                                                                              8. lower-*.f64N/A

                                                                                                                                                \[\leadsto \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \cdot \left(-1 \cdot d\right) \]
                                                                                                                                              9. mul-1-negN/A

                                                                                                                                                \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                                                                                                                                              10. lower-neg.f6447.0

                                                                                                                                                \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(-d\right)} \]
                                                                                                                                            5. Applied rewrites47.0%

                                                                                                                                              \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)} \]

                                                                                                                                            if -1.9499999999999999e-193 < d

                                                                                                                                            1. Initial program 62.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. lower-*.f64N/A

                                                                                                                                                \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                              2. lower-sqrt.f64N/A

                                                                                                                                                \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                              3. lower-/.f64N/A

                                                                                                                                                \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                              4. lower-*.f6432.5

                                                                                                                                                \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
                                                                                                                                            5. Applied rewrites32.5%

                                                                                                                                              \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                            6. Step-by-step derivation
                                                                                                                                              1. Applied rewrites32.6%

                                                                                                                                                \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
                                                                                                                                            7. Recombined 2 regimes into one program.
                                                                                                                                            8. Final simplification38.7%

                                                                                                                                              \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.95 \cdot 10^{-193}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \end{array} \]
                                                                                                                                            9. Add Preprocessing

                                                                                                                                            Alternative 28: 37.0% accurate, 10.9× speedup?

                                                                                                                                            \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -4.5 \cdot 10^{-155}:\\ \;\;\;\;\sqrt{d \cdot \frac{d}{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \end{array} \end{array} \]
                                                                                                                                            D_m = (fabs.f64 D)
                                                                                                                                            M_m = (fabs.f64 M)
                                                                                                                                            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                            (FPCore (d h l M_m D_m)
                                                                                                                                             :precision binary64
                                                                                                                                             (if (<= d -4.5e-155) (sqrt (* d (/ d (* h l)))) (/ d (sqrt (* h l)))))
                                                                                                                                            D_m = fabs(D);
                                                                                                                                            M_m = fabs(M);
                                                                                                                                            assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                                                                                            double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                                                            	double tmp;
                                                                                                                                            	if (d <= -4.5e-155) {
                                                                                                                                            		tmp = sqrt((d * (d / (h * l))));
                                                                                                                                            	} else {
                                                                                                                                            		tmp = d / sqrt((h * l));
                                                                                                                                            	}
                                                                                                                                            	return tmp;
                                                                                                                                            }
                                                                                                                                            
                                                                                                                                            D_m = abs(d)
                                                                                                                                            M_m = abs(m)
                                                                                                                                            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                            real(8) function code(d, h, l, m_m, d_m)
                                                                                                                                                real(8), intent (in) :: d
                                                                                                                                                real(8), intent (in) :: h
                                                                                                                                                real(8), intent (in) :: l
                                                                                                                                                real(8), intent (in) :: m_m
                                                                                                                                                real(8), intent (in) :: d_m
                                                                                                                                                real(8) :: tmp
                                                                                                                                                if (d <= (-4.5d-155)) then
                                                                                                                                                    tmp = sqrt((d * (d / (h * l))))
                                                                                                                                                else
                                                                                                                                                    tmp = d / sqrt((h * l))
                                                                                                                                                end if
                                                                                                                                                code = tmp
                                                                                                                                            end function
                                                                                                                                            
                                                                                                                                            D_m = Math.abs(D);
                                                                                                                                            M_m = Math.abs(M);
                                                                                                                                            assert d < h && h < l && l < M_m && M_m < D_m;
                                                                                                                                            public static double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                                                            	double tmp;
                                                                                                                                            	if (d <= -4.5e-155) {
                                                                                                                                            		tmp = Math.sqrt((d * (d / (h * l))));
                                                                                                                                            	} else {
                                                                                                                                            		tmp = d / Math.sqrt((h * l));
                                                                                                                                            	}
                                                                                                                                            	return tmp;
                                                                                                                                            }
                                                                                                                                            
                                                                                                                                            D_m = math.fabs(D)
                                                                                                                                            M_m = math.fabs(M)
                                                                                                                                            [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                                                                                                                                            def code(d, h, l, M_m, D_m):
                                                                                                                                            	tmp = 0
                                                                                                                                            	if d <= -4.5e-155:
                                                                                                                                            		tmp = math.sqrt((d * (d / (h * l))))
                                                                                                                                            	else:
                                                                                                                                            		tmp = d / math.sqrt((h * l))
                                                                                                                                            	return tmp
                                                                                                                                            
                                                                                                                                            D_m = abs(D)
                                                                                                                                            M_m = abs(M)
                                                                                                                                            d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                                                                                            function code(d, h, l, M_m, D_m)
                                                                                                                                            	tmp = 0.0
                                                                                                                                            	if (d <= -4.5e-155)
                                                                                                                                            		tmp = sqrt(Float64(d * Float64(d / Float64(h * l))));
                                                                                                                                            	else
                                                                                                                                            		tmp = Float64(d / sqrt(Float64(h * l)));
                                                                                                                                            	end
                                                                                                                                            	return tmp
                                                                                                                                            end
                                                                                                                                            
                                                                                                                                            D_m = abs(D);
                                                                                                                                            M_m = abs(M);
                                                                                                                                            d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                                                                                                                                            function tmp_2 = code(d, h, l, M_m, D_m)
                                                                                                                                            	tmp = 0.0;
                                                                                                                                            	if (d <= -4.5e-155)
                                                                                                                                            		tmp = sqrt((d * (d / (h * l))));
                                                                                                                                            	else
                                                                                                                                            		tmp = d / sqrt((h * l));
                                                                                                                                            	end
                                                                                                                                            	tmp_2 = tmp;
                                                                                                                                            end
                                                                                                                                            
                                                                                                                                            D_m = N[Abs[D], $MachinePrecision]
                                                                                                                                            M_m = N[Abs[M], $MachinePrecision]
                                                                                                                                            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                            code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -4.5e-155], N[Sqrt[N[(d * N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
                                                                                                                                            
                                                                                                                                            \begin{array}{l}
                                                                                                                                            D_m = \left|D\right|
                                                                                                                                            \\
                                                                                                                                            M_m = \left|M\right|
                                                                                                                                            \\
                                                                                                                                            [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                                                                                            \\
                                                                                                                                            \begin{array}{l}
                                                                                                                                            \mathbf{if}\;d \leq -4.5 \cdot 10^{-155}:\\
                                                                                                                                            \;\;\;\;\sqrt{d \cdot \frac{d}{h \cdot \ell}}\\
                                                                                                                                            
                                                                                                                                            \mathbf{else}:\\
                                                                                                                                            \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
                                                                                                                                            
                                                                                                                                            
                                                                                                                                            \end{array}
                                                                                                                                            \end{array}
                                                                                                                                            
                                                                                                                                            Derivation
                                                                                                                                            1. Split input into 2 regimes
                                                                                                                                            2. if d < -4.5000000000000004e-155

                                                                                                                                              1. Initial program 74.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 d around inf

                                                                                                                                                \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                              4. Step-by-step derivation
                                                                                                                                                1. lower-*.f64N/A

                                                                                                                                                  \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                                2. lower-sqrt.f64N/A

                                                                                                                                                  \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                                3. lower-/.f64N/A

                                                                                                                                                  \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                                4. lower-*.f645.0

                                                                                                                                                  \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
                                                                                                                                              5. Applied rewrites5.0%

                                                                                                                                                \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                              6. Step-by-step derivation
                                                                                                                                                1. Applied rewrites28.7%

                                                                                                                                                  \[\leadsto \sqrt{\frac{d \cdot d}{h \cdot \ell}} \]
                                                                                                                                                2. Step-by-step derivation
                                                                                                                                                  1. Applied rewrites33.5%

                                                                                                                                                    \[\leadsto \sqrt{\frac{d}{h \cdot \ell} \cdot d} \]

                                                                                                                                                  if -4.5000000000000004e-155 < d

                                                                                                                                                  1. Initial program 62.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. lower-*.f64N/A

                                                                                                                                                      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                                    2. lower-sqrt.f64N/A

                                                                                                                                                      \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                                    3. lower-/.f64N/A

                                                                                                                                                      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                                    4. lower-*.f6431.6

                                                                                                                                                      \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
                                                                                                                                                  5. Applied rewrites31.6%

                                                                                                                                                    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                                  6. Step-by-step derivation
                                                                                                                                                    1. Applied rewrites31.8%

                                                                                                                                                      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
                                                                                                                                                  7. Recombined 2 regimes into one program.
                                                                                                                                                  8. Final simplification32.4%

                                                                                                                                                    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4.5 \cdot 10^{-155}:\\ \;\;\;\;\sqrt{d \cdot \frac{d}{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\ \end{array} \]
                                                                                                                                                  9. Add Preprocessing

                                                                                                                                                  Alternative 29: 26.3% accurate, 15.3× speedup?

                                                                                                                                                  \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \frac{d}{\sqrt{h \cdot \ell}} \end{array} \]
                                                                                                                                                  D_m = (fabs.f64 D)
                                                                                                                                                  M_m = (fabs.f64 M)
                                                                                                                                                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                                  (FPCore (d h l M_m D_m) :precision binary64 (/ d (sqrt (* h l))))
                                                                                                                                                  D_m = fabs(D);
                                                                                                                                                  M_m = fabs(M);
                                                                                                                                                  assert(d < h && h < l && l < M_m && M_m < D_m);
                                                                                                                                                  double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                                                                  	return d / sqrt((h * l));
                                                                                                                                                  }
                                                                                                                                                  
                                                                                                                                                  D_m = abs(d)
                                                                                                                                                  M_m = abs(m)
                                                                                                                                                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                                  real(8) function code(d, h, l, m_m, d_m)
                                                                                                                                                      real(8), intent (in) :: d
                                                                                                                                                      real(8), intent (in) :: h
                                                                                                                                                      real(8), intent (in) :: l
                                                                                                                                                      real(8), intent (in) :: m_m
                                                                                                                                                      real(8), intent (in) :: d_m
                                                                                                                                                      code = d / sqrt((h * l))
                                                                                                                                                  end function
                                                                                                                                                  
                                                                                                                                                  D_m = Math.abs(D);
                                                                                                                                                  M_m = Math.abs(M);
                                                                                                                                                  assert d < h && h < l && l < M_m && M_m < D_m;
                                                                                                                                                  public static double code(double d, double h, double l, double M_m, double D_m) {
                                                                                                                                                  	return d / Math.sqrt((h * l));
                                                                                                                                                  }
                                                                                                                                                  
                                                                                                                                                  D_m = math.fabs(D)
                                                                                                                                                  M_m = math.fabs(M)
                                                                                                                                                  [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                                                                                                                                                  def code(d, h, l, M_m, D_m):
                                                                                                                                                  	return d / math.sqrt((h * l))
                                                                                                                                                  
                                                                                                                                                  D_m = abs(D)
                                                                                                                                                  M_m = abs(M)
                                                                                                                                                  d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                                                                                                                  function code(d, h, l, M_m, D_m)
                                                                                                                                                  	return Float64(d / sqrt(Float64(h * l)))
                                                                                                                                                  end
                                                                                                                                                  
                                                                                                                                                  D_m = abs(D);
                                                                                                                                                  M_m = abs(M);
                                                                                                                                                  d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                                                                                                                                                  function tmp = code(d, h, l, M_m, D_m)
                                                                                                                                                  	tmp = d / sqrt((h * l));
                                                                                                                                                  end
                                                                                                                                                  
                                                                                                                                                  D_m = N[Abs[D], $MachinePrecision]
                                                                                                                                                  M_m = N[Abs[M], $MachinePrecision]
                                                                                                                                                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                                                                                                                  code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
                                                                                                                                                  
                                                                                                                                                  \begin{array}{l}
                                                                                                                                                  D_m = \left|D\right|
                                                                                                                                                  \\
                                                                                                                                                  M_m = \left|M\right|
                                                                                                                                                  \\
                                                                                                                                                  [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                                                                                                                  \\
                                                                                                                                                  \frac{d}{\sqrt{h \cdot \ell}}
                                                                                                                                                  \end{array}
                                                                                                                                                  
                                                                                                                                                  Derivation
                                                                                                                                                  1. Initial program 66.8%

                                                                                                                                                    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                                                                                                  2. 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. lower-*.f64N/A

                                                                                                                                                      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                                    2. lower-sqrt.f64N/A

                                                                                                                                                      \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                                    3. lower-/.f64N/A

                                                                                                                                                      \[\leadsto d \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                                    4. lower-*.f6421.2

                                                                                                                                                      \[\leadsto d \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
                                                                                                                                                  5. Applied rewrites21.2%

                                                                                                                                                    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                                                  6. Step-by-step derivation
                                                                                                                                                    1. Applied rewrites21.3%

                                                                                                                                                      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
                                                                                                                                                    2. Add Preprocessing

                                                                                                                                                    Reproduce

                                                                                                                                                    ?
                                                                                                                                                    herbie shell --seed 2024237 
                                                                                                                                                    (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)))))