Henrywood and Agarwal, Equation (12)

Percentage Accurate: 65.8% → 82.7%
Time: 17.0s
Alternatives: 18
Speedup: 3.7×

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 18 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: 82.7% accurate, 1.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{-\ell}\\ t_1 := M\_m \cdot \frac{D\_m}{d}\\ t_2 := \sqrt{-d}\\ t_3 := \frac{t\_2}{\sqrt{-h}}\\ t_4 := 1 - \frac{\frac{M\_m}{d} \cdot \left(0.25 \cdot D\_m\right)}{\ell \cdot \left({h}^{-1} \cdot \frac{2}{t\_1}\right)}\\ \mathbf{if}\;h \leq -2.1 \cdot 10^{+154}:\\ \;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{\left(D\_m \cdot 0.25\right) \cdot M\_m}{\left(-\ell\right) \cdot d} \cdot \left(t\_1 \cdot 0.5\right), h, 1\right) \cdot t\_3\right) \cdot t\_2}{t\_0}\\ \mathbf{elif}\;h \leq -1.25 \cdot 10^{-141}:\\ \;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{\frac{M\_m \cdot \left(0.25 \cdot D\_m\right)}{d}}{-\ell} \cdot \left(\left(D\_m \cdot \frac{M\_m}{d}\right) \cdot 0.5\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_2}{t\_0}\\ \mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(t\_3 \cdot {\left(\sqrt{\frac{\ell}{d}}\right)}^{-1}\right) \cdot t\_4\\ \mathbf{elif}\;h \leq 6.4 \cdot 10^{+140}:\\ \;\;\;\;\left(\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\right) \cdot t\_4\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot h, \frac{M\_m}{\ell} \cdot \left(-0.25 \cdot \frac{D\_m}{d}\right), 1\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \sqrt{\frac{d}{\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 (- l)))
        (t_1 (* M_m (/ D_m d)))
        (t_2 (sqrt (- d)))
        (t_3 (/ t_2 (sqrt (- h))))
        (t_4
         (-
          1.0
          (/ (* (/ M_m d) (* 0.25 D_m)) (* l (* (pow h -1.0) (/ 2.0 t_1)))))))
   (if (<= h -2.1e+154)
     (/
      (*
       (* (fma (* (/ (* (* D_m 0.25) M_m) (* (- l) d)) (* t_1 0.5)) h 1.0) t_3)
       t_2)
      t_0)
     (if (<= h -1.25e-141)
       (/
        (*
         (*
          (fma
           (* (/ (/ (* M_m (* 0.25 D_m)) d) (- l)) (* (* D_m (/ M_m d)) 0.5))
           h
           1.0)
          (sqrt (/ d h)))
         t_2)
        t_0)
       (if (<= h -2e-310)
         (* (* t_3 (pow (sqrt (/ l d)) -1.0)) t_4)
         (if (<= h 6.4e+140)
           (* (* (sqrt (pow (* l h) -1.0)) d) t_4)
           (*
            (*
             (fma
              (* (* 0.5 (* (/ D_m d) M_m)) h)
              (* (/ M_m l) (* -0.25 (/ D_m d)))
              1.0)
             (/ (sqrt d) (sqrt h)))
            (sqrt (/ d 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(-l);
	double t_1 = M_m * (D_m / d);
	double t_2 = sqrt(-d);
	double t_3 = t_2 / sqrt(-h);
	double t_4 = 1.0 - (((M_m / d) * (0.25 * D_m)) / (l * (pow(h, -1.0) * (2.0 / t_1))));
	double tmp;
	if (h <= -2.1e+154) {
		tmp = ((fma(((((D_m * 0.25) * M_m) / (-l * d)) * (t_1 * 0.5)), h, 1.0) * t_3) * t_2) / t_0;
	} else if (h <= -1.25e-141) {
		tmp = ((fma(((((M_m * (0.25 * D_m)) / d) / -l) * ((D_m * (M_m / d)) * 0.5)), h, 1.0) * sqrt((d / h))) * t_2) / t_0;
	} else if (h <= -2e-310) {
		tmp = (t_3 * pow(sqrt((l / d)), -1.0)) * t_4;
	} else if (h <= 6.4e+140) {
		tmp = (sqrt(pow((l * h), -1.0)) * d) * t_4;
	} else {
		tmp = (fma(((0.5 * ((D_m / d) * M_m)) * h), ((M_m / l) * (-0.25 * (D_m / d))), 1.0) * (sqrt(d) / sqrt(h))) * sqrt((d / 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(-l))
	t_1 = Float64(M_m * Float64(D_m / d))
	t_2 = sqrt(Float64(-d))
	t_3 = Float64(t_2 / sqrt(Float64(-h)))
	t_4 = Float64(1.0 - Float64(Float64(Float64(M_m / d) * Float64(0.25 * D_m)) / Float64(l * Float64((h ^ -1.0) * Float64(2.0 / t_1)))))
	tmp = 0.0
	if (h <= -2.1e+154)
		tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(Float64(D_m * 0.25) * M_m) / Float64(Float64(-l) * d)) * Float64(t_1 * 0.5)), h, 1.0) * t_3) * t_2) / t_0);
	elseif (h <= -1.25e-141)
		tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(Float64(M_m * Float64(0.25 * D_m)) / d) / Float64(-l)) * Float64(Float64(D_m * Float64(M_m / d)) * 0.5)), h, 1.0) * sqrt(Float64(d / h))) * t_2) / t_0);
	elseif (h <= -2e-310)
		tmp = Float64(Float64(t_3 * (sqrt(Float64(l / d)) ^ -1.0)) * t_4);
	elseif (h <= 6.4e+140)
		tmp = Float64(Float64(sqrt((Float64(l * h) ^ -1.0)) * d) * t_4);
	else
		tmp = Float64(Float64(fma(Float64(Float64(0.5 * Float64(Float64(D_m / d) * M_m)) * h), Float64(Float64(M_m / l) * Float64(-0.25 * Float64(D_m / d))), 1.0) * Float64(sqrt(d) / sqrt(h))) * sqrt(Float64(d / 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[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[(M$95$m * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 - N[(N[(N[(M$95$m / d), $MachinePrecision] * N[(0.25 * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(l * N[(N[Power[h, -1.0], $MachinePrecision] * N[(2.0 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2.1e+154], N[(N[(N[(N[(N[(N[(N[(N[(D$95$m * 0.25), $MachinePrecision] * M$95$m), $MachinePrecision] / N[((-l) * d), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * 0.5), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$2), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[h, -1.25e-141], N[(N[(N[(N[(N[(N[(N[(N[(M$95$m * N[(0.25 * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] / (-l)), $MachinePrecision] * N[(N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[h, -2e-310], N[(N[(t$95$3 * N[Power[N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[h, 6.4e+140], N[(N[(N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] * t$95$4), $MachinePrecision], N[(N[(N[(N[(N[(0.5 * N[(N[(D$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] * N[(N[(M$95$m / l), $MachinePrecision] * N[(-0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / 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 := \sqrt{-\ell}\\
t_1 := M\_m \cdot \frac{D\_m}{d}\\
t_2 := \sqrt{-d}\\
t_3 := \frac{t\_2}{\sqrt{-h}}\\
t_4 := 1 - \frac{\frac{M\_m}{d} \cdot \left(0.25 \cdot D\_m\right)}{\ell \cdot \left({h}^{-1} \cdot \frac{2}{t\_1}\right)}\\
\mathbf{if}\;h \leq -2.1 \cdot 10^{+154}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{\left(D\_m \cdot 0.25\right) \cdot M\_m}{\left(-\ell\right) \cdot d} \cdot \left(t\_1 \cdot 0.5\right), h, 1\right) \cdot t\_3\right) \cdot t\_2}{t\_0}\\

\mathbf{elif}\;h \leq -1.25 \cdot 10^{-141}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{\frac{M\_m \cdot \left(0.25 \cdot D\_m\right)}{d}}{-\ell} \cdot \left(\left(D\_m \cdot \frac{M\_m}{d}\right) \cdot 0.5\right), h, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_2}{t\_0}\\

\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(t\_3 \cdot {\left(\sqrt{\frac{\ell}{d}}\right)}^{-1}\right) \cdot t\_4\\

\mathbf{elif}\;h \leq 6.4 \cdot 10^{+140}:\\
\;\;\;\;\left(\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\right) \cdot t\_4\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if h < -2.09999999999999994e154

    1. Initial program 49.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 rewrites49.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.09999999999999994e154 < h < -1.25e-141

    1. Initial program 69.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 rewrites79.6%

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

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

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

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

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

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

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

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

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

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

    if -1.25e-141 < h < -1.999999999999994e-310

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < h < 6.40000000000000021e140

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.40000000000000021e140 < h

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 66.2% accurate, 0.1× 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({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_1 := \frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{+278}:\\ \;\;\;\;\left(\frac{\left(\left(D\_m \cdot D\_m\right) \cdot h\right) \cdot -0.125}{d} \cdot \frac{\frac{M\_m \cdot M\_m}{\ell}}{d}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(\left(0.5 \cdot M\_m\right) \cdot \frac{D\_m}{d}\right) \cdot \left(h \cdot \frac{M\_m}{\ell}\right)\right) \cdot \frac{D\_m}{d}, -0.25, 1\right) \cdot t\_1\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+174}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.25 \cdot \frac{D\_m}{\ell}, \frac{M\_m}{d} \cdot \left(\left(h \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right) \cdot M\_m\right), 1\right) \cdot t\_1\\ \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) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
          (-
           1.0
           (*
            (* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
            (/ h l)))))
        (t_1 (/ d (sqrt (* l h)))))
   (if (<= t_0 -1e+278)
     (*
      (* (/ (* (* (* D_m D_m) h) -0.125) d) (/ (/ (* M_m M_m) l) d))
      (sqrt (* (/ d l) (/ d h))))
     (if (<= t_0 0.0)
       (*
        (fma
         (* (* (* (* 0.5 M_m) (/ D_m d)) (* h (/ M_m l))) (/ D_m d))
         -0.25
         1.0)
        t_1)
       (if (<= t_0 5e+174)
         (* (sqrt (/ d h)) (sqrt (/ d l)))
         (if (<= t_0 INFINITY)
           (/ (* (sqrt (/ h l)) d) h)
           (*
            (fma
             (* -0.25 (/ D_m l))
             (* (/ M_m d) (* (* h (* (/ D_m d) 0.5)) M_m))
             1.0)
            t_1)))))))
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), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
	double t_1 = d / sqrt((l * h));
	double tmp;
	if (t_0 <= -1e+278) {
		tmp = (((((D_m * D_m) * h) * -0.125) / d) * (((M_m * M_m) / l) / d)) * sqrt(((d / l) * (d / h)));
	} else if (t_0 <= 0.0) {
		tmp = fma(((((0.5 * M_m) * (D_m / d)) * (h * (M_m / l))) * (D_m / d)), -0.25, 1.0) * t_1;
	} else if (t_0 <= 5e+174) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else if (t_0 <= ((double) INFINITY)) {
		tmp = (sqrt((h / l)) * d) / h;
	} else {
		tmp = fma((-0.25 * (D_m / l)), ((M_m / d) * ((h * ((D_m / d) * 0.5)) * M_m)), 1.0) * t_1;
	}
	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) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
	t_1 = Float64(d / sqrt(Float64(l * h)))
	tmp = 0.0
	if (t_0 <= -1e+278)
		tmp = Float64(Float64(Float64(Float64(Float64(Float64(D_m * D_m) * h) * -0.125) / d) * Float64(Float64(Float64(M_m * M_m) / l) / d)) * sqrt(Float64(Float64(d / l) * Float64(d / h))));
	elseif (t_0 <= 0.0)
		tmp = Float64(fma(Float64(Float64(Float64(Float64(0.5 * M_m) * Float64(D_m / d)) * Float64(h * Float64(M_m / l))) * Float64(D_m / d)), -0.25, 1.0) * t_1);
	elseif (t_0 <= 5e+174)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	elseif (t_0 <= Inf)
		tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h);
	else
		tmp = Float64(fma(Float64(-0.25 * Float64(D_m / l)), Float64(Float64(M_m / d) * Float64(Float64(h * Float64(Float64(D_m / d) * 0.5)) * M_m)), 1.0) * t_1);
	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[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+278], N[(N[(N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * h), $MachinePrecision] * -0.125), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(N[(N[(N[(0.5 * M$95$m), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 5e+174], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(-0.25 * N[(D$95$m / l), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * N[(N[(h * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $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({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+278}:\\
\;\;\;\;\left(\frac{\left(\left(D\_m \cdot D\_m\right) \cdot h\right) \cdot -0.125}{d} \cdot \frac{\frac{M\_m \cdot M\_m}{\ell}}{d}\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\

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

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+174}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 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)))) < -9.99999999999999964e277

    1. Initial program 84.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 rewrites39.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999964e277 < (*.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 72.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 rewrites39.9%

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

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

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

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

    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)))) < 4.9999999999999997e174

    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. Applied rewrites42.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
      8. lower-/.f6496.9

        \[\leadsto \sqrt{\color{blue}{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
    8. Applied rewrites96.9%

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

    if 4.9999999999999997e174 < (*.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 57.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 rewrites41.3%

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

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

        \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot 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. Applied rewrites2.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25 \cdot \frac{D}{\ell}, \frac{M}{d} \cdot \left(\left(h \cdot \left(\frac{D}{d} \cdot 0.5\right)\right) \cdot M\right), 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}} \]
    8. Recombined 5 regimes into one program.
    9. Final simplification63.4%

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

    Alternative 3: 49.7% accurate, 0.1× 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{t\_0 \cdot d}{h}\\ t_2 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_3 := \frac{\left(-d\right) \cdot t\_0}{h}\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{-190}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-145}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+147}:\\ \;\;\;\;1 \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \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 (/ (* t_0 d) h))
            (t_2
             (*
              (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
              (-
               1.0
               (*
                (* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
                (/ h l)))))
            (t_3 (/ (* (- d) t_0) h)))
       (if (<= t_2 -2e-190)
         t_3
         (if (<= t_2 5e-145)
           t_1
           (if (<= t_2 5e+147)
             (* 1.0 (sqrt (* (/ d l) (/ d h))))
             (if (<= t_2 INFINITY) t_1 t_3))))))
    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 = (t_0 * d) / h;
    	double t_2 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
    	double t_3 = (-d * t_0) / h;
    	double tmp;
    	if (t_2 <= -2e-190) {
    		tmp = t_3;
    	} else if (t_2 <= 5e-145) {
    		tmp = t_1;
    	} else if (t_2 <= 5e+147) {
    		tmp = 1.0 * sqrt(((d / l) * (d / h)));
    	} else if (t_2 <= ((double) INFINITY)) {
    		tmp = t_1;
    	} else {
    		tmp = t_3;
    	}
    	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 = (t_0 * d) / h;
    	double t_2 = (Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
    	double t_3 = (-d * t_0) / h;
    	double tmp;
    	if (t_2 <= -2e-190) {
    		tmp = t_3;
    	} else if (t_2 <= 5e-145) {
    		tmp = t_1;
    	} else if (t_2 <= 5e+147) {
    		tmp = 1.0 * Math.sqrt(((d / l) * (d / h)));
    	} else if (t_2 <= Double.POSITIVE_INFINITY) {
    		tmp = t_1;
    	} else {
    		tmp = t_3;
    	}
    	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 = (t_0 * d) / h
    	t_2 = (math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)))
    	t_3 = (-d * t_0) / h
    	tmp = 0
    	if t_2 <= -2e-190:
    		tmp = t_3
    	elif t_2 <= 5e-145:
    		tmp = t_1
    	elif t_2 <= 5e+147:
    		tmp = 1.0 * math.sqrt(((d / l) * (d / h)))
    	elif t_2 <= math.inf:
    		tmp = t_1
    	else:
    		tmp = t_3
    	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(t_0 * d) / h)
    	t_2 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
    	t_3 = Float64(Float64(Float64(-d) * t_0) / h)
    	tmp = 0.0
    	if (t_2 <= -2e-190)
    		tmp = t_3;
    	elseif (t_2 <= 5e-145)
    		tmp = t_1;
    	elseif (t_2 <= 5e+147)
    		tmp = Float64(1.0 * sqrt(Float64(Float64(d / l) * Float64(d / h))));
    	elseif (t_2 <= Inf)
    		tmp = t_1;
    	else
    		tmp = t_3;
    	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 = (t_0 * d) / h;
    	t_2 = (((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M_m * D_m) / (2.0 * d)) ^ 2.0)) * (h / l)));
    	t_3 = (-d * t_0) / h;
    	tmp = 0.0;
    	if (t_2 <= -2e-190)
    		tmp = t_3;
    	elseif (t_2 <= 5e-145)
    		tmp = t_1;
    	elseif (t_2 <= 5e+147)
    		tmp = 1.0 * sqrt(((d / l) * (d / h)));
    	elseif (t_2 <= Inf)
    		tmp = t_1;
    	else
    		tmp = t_3;
    	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[(t$95$0 * d), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[((-d) * t$95$0), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-190], t$95$3, If[LessEqual[t$95$2, 5e-145], t$95$1, If[LessEqual[t$95$2, 5e+147], N[(1.0 * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], t$95$1, t$95$3]]]]]]]]
    
    \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{t\_0 \cdot d}{h}\\
    t_2 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
    t_3 := \frac{\left(-d\right) \cdot t\_0}{h}\\
    \mathbf{if}\;t\_2 \leq -2 \cdot 10^{-190}:\\
    \;\;\;\;t\_3\\
    
    \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-145}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+147}:\\
    \;\;\;\;1 \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
    
    \mathbf{elif}\;t\_2 \leq \infty:\\
    \;\;\;\;t\_1\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_3\\
    
    
    \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)))) < -2e-190 or +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 58.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 rewrites30.8%

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

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

        if -2e-190 < (*.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)))) < 4.9999999999999998e-145 or 5.0000000000000002e147 < (*.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 62.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 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 rewrites45.5%

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

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

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

          if 4.9999999999999998e-145 < (*.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.0000000000000002e147

          1. Initial program 98.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 rewrites41.7%

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

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

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

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -2 \cdot 10^{-190}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{-145}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+147}:\\ \;\;\;\;1 \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \end{array} \]
          10. Add Preprocessing

          Alternative 4: 49.0% accurate, 0.1× 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{t\_0 \cdot d}{h}\\ t_2 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_3 := \frac{\left(-d\right) \cdot t\_0}{h}\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{-190}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-98}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+147}:\\ \;\;\;\;\sqrt{\frac{\frac{d}{\ell}}{h} \cdot d}\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \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 (/ (* t_0 d) h))
                  (t_2
                   (*
                    (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                    (-
                     1.0
                     (*
                      (* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
                      (/ h l)))))
                  (t_3 (/ (* (- d) t_0) h)))
             (if (<= t_2 -2e-190)
               t_3
               (if (<= t_2 2e-98)
                 t_1
                 (if (<= t_2 5e+147)
                   (sqrt (* (/ (/ d l) h) d))
                   (if (<= t_2 INFINITY) t_1 t_3))))))
          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 = (t_0 * d) / h;
          	double t_2 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
          	double t_3 = (-d * t_0) / h;
          	double tmp;
          	if (t_2 <= -2e-190) {
          		tmp = t_3;
          	} else if (t_2 <= 2e-98) {
          		tmp = t_1;
          	} else if (t_2 <= 5e+147) {
          		tmp = sqrt((((d / l) / h) * d));
          	} else if (t_2 <= ((double) INFINITY)) {
          		tmp = t_1;
          	} else {
          		tmp = t_3;
          	}
          	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 = (t_0 * d) / h;
          	double t_2 = (Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
          	double t_3 = (-d * t_0) / h;
          	double tmp;
          	if (t_2 <= -2e-190) {
          		tmp = t_3;
          	} else if (t_2 <= 2e-98) {
          		tmp = t_1;
          	} else if (t_2 <= 5e+147) {
          		tmp = Math.sqrt((((d / l) / h) * d));
          	} else if (t_2 <= Double.POSITIVE_INFINITY) {
          		tmp = t_1;
          	} else {
          		tmp = t_3;
          	}
          	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 = (t_0 * d) / h
          	t_2 = (math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)))
          	t_3 = (-d * t_0) / h
          	tmp = 0
          	if t_2 <= -2e-190:
          		tmp = t_3
          	elif t_2 <= 2e-98:
          		tmp = t_1
          	elif t_2 <= 5e+147:
          		tmp = math.sqrt((((d / l) / h) * d))
          	elif t_2 <= math.inf:
          		tmp = t_1
          	else:
          		tmp = t_3
          	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(t_0 * d) / h)
          	t_2 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
          	t_3 = Float64(Float64(Float64(-d) * t_0) / h)
          	tmp = 0.0
          	if (t_2 <= -2e-190)
          		tmp = t_3;
          	elseif (t_2 <= 2e-98)
          		tmp = t_1;
          	elseif (t_2 <= 5e+147)
          		tmp = sqrt(Float64(Float64(Float64(d / l) / h) * d));
          	elseif (t_2 <= Inf)
          		tmp = t_1;
          	else
          		tmp = t_3;
          	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 = (t_0 * d) / h;
          	t_2 = (((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M_m * D_m) / (2.0 * d)) ^ 2.0)) * (h / l)));
          	t_3 = (-d * t_0) / h;
          	tmp = 0.0;
          	if (t_2 <= -2e-190)
          		tmp = t_3;
          	elseif (t_2 <= 2e-98)
          		tmp = t_1;
          	elseif (t_2 <= 5e+147)
          		tmp = sqrt((((d / l) / h) * d));
          	elseif (t_2 <= Inf)
          		tmp = t_1;
          	else
          		tmp = t_3;
          	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[(t$95$0 * d), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[((-d) * t$95$0), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-190], t$95$3, If[LessEqual[t$95$2, 2e-98], t$95$1, If[LessEqual[t$95$2, 5e+147], N[Sqrt[N[(N[(N[(d / l), $MachinePrecision] / h), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$2, Infinity], t$95$1, t$95$3]]]]]]]]
          
          \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{t\_0 \cdot d}{h}\\
          t_2 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
          t_3 := \frac{\left(-d\right) \cdot t\_0}{h}\\
          \mathbf{if}\;t\_2 \leq -2 \cdot 10^{-190}:\\
          \;\;\;\;t\_3\\
          
          \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-98}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+147}:\\
          \;\;\;\;\sqrt{\frac{\frac{d}{\ell}}{h} \cdot d}\\
          
          \mathbf{elif}\;t\_2 \leq \infty:\\
          \;\;\;\;t\_1\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_3\\
          
          
          \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)))) < -2e-190 or +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 58.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 rewrites30.8%

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

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

              if -2e-190 < (*.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.99999999999999988e-98 or 5.0000000000000002e147 < (*.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 65.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 rewrites47.0%

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

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

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

                if 1.99999999999999988e-98 < (*.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.0000000000000002e147

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -2 \cdot 10^{-190}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 2 \cdot 10^{-98}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+147}:\\ \;\;\;\;\sqrt{\frac{\frac{d}{\ell}}{h} \cdot d}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \end{array} \]
                  5. Add Preprocessing

                  Alternative 5: 69.7% 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 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-190}:\\ \;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \frac{D\_m}{d}\right) \cdot M\_m, \left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+174}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.25 \cdot \frac{D\_m}{\ell}, \frac{M\_m}{d} \cdot \left(\left(h \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right) \cdot M\_m\right), 1\right) \cdot \frac{d}{\sqrt{\ell \cdot 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
                           (*
                            (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                            (-
                             1.0
                             (*
                              (* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
                              (/ h l))))))
                     (if (<= t_0 -2e-190)
                       (*
                        (fma
                         (* (* -0.25 (/ D_m d)) M_m)
                         (* (* 0.5 (* (/ D_m d) M_m)) (/ h l))
                         1.0)
                        (sqrt (* (/ d l) (/ d h))))
                       (if (<= t_0 5e+174)
                         (* (sqrt (/ d h)) (sqrt (/ d l)))
                         (if (<= t_0 INFINITY)
                           (/ (* (sqrt (/ h l)) d) h)
                           (*
                            (fma
                             (* -0.25 (/ D_m l))
                             (* (/ M_m d) (* (* h (* (/ D_m d) 0.5)) M_m))
                             1.0)
                            (/ d (sqrt (* 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 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
                  	double tmp;
                  	if (t_0 <= -2e-190) {
                  		tmp = fma(((-0.25 * (D_m / d)) * M_m), ((0.5 * ((D_m / d) * M_m)) * (h / l)), 1.0) * sqrt(((d / l) * (d / h)));
                  	} else if (t_0 <= 5e+174) {
                  		tmp = sqrt((d / h)) * sqrt((d / l));
                  	} else if (t_0 <= ((double) INFINITY)) {
                  		tmp = (sqrt((h / l)) * d) / h;
                  	} else {
                  		tmp = fma((-0.25 * (D_m / l)), ((M_m / d) * ((h * ((D_m / d) * 0.5)) * M_m)), 1.0) * (d / sqrt((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 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
                  	tmp = 0.0
                  	if (t_0 <= -2e-190)
                  		tmp = Float64(fma(Float64(Float64(-0.25 * Float64(D_m / d)) * M_m), Float64(Float64(0.5 * Float64(Float64(D_m / d) * M_m)) * Float64(h / l)), 1.0) * sqrt(Float64(Float64(d / l) * Float64(d / h))));
                  	elseif (t_0 <= 5e+174)
                  		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
                  	elseif (t_0 <= Inf)
                  		tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h);
                  	else
                  		tmp = Float64(fma(Float64(-0.25 * Float64(D_m / l)), Float64(Float64(M_m / d) * Float64(Float64(h * Float64(Float64(D_m / d) * 0.5)) * M_m)), 1.0) * Float64(d / sqrt(Float64(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[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-190], N[(N[(N[(N[(-0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(N[(0.5 * N[(N[(D$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+174], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(-0.25 * N[(D$95$m / l), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * N[(N[(h * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * 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 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
                  \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-190}:\\
                  \;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \frac{D\_m}{d}\right) \cdot M\_m, \left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
                  
                  \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+174}:\\
                  \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
                  
                  \mathbf{elif}\;t\_0 \leq \infty:\\
                  \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\mathsf{fma}\left(-0.25 \cdot \frac{D\_m}{\ell}, \frac{M\_m}{d} \cdot \left(\left(h \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right) \cdot M\_m\right), 1\right) \cdot \frac{d}{\sqrt{\ell \cdot 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-190

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

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

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

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

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

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

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

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

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

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

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

                    if -2e-190 < (*.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)))) < 4.9999999999999997e174

                    1. Initial program 87.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 rewrites39.1%

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
                      8. lower-/.f6485.8

                        \[\leadsto \sqrt{\color{blue}{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
                    8. Applied rewrites85.8%

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

                    if 4.9999999999999997e174 < (*.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 57.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 rewrites41.3%

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

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

                        \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot 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. Applied rewrites2.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25 \cdot \frac{D}{\ell}, \frac{M}{d} \cdot \left(\left(h \cdot \left(\frac{D}{d} \cdot 0.5\right)\right) \cdot M\right), 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}} \]
                    8. Recombined 4 regimes into one program.
                    9. Final simplification70.7%

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

                    Alternative 6: 67.5% 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 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{-45}:\\ \;\;\;\;\mathsf{fma}\left(\left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot h, \frac{\left(-0.25 \cdot D\_m\right) \cdot M\_m}{\ell \cdot d}, 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+174}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.25 \cdot \frac{D\_m}{\ell}, \frac{M\_m}{d} \cdot \left(\left(h \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right) \cdot M\_m\right), 1\right) \cdot \frac{d}{\sqrt{\ell \cdot 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
                             (*
                              (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                              (-
                               1.0
                               (*
                                (* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
                                (/ h l))))))
                       (if (<= t_0 -5e-45)
                         (*
                          (fma
                           (* (* 0.5 (* (/ D_m d) M_m)) h)
                           (/ (* (* -0.25 D_m) M_m) (* l d))
                           1.0)
                          (sqrt (* (/ d l) (/ d h))))
                         (if (<= t_0 5e+174)
                           (* (sqrt (/ d h)) (sqrt (/ d l)))
                           (if (<= t_0 INFINITY)
                             (/ (* (sqrt (/ h l)) d) h)
                             (*
                              (fma
                               (* -0.25 (/ D_m l))
                               (* (/ M_m d) (* (* h (* (/ D_m d) 0.5)) M_m))
                               1.0)
                              (/ d (sqrt (* 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 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
                    	double tmp;
                    	if (t_0 <= -5e-45) {
                    		tmp = fma(((0.5 * ((D_m / d) * M_m)) * h), (((-0.25 * D_m) * M_m) / (l * d)), 1.0) * sqrt(((d / l) * (d / h)));
                    	} else if (t_0 <= 5e+174) {
                    		tmp = sqrt((d / h)) * sqrt((d / l));
                    	} else if (t_0 <= ((double) INFINITY)) {
                    		tmp = (sqrt((h / l)) * d) / h;
                    	} else {
                    		tmp = fma((-0.25 * (D_m / l)), ((M_m / d) * ((h * ((D_m / d) * 0.5)) * M_m)), 1.0) * (d / sqrt((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 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
                    	tmp = 0.0
                    	if (t_0 <= -5e-45)
                    		tmp = Float64(fma(Float64(Float64(0.5 * Float64(Float64(D_m / d) * M_m)) * h), Float64(Float64(Float64(-0.25 * D_m) * M_m) / Float64(l * d)), 1.0) * sqrt(Float64(Float64(d / l) * Float64(d / h))));
                    	elseif (t_0 <= 5e+174)
                    		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
                    	elseif (t_0 <= Inf)
                    		tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h);
                    	else
                    		tmp = Float64(fma(Float64(-0.25 * Float64(D_m / l)), Float64(Float64(M_m / d) * Float64(Float64(h * Float64(Float64(D_m / d) * 0.5)) * M_m)), 1.0) * Float64(d / sqrt(Float64(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[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-45], N[(N[(N[(N[(0.5 * N[(N[(D$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] * N[(N[(N[(-0.25 * D$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+174], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(-0.25 * N[(D$95$m / l), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * N[(N[(h * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * 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 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
                    \mathbf{if}\;t\_0 \leq -5 \cdot 10^{-45}:\\
                    \;\;\;\;\mathsf{fma}\left(\left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot h, \frac{\left(-0.25 \cdot D\_m\right) \cdot M\_m}{\ell \cdot d}, 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
                    
                    \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+174}:\\
                    \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
                    
                    \mathbf{elif}\;t\_0 \leq \infty:\\
                    \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\mathsf{fma}\left(-0.25 \cdot \frac{D\_m}{\ell}, \frac{M\_m}{d} \cdot \left(\left(h \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right) \cdot M\_m\right), 1\right) \cdot \frac{d}{\sqrt{\ell \cdot 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)))) < -4.99999999999999976e-45

                      1. Initial program 86.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 rewrites41.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      if -4.99999999999999976e-45 < (*.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)))) < 4.9999999999999997e174

                      1. Initial program 87.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 rewrites39.6%

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
                        8. lower-/.f6481.6

                          \[\leadsto \sqrt{\color{blue}{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
                      8. Applied rewrites81.6%

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

                      if 4.9999999999999997e174 < (*.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 57.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 rewrites41.3%

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

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

                          \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot 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. Applied rewrites2.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \color{blue}{\mathsf{fma}\left(-0.25 \cdot \frac{D}{\ell}, \frac{M}{d} \cdot \left(\left(h \cdot \left(\frac{D}{d} \cdot 0.5\right)\right) \cdot M\right), 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}} \]
                      8. Recombined 4 regimes into one program.
                      9. Final simplification67.7%

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

                      Alternative 7: 49.0% 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({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_2 := \frac{\left(-d\right) \cdot t\_0}{h}\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-190}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+174}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{t\_0 \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \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) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                                (-
                                 1.0
                                 (*
                                  (* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
                                  (/ h l)))))
                              (t_2 (/ (* (- d) t_0) h)))
                         (if (<= t_1 -2e-190)
                           t_2
                           (if (<= t_1 5e+174)
                             (* (sqrt (/ d h)) (sqrt (/ d l)))
                             (if (<= t_1 INFINITY) (/ (* t_0 d) h) t_2)))))
                      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), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
                      	double t_2 = (-d * t_0) / h;
                      	double tmp;
                      	if (t_1 <= -2e-190) {
                      		tmp = t_2;
                      	} else if (t_1 <= 5e+174) {
                      		tmp = sqrt((d / h)) * sqrt((d / l));
                      	} else if (t_1 <= ((double) INFINITY)) {
                      		tmp = (t_0 * d) / h;
                      	} else {
                      		tmp = t_2;
                      	}
                      	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), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
                      	double t_2 = (-d * t_0) / h;
                      	double tmp;
                      	if (t_1 <= -2e-190) {
                      		tmp = t_2;
                      	} else if (t_1 <= 5e+174) {
                      		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
                      	} else if (t_1 <= Double.POSITIVE_INFINITY) {
                      		tmp = (t_0 * d) / h;
                      	} else {
                      		tmp = t_2;
                      	}
                      	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), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)))
                      	t_2 = (-d * t_0) / h
                      	tmp = 0
                      	if t_1 <= -2e-190:
                      		tmp = t_2
                      	elif t_1 <= 5e+174:
                      		tmp = math.sqrt((d / h)) * math.sqrt((d / l))
                      	elif t_1 <= math.inf:
                      		tmp = (t_0 * d) / h
                      	else:
                      		tmp = t_2
                      	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) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
                      	t_2 = Float64(Float64(Float64(-d) * t_0) / h)
                      	tmp = 0.0
                      	if (t_1 <= -2e-190)
                      		tmp = t_2;
                      	elseif (t_1 <= 5e+174)
                      		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
                      	elseif (t_1 <= Inf)
                      		tmp = Float64(Float64(t_0 * d) / h);
                      	else
                      		tmp = t_2;
                      	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) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M_m * D_m) / (2.0 * d)) ^ 2.0)) * (h / l)));
                      	t_2 = (-d * t_0) / h;
                      	tmp = 0.0;
                      	if (t_1 <= -2e-190)
                      		tmp = t_2;
                      	elseif (t_1 <= 5e+174)
                      		tmp = sqrt((d / h)) * sqrt((d / l));
                      	elseif (t_1 <= Inf)
                      		tmp = (t_0 * d) / h;
                      	else
                      		tmp = t_2;
                      	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[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-d) * t$95$0), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-190], t$95$2, If[LessEqual[t$95$1, 5e+174], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(t$95$0 * d), $MachinePrecision] / h), $MachinePrecision], t$95$2]]]]]]
                      
                      \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({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
                      t_2 := \frac{\left(-d\right) \cdot t\_0}{h}\\
                      \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-190}:\\
                      \;\;\;\;t\_2\\
                      
                      \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+174}:\\
                      \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
                      
                      \mathbf{elif}\;t\_1 \leq \infty:\\
                      \;\;\;\;\frac{t\_0 \cdot d}{h}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;t\_2\\
                      
                      
                      \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)))) < -2e-190 or +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 58.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 rewrites30.8%

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

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

                          if -2e-190 < (*.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)))) < 4.9999999999999997e174

                          1. Initial program 87.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 rewrites39.1%

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
                            8. lower-/.f6485.8

                              \[\leadsto \sqrt{\color{blue}{\frac{d}{h}}} \cdot \sqrt{\frac{d}{\ell}} \]
                          8. Applied rewrites85.8%

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

                          if 4.9999999999999997e174 < (*.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 57.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 rewrites41.3%

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

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

                              \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
                          8. Recombined 3 regimes into one program.
                          9. Final simplification51.3%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -2 \cdot 10^{-190}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+174}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \end{array} \]
                          10. Add Preprocessing

                          Alternative 8: 73.2% 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({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq 5 \cdot 10^{+174}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(-0.25 \cdot \frac{D\_m}{d}\right) \cdot M\_m, \left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.25 \cdot \frac{D\_m}{\ell}, \frac{M\_m}{d} \cdot \left(\left(h \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right) \cdot M\_m\right), 1\right) \cdot \frac{d}{\sqrt{\ell \cdot 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
                                   (*
                                    (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                                    (-
                                     1.0
                                     (*
                                      (* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
                                      (/ h l))))))
                             (if (<= t_0 5e+174)
                               (*
                                (*
                                 (fma
                                  (* (* -0.25 (/ D_m d)) M_m)
                                  (* (* 0.5 (* (/ D_m d) M_m)) (/ h l))
                                  1.0)
                                 (sqrt (/ d h)))
                                (sqrt (/ d l)))
                               (if (<= t_0 INFINITY)
                                 (/ (* (sqrt (/ h l)) d) h)
                                 (*
                                  (fma
                                   (* -0.25 (/ D_m l))
                                   (* (/ M_m d) (* (* h (* (/ D_m d) 0.5)) M_m))
                                   1.0)
                                  (/ d (sqrt (* 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 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
                          	double tmp;
                          	if (t_0 <= 5e+174) {
                          		tmp = (fma(((-0.25 * (D_m / d)) * M_m), ((0.5 * ((D_m / d) * M_m)) * (h / l)), 1.0) * sqrt((d / h))) * sqrt((d / l));
                          	} else if (t_0 <= ((double) INFINITY)) {
                          		tmp = (sqrt((h / l)) * d) / h;
                          	} else {
                          		tmp = fma((-0.25 * (D_m / l)), ((M_m / d) * ((h * ((D_m / d) * 0.5)) * M_m)), 1.0) * (d / sqrt((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 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
                          	tmp = 0.0
                          	if (t_0 <= 5e+174)
                          		tmp = Float64(Float64(fma(Float64(Float64(-0.25 * Float64(D_m / d)) * M_m), Float64(Float64(0.5 * Float64(Float64(D_m / d) * M_m)) * Float64(h / l)), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l)));
                          	elseif (t_0 <= Inf)
                          		tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h);
                          	else
                          		tmp = Float64(fma(Float64(-0.25 * Float64(D_m / l)), Float64(Float64(M_m / d) * Float64(Float64(h * Float64(Float64(D_m / d) * 0.5)) * M_m)), 1.0) * Float64(d / sqrt(Float64(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[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+174], N[(N[(N[(N[(N[(-0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(N[(0.5 * N[(N[(D$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(-0.25 * N[(D$95$m / l), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * N[(N[(h * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * 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 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
                          \mathbf{if}\;t\_0 \leq 5 \cdot 10^{+174}:\\
                          \;\;\;\;\left(\mathsf{fma}\left(\left(-0.25 \cdot \frac{D\_m}{d}\right) \cdot M\_m, \left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
                          
                          \mathbf{elif}\;t\_0 \leq \infty:\\
                          \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\mathsf{fma}\left(-0.25 \cdot \frac{D\_m}{\ell}, \frac{M\_m}{d} \cdot \left(\left(h \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right) \cdot M\_m\right), 1\right) \cdot \frac{d}{\sqrt{\ell \cdot 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)))) < 4.9999999999999997e174

                            1. Initial program 87.0%

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

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

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

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

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

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

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

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

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

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

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

                            if 4.9999999999999997e174 < (*.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 57.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 rewrites41.3%

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

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

                                \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot 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. Applied rewrites2.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            Alternative 9: 80.1% accurate, 1.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 := \mathsf{fma}\left(\left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot h, \frac{M\_m}{\ell} \cdot \left(-0.25 \cdot \frac{D\_m}{d}\right), 1\right)\\ t_1 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(t\_0 \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\right) \cdot t\_1\\ \mathbf{elif}\;h \leq 6.4 \cdot 10^{+140}:\\ \;\;\;\;\left(\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\right) \cdot \left(1 - \frac{\frac{M\_m}{d} \cdot \left(0.25 \cdot D\_m\right)}{\ell \cdot \left({h}^{-1} \cdot \frac{2}{M\_m \cdot \frac{D\_m}{d}}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot t\_1\\ \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
                                     (fma
                                      (* (* 0.5 (* (/ D_m d) M_m)) h)
                                      (* (/ M_m l) (* -0.25 (/ D_m d)))
                                      1.0))
                                    (t_1 (sqrt (/ d l))))
                               (if (<= h -2e-310)
                                 (* (* t_0 (/ (sqrt (- d)) (sqrt (- h)))) t_1)
                                 (if (<= h 6.4e+140)
                                   (*
                                    (* (sqrt (pow (* l h) -1.0)) d)
                                    (-
                                     1.0
                                     (/
                                      (* (/ M_m d) (* 0.25 D_m))
                                      (* l (* (pow h -1.0) (/ 2.0 (* M_m (/ D_m d))))))))
                                   (* (* t_0 (/ (sqrt d) (sqrt h))) t_1)))))
                            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 = fma(((0.5 * ((D_m / d) * M_m)) * h), ((M_m / l) * (-0.25 * (D_m / d))), 1.0);
                            	double t_1 = sqrt((d / l));
                            	double tmp;
                            	if (h <= -2e-310) {
                            		tmp = (t_0 * (sqrt(-d) / sqrt(-h))) * t_1;
                            	} else if (h <= 6.4e+140) {
                            		tmp = (sqrt(pow((l * h), -1.0)) * d) * (1.0 - (((M_m / d) * (0.25 * D_m)) / (l * (pow(h, -1.0) * (2.0 / (M_m * (D_m / d)))))));
                            	} else {
                            		tmp = (t_0 * (sqrt(d) / sqrt(h))) * t_1;
                            	}
                            	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 = fma(Float64(Float64(0.5 * Float64(Float64(D_m / d) * M_m)) * h), Float64(Float64(M_m / l) * Float64(-0.25 * Float64(D_m / d))), 1.0)
                            	t_1 = sqrt(Float64(d / l))
                            	tmp = 0.0
                            	if (h <= -2e-310)
                            		tmp = Float64(Float64(t_0 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h)))) * t_1);
                            	elseif (h <= 6.4e+140)
                            		tmp = Float64(Float64(sqrt((Float64(l * h) ^ -1.0)) * d) * Float64(1.0 - Float64(Float64(Float64(M_m / d) * Float64(0.25 * D_m)) / Float64(l * Float64((h ^ -1.0) * Float64(2.0 / Float64(M_m * Float64(D_m / d))))))));
                            	else
                            		tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(h))) * t_1);
                            	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[(0.5 * N[(N[(D$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] * N[(N[(M$95$m / l), $MachinePrecision] * N[(-0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -2e-310], N[(N[(t$95$0 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[h, 6.4e+140], N[(N[(N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] * N[(1.0 - N[(N[(N[(M$95$m / d), $MachinePrecision] * N[(0.25 * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(l * N[(N[Power[h, -1.0], $MachinePrecision] * N[(2.0 / N[(M$95$m * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $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 := \mathsf{fma}\left(\left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot h, \frac{M\_m}{\ell} \cdot \left(-0.25 \cdot \frac{D\_m}{d}\right), 1\right)\\
                            t_1 := \sqrt{\frac{d}{\ell}}\\
                            \mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
                            \;\;\;\;\left(t\_0 \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\right) \cdot t\_1\\
                            
                            \mathbf{elif}\;h \leq 6.4 \cdot 10^{+140}:\\
                            \;\;\;\;\left(\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\right) \cdot \left(1 - \frac{\frac{M\_m}{d} \cdot \left(0.25 \cdot D\_m\right)}{\ell \cdot \left({h}^{-1} \cdot \frac{2}{M\_m \cdot \frac{D\_m}{d}}\right)}\right)\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot t\_1\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 3 regimes
                            2. if h < -1.999999999999994e-310

                              1. Initial program 62.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              if -1.999999999999994e-310 < h < 6.40000000000000021e140

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              if 6.40000000000000021e140 < h

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            Alternative 10: 79.9% 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 := \mathsf{fma}\left(\left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot h, \frac{M\_m}{\ell} \cdot \left(-0.25 \cdot \frac{D\_m}{d}\right), 1\right)\\ t_1 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\left(t\_0 \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\right) \cdot t\_1\\ \mathbf{elif}\;h \leq 6.4 \cdot 10^{+140}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(\left(0.5 \cdot M\_m\right) \cdot \frac{D\_m}{d}\right) \cdot \left(h \cdot \frac{M\_m}{\ell}\right)\right) \cdot \frac{D\_m}{d}, -0.25, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot t\_1\\ \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
                                     (fma
                                      (* (* 0.5 (* (/ D_m d) M_m)) h)
                                      (* (/ M_m l) (* -0.25 (/ D_m d)))
                                      1.0))
                                    (t_1 (sqrt (/ d l))))
                               (if (<= h -2e-310)
                                 (* (* t_0 (/ (sqrt (- d)) (sqrt (- h)))) t_1)
                                 (if (<= h 6.4e+140)
                                   (*
                                    (fma
                                     (* (* (* (* 0.5 M_m) (/ D_m d)) (* h (/ M_m l))) (/ D_m d))
                                     -0.25
                                     1.0)
                                    (/ d (sqrt (* l h))))
                                   (* (* t_0 (/ (sqrt d) (sqrt h))) t_1)))))
                            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 = fma(((0.5 * ((D_m / d) * M_m)) * h), ((M_m / l) * (-0.25 * (D_m / d))), 1.0);
                            	double t_1 = sqrt((d / l));
                            	double tmp;
                            	if (h <= -2e-310) {
                            		tmp = (t_0 * (sqrt(-d) / sqrt(-h))) * t_1;
                            	} else if (h <= 6.4e+140) {
                            		tmp = fma(((((0.5 * M_m) * (D_m / d)) * (h * (M_m / l))) * (D_m / d)), -0.25, 1.0) * (d / sqrt((l * h)));
                            	} else {
                            		tmp = (t_0 * (sqrt(d) / sqrt(h))) * t_1;
                            	}
                            	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 = fma(Float64(Float64(0.5 * Float64(Float64(D_m / d) * M_m)) * h), Float64(Float64(M_m / l) * Float64(-0.25 * Float64(D_m / d))), 1.0)
                            	t_1 = sqrt(Float64(d / l))
                            	tmp = 0.0
                            	if (h <= -2e-310)
                            		tmp = Float64(Float64(t_0 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h)))) * t_1);
                            	elseif (h <= 6.4e+140)
                            		tmp = Float64(fma(Float64(Float64(Float64(Float64(0.5 * M_m) * Float64(D_m / d)) * Float64(h * Float64(M_m / l))) * Float64(D_m / d)), -0.25, 1.0) * Float64(d / sqrt(Float64(l * h))));
                            	else
                            		tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(h))) * t_1);
                            	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[(0.5 * N[(N[(D$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] * N[(N[(M$95$m / l), $MachinePrecision] * N[(-0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -2e-310], N[(N[(t$95$0 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[h, 6.4e+140], N[(N[(N[(N[(N[(N[(0.5 * M$95$m), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $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 := \mathsf{fma}\left(\left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot h, \frac{M\_m}{\ell} \cdot \left(-0.25 \cdot \frac{D\_m}{d}\right), 1\right)\\
                            t_1 := \sqrt{\frac{d}{\ell}}\\
                            \mathbf{if}\;h \leq -2 \cdot 10^{-310}:\\
                            \;\;\;\;\left(t\_0 \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\right) \cdot t\_1\\
                            
                            \mathbf{elif}\;h \leq 6.4 \cdot 10^{+140}:\\
                            \;\;\;\;\mathsf{fma}\left(\left(\left(\left(0.5 \cdot M\_m\right) \cdot \frac{D\_m}{d}\right) \cdot \left(h \cdot \frac{M\_m}{\ell}\right)\right) \cdot \frac{D\_m}{d}, -0.25, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot t\_1\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 3 regimes
                            2. if h < -1.999999999999994e-310

                              1. Initial program 62.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              if -1.999999999999994e-310 < h < 6.40000000000000021e140

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

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

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

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

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

                              if 6.40000000000000021e140 < h

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

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

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

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

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

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

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

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

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

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

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

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

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

                            Alternative 11: 74.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 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;h \leq 3 \cdot 10^{-309}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{D\_m}{d} \cdot 0.5, M\_m \cdot \left(\left(h \cdot \left(-0.25 \cdot \frac{M\_m}{\ell}\right)\right) \cdot \frac{D\_m}{d}\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_0\\ \mathbf{elif}\;h \leq 6.4 \cdot 10^{+140}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(\left(0.5 \cdot M\_m\right) \cdot \frac{D\_m}{d}\right) \cdot \left(h \cdot \frac{M\_m}{\ell}\right)\right) \cdot \frac{D\_m}{d}, -0.25, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot h, \frac{M\_m}{\ell} \cdot \left(-0.25 \cdot \frac{D\_m}{d}\right), 1\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot t\_0\\ \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))))
                               (if (<= h 3e-309)
                                 (*
                                  (*
                                   (fma
                                    (* (/ D_m d) 0.5)
                                    (* M_m (* (* h (* -0.25 (/ M_m l))) (/ D_m d)))
                                    1.0)
                                   (sqrt (/ d h)))
                                  t_0)
                                 (if (<= h 6.4e+140)
                                   (*
                                    (fma
                                     (* (* (* (* 0.5 M_m) (/ D_m d)) (* h (/ M_m l))) (/ D_m d))
                                     -0.25
                                     1.0)
                                    (/ d (sqrt (* l h))))
                                   (*
                                    (*
                                     (fma
                                      (* (* 0.5 (* (/ D_m d) M_m)) h)
                                      (* (/ M_m l) (* -0.25 (/ D_m d)))
                                      1.0)
                                     (/ (sqrt d) (sqrt h)))
                                    t_0)))))
                            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 tmp;
                            	if (h <= 3e-309) {
                            		tmp = (fma(((D_m / d) * 0.5), (M_m * ((h * (-0.25 * (M_m / l))) * (D_m / d))), 1.0) * sqrt((d / h))) * t_0;
                            	} else if (h <= 6.4e+140) {
                            		tmp = fma(((((0.5 * M_m) * (D_m / d)) * (h * (M_m / l))) * (D_m / d)), -0.25, 1.0) * (d / sqrt((l * h)));
                            	} else {
                            		tmp = (fma(((0.5 * ((D_m / d) * M_m)) * h), ((M_m / l) * (-0.25 * (D_m / d))), 1.0) * (sqrt(d) / sqrt(h))) * t_0;
                            	}
                            	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))
                            	tmp = 0.0
                            	if (h <= 3e-309)
                            		tmp = Float64(Float64(fma(Float64(Float64(D_m / d) * 0.5), Float64(M_m * Float64(Float64(h * Float64(-0.25 * Float64(M_m / l))) * Float64(D_m / d))), 1.0) * sqrt(Float64(d / h))) * t_0);
                            	elseif (h <= 6.4e+140)
                            		tmp = Float64(fma(Float64(Float64(Float64(Float64(0.5 * M_m) * Float64(D_m / d)) * Float64(h * Float64(M_m / l))) * Float64(D_m / d)), -0.25, 1.0) * Float64(d / sqrt(Float64(l * h))));
                            	else
                            		tmp = Float64(Float64(fma(Float64(Float64(0.5 * Float64(Float64(D_m / d) * M_m)) * h), Float64(Float64(M_m / l) * Float64(-0.25 * Float64(D_m / d))), 1.0) * Float64(sqrt(d) / sqrt(h))) * t_0);
                            	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]}, If[LessEqual[h, 3e-309], N[(N[(N[(N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision] * N[(M$95$m * N[(N[(h * N[(-0.25 * N[(M$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[h, 6.4e+140], N[(N[(N[(N[(N[(N[(0.5 * M$95$m), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(0.5 * N[(N[(D$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] * N[(N[(M$95$m / l), $MachinePrecision] * N[(-0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $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}}\\
                            \mathbf{if}\;h \leq 3 \cdot 10^{-309}:\\
                            \;\;\;\;\left(\mathsf{fma}\left(\frac{D\_m}{d} \cdot 0.5, M\_m \cdot \left(\left(h \cdot \left(-0.25 \cdot \frac{M\_m}{\ell}\right)\right) \cdot \frac{D\_m}{d}\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_0\\
                            
                            \mathbf{elif}\;h \leq 6.4 \cdot 10^{+140}:\\
                            \;\;\;\;\mathsf{fma}\left(\left(\left(\left(0.5 \cdot M\_m\right) \cdot \frac{D\_m}{d}\right) \cdot \left(h \cdot \frac{M\_m}{\ell}\right)\right) \cdot \frac{D\_m}{d}, -0.25, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\left(\mathsf{fma}\left(\left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot h, \frac{M\_m}{\ell} \cdot \left(-0.25 \cdot \frac{D\_m}{d}\right), 1\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot t\_0\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 3 regimes
                            2. if h < 3.000000000000001e-309

                              1. Initial program 62.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              if 3.000000000000001e-309 < h < 6.40000000000000021e140

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

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

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

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

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

                              if 6.40000000000000021e140 < h

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

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

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

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

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

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

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

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

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

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

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

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

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

                            Alternative 12: 46.3% accurate, 3.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} \mathbf{if}\;\ell \leq 3.6 \cdot 10^{-271}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \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 3.6e-271)
                               (* (- d) (sqrt (pow (* l h) -1.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 tmp;
                            	if (l <= 3.6e-271) {
                            		tmp = -d * sqrt(pow((l * h), -1.0));
                            	} 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 <= 3.6d-271) then
                                    tmp = -d * sqrt(((l * h) ** (-1.0d0)))
                                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 <= 3.6e-271) {
                            		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
                            	} 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 <= 3.6e-271:
                            		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
                            	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 <= 3.6e-271)
                            		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
                            	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 <= 3.6e-271)
                            		tmp = -d * sqrt(((l * h) ^ -1.0));
                            	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, 3.6e-271], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                            
                            \begin{array}{l}
                            D_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 3.6 \cdot 10^{-271}:\\
                            \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if l < 3.5999999999999998e-271

                              1. Initial program 64.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 l around -inf

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

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

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

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

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

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

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

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

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

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

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

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

                              if 3.5999999999999998e-271 < 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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

                                Alternative 13: 42.5% accurate, 3.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} \mathbf{if}\;\ell \leq 3.4 \cdot 10^{-269}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot 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 3.4e-269) (* (- d) (sqrt (pow (* l h) -1.0))) (/ d (sqrt (* 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 tmp;
                                	if (l <= 3.4e-269) {
                                		tmp = -d * sqrt(pow((l * h), -1.0));
                                	} else {
                                		tmp = d / sqrt((l * 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 <= 3.4d-269) then
                                        tmp = -d * sqrt(((l * h) ** (-1.0d0)))
                                    else
                                        tmp = d / sqrt((l * 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 <= 3.4e-269) {
                                		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
                                	} else {
                                		tmp = d / Math.sqrt((l * 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 <= 3.4e-269:
                                		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
                                	else:
                                		tmp = d / math.sqrt((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)
                                	tmp = 0.0
                                	if (l <= 3.4e-269)
                                		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
                                	else
                                		tmp = Float64(d / sqrt(Float64(l * 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 <= 3.4e-269)
                                		tmp = -d * sqrt(((l * h) ^ -1.0));
                                	else
                                		tmp = d / sqrt((l * 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, 3.4e-269], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
                                
                                \begin{array}{l}
                                D_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 3.4 \cdot 10^{-269}:\\
                                \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if l < 3.3999999999999997e-269

                                  1. Initial program 64.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 l around -inf

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

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

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

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

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

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

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

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

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

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

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

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

                                  if 3.3999999999999997e-269 < 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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

                                  Alternative 14: 69.7% accurate, 3.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 := \left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot h\\ t_1 := \left(\mathsf{fma}\left(t\_0, \frac{\left(-0.25 \cdot D\_m\right) \cdot M\_m}{\ell \cdot d}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;h \leq -1.85 \cdot 10^{-131}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;h \leq 9 \cdot 10^{-309}:\\ \;\;\;\;\mathsf{fma}\left(t\_0, \frac{M\_m}{\ell} \cdot \left(-0.25 \cdot \frac{D\_m}{d}\right), 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;h \leq 3.95 \cdot 10^{+186}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(\left(0.5 \cdot M\_m\right) \cdot \frac{D\_m}{d}\right) \cdot \left(h \cdot \frac{M\_m}{\ell}\right)\right) \cdot \frac{D\_m}{d}, -0.25, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \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 (* (* 0.5 (* (/ D_m d) M_m)) h))
                                          (t_1
                                           (*
                                            (* (fma t_0 (/ (* (* -0.25 D_m) M_m) (* l d)) 1.0) (sqrt (/ d h)))
                                            (sqrt (/ d l)))))
                                     (if (<= h -1.85e-131)
                                       t_1
                                       (if (<= h 9e-309)
                                         (*
                                          (fma t_0 (* (/ M_m l) (* -0.25 (/ D_m d))) 1.0)
                                          (sqrt (* (/ d l) (/ d h))))
                                         (if (<= h 3.95e+186)
                                           (*
                                            (fma
                                             (* (* (* (* 0.5 M_m) (/ D_m d)) (* h (/ M_m l))) (/ D_m d))
                                             -0.25
                                             1.0)
                                            (/ d (sqrt (* l h))))
                                           t_1)))))
                                  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 = (0.5 * ((D_m / d) * M_m)) * h;
                                  	double t_1 = (fma(t_0, (((-0.25 * D_m) * M_m) / (l * d)), 1.0) * sqrt((d / h))) * sqrt((d / l));
                                  	double tmp;
                                  	if (h <= -1.85e-131) {
                                  		tmp = t_1;
                                  	} else if (h <= 9e-309) {
                                  		tmp = fma(t_0, ((M_m / l) * (-0.25 * (D_m / d))), 1.0) * sqrt(((d / l) * (d / h)));
                                  	} else if (h <= 3.95e+186) {
                                  		tmp = fma(((((0.5 * M_m) * (D_m / d)) * (h * (M_m / l))) * (D_m / d)), -0.25, 1.0) * (d / sqrt((l * h)));
                                  	} else {
                                  		tmp = t_1;
                                  	}
                                  	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(0.5 * Float64(Float64(D_m / d) * M_m)) * h)
                                  	t_1 = Float64(Float64(fma(t_0, Float64(Float64(Float64(-0.25 * D_m) * M_m) / Float64(l * d)), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l)))
                                  	tmp = 0.0
                                  	if (h <= -1.85e-131)
                                  		tmp = t_1;
                                  	elseif (h <= 9e-309)
                                  		tmp = Float64(fma(t_0, Float64(Float64(M_m / l) * Float64(-0.25 * Float64(D_m / d))), 1.0) * sqrt(Float64(Float64(d / l) * Float64(d / h))));
                                  	elseif (h <= 3.95e+186)
                                  		tmp = Float64(fma(Float64(Float64(Float64(Float64(0.5 * M_m) * Float64(D_m / d)) * Float64(h * Float64(M_m / l))) * Float64(D_m / d)), -0.25, 1.0) * Float64(d / sqrt(Float64(l * h))));
                                  	else
                                  		tmp = t_1;
                                  	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[(0.5 * N[(N[(D$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(t$95$0 * N[(N[(N[(-0.25 * D$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.85e-131], t$95$1, If[LessEqual[h, 9e-309], N[(N[(t$95$0 * N[(N[(M$95$m / l), $MachinePrecision] * N[(-0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 3.95e+186], N[(N[(N[(N[(N[(N[(0.5 * M$95$m), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
                                  
                                  \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(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot h\\
                                  t_1 := \left(\mathsf{fma}\left(t\_0, \frac{\left(-0.25 \cdot D\_m\right) \cdot M\_m}{\ell \cdot d}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
                                  \mathbf{if}\;h \leq -1.85 \cdot 10^{-131}:\\
                                  \;\;\;\;t\_1\\
                                  
                                  \mathbf{elif}\;h \leq 9 \cdot 10^{-309}:\\
                                  \;\;\;\;\mathsf{fma}\left(t\_0, \frac{M\_m}{\ell} \cdot \left(-0.25 \cdot \frac{D\_m}{d}\right), 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
                                  
                                  \mathbf{elif}\;h \leq 3.95 \cdot 10^{+186}:\\
                                  \;\;\;\;\mathsf{fma}\left(\left(\left(\left(0.5 \cdot M\_m\right) \cdot \frac{D\_m}{d}\right) \cdot \left(h \cdot \frac{M\_m}{\ell}\right)\right) \cdot \frac{D\_m}{d}, -0.25, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;t\_1\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 3 regimes
                                  2. if h < -1.8500000000000001e-131 or 3.95000000000000001e186 < h

                                    1. Initial program 66.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    if -1.8500000000000001e-131 < h < 9.0000000000000021e-309

                                    1. Initial program 59.2%

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

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

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

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

                                    if 9.0000000000000021e-309 < h < 3.95000000000000001e186

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

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

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

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

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

                                  Alternative 15: 67.8% accurate, 3.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} \mathbf{if}\;\ell \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\mathsf{fma}\left(\left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot h, \frac{M\_m}{\ell} \cdot \left(-0.25 \cdot \frac{D\_m}{d}\right), 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{elif}\;\ell \leq 1.08 \cdot 10^{+104}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(\left(0.5 \cdot M\_m\right) \cdot \frac{D\_m}{d}\right) \cdot \left(h \cdot \frac{M\_m}{\ell}\right)\right) \cdot \frac{D\_m}{d}, -0.25, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\ \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 -1e-309)
                                     (*
                                      (fma (* (* 0.5 (* (/ D_m d) M_m)) h) (* (/ M_m l) (* -0.25 (/ D_m d))) 1.0)
                                      (sqrt (* (/ d l) (/ d h))))
                                     (if (<= l 1.08e+104)
                                       (*
                                        (fma
                                         (* (* (* (* 0.5 M_m) (/ D_m d)) (* h (/ M_m l))) (/ D_m d))
                                         -0.25
                                         1.0)
                                        (/ d (sqrt (* l h))))
                                       (/ 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 <= -1e-309) {
                                  		tmp = fma(((0.5 * ((D_m / d) * M_m)) * h), ((M_m / l) * (-0.25 * (D_m / d))), 1.0) * sqrt(((d / l) * (d / h)));
                                  	} else if (l <= 1.08e+104) {
                                  		tmp = fma(((((0.5 * M_m) * (D_m / d)) * (h * (M_m / l))) * (D_m / d)), -0.25, 1.0) * (d / sqrt((l * h)));
                                  	} 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)
                                  	tmp = 0.0
                                  	if (l <= -1e-309)
                                  		tmp = Float64(fma(Float64(Float64(0.5 * Float64(Float64(D_m / d) * M_m)) * h), Float64(Float64(M_m / l) * Float64(-0.25 * Float64(D_m / d))), 1.0) * sqrt(Float64(Float64(d / l) * Float64(d / h))));
                                  	elseif (l <= 1.08e+104)
                                  		tmp = Float64(fma(Float64(Float64(Float64(Float64(0.5 * M_m) * Float64(D_m / d)) * Float64(h * Float64(M_m / l))) * Float64(D_m / d)), -0.25, 1.0) * Float64(d / sqrt(Float64(l * h))));
                                  	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_] := If[LessEqual[l, -1e-309], N[(N[(N[(N[(0.5 * N[(N[(D$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] * N[(N[(M$95$m / l), $MachinePrecision] * N[(-0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.08e+104], N[(N[(N[(N[(N[(N[(0.5 * M$95$m), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $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 -1 \cdot 10^{-309}:\\
                                  \;\;\;\;\mathsf{fma}\left(\left(0.5 \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot h, \frac{M\_m}{\ell} \cdot \left(-0.25 \cdot \frac{D\_m}{d}\right), 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
                                  
                                  \mathbf{elif}\;\ell \leq 1.08 \cdot 10^{+104}:\\
                                  \;\;\;\;\mathsf{fma}\left(\left(\left(\left(0.5 \cdot M\_m\right) \cdot \frac{D\_m}{d}\right) \cdot \left(h \cdot \frac{M\_m}{\ell}\right)\right) \cdot \frac{D\_m}{d}, -0.25, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 3 regimes
                                  2. if l < -1.000000000000002e-309

                                    1. Initial program 62.7%

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

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

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

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

                                    if -1.000000000000002e-309 < l < 1.07999999999999997e104

                                    1. Initial program 76.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}{\frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{-2}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
                                    4. Applied rewrites0.0%

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

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

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

                                    if 1.07999999999999997e104 < l

                                    1. Initial program 59.1%

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

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

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

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

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

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

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

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

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

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

                                          \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
                                      3. Recombined 3 regimes into one program.
                                      4. Add Preprocessing

                                      Alternative 16: 60.8% 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} \mathbf{if}\;\ell \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}\\ \mathbf{elif}\;\ell \leq 1.08 \cdot 10^{+104}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(\left(0.5 \cdot M\_m\right) \cdot \frac{D\_m}{d}\right) \cdot \left(h \cdot \frac{M\_m}{\ell}\right)\right) \cdot \frac{D\_m}{d}, -0.25, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\ \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 -1e-309)
                                         (/ (* (sqrt (/ d h)) (sqrt (- d))) (sqrt (- l)))
                                         (if (<= l 1.08e+104)
                                           (*
                                            (fma
                                             (* (* (* (* 0.5 M_m) (/ D_m d)) (* h (/ M_m l))) (/ D_m d))
                                             -0.25
                                             1.0)
                                            (/ d (sqrt (* l h))))
                                           (/ 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 <= -1e-309) {
                                      		tmp = (sqrt((d / h)) * sqrt(-d)) / sqrt(-l);
                                      	} else if (l <= 1.08e+104) {
                                      		tmp = fma(((((0.5 * M_m) * (D_m / d)) * (h * (M_m / l))) * (D_m / d)), -0.25, 1.0) * (d / sqrt((l * h)));
                                      	} 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)
                                      	tmp = 0.0
                                      	if (l <= -1e-309)
                                      		tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(-d))) / sqrt(Float64(-l)));
                                      	elseif (l <= 1.08e+104)
                                      		tmp = Float64(fma(Float64(Float64(Float64(Float64(0.5 * M_m) * Float64(D_m / d)) * Float64(h * Float64(M_m / l))) * Float64(D_m / d)), -0.25, 1.0) * Float64(d / sqrt(Float64(l * h))));
                                      	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_] := If[LessEqual[l, -1e-309], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.08e+104], N[(N[(N[(N[(N[(N[(0.5 * M$95$m), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M$95$m / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] * -0.25 + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $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 -1 \cdot 10^{-309}:\\
                                      \;\;\;\;\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}\\
                                      
                                      \mathbf{elif}\;\ell \leq 1.08 \cdot 10^{+104}:\\
                                      \;\;\;\;\mathsf{fma}\left(\left(\left(\left(0.5 \cdot M\_m\right) \cdot \frac{D\_m}{d}\right) \cdot \left(h \cdot \frac{M\_m}{\ell}\right)\right) \cdot \frac{D\_m}{d}, -0.25, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 3 regimes
                                      2. if l < -1.000000000000002e-309

                                        1. Initial program 62.7%

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

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

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

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

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

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

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

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

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

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

                                            \[\leadsto \frac{\color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
                                          8. lower-/.f6440.1

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

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

                                        if -1.000000000000002e-309 < l < 1.07999999999999997e104

                                        1. Initial program 76.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}{\frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{-2}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
                                        4. Applied rewrites0.0%

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

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

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

                                        if 1.07999999999999997e104 < l

                                        1. Initial program 59.1%

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

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

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

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

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

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

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

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

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

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

                                              \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
                                          3. Recombined 3 regimes into one program.
                                          4. Add Preprocessing

                                          Alternative 17: 58.3% 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} \mathbf{if}\;\ell \leq -1 \cdot 10^{-309}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}\\ \mathbf{elif}\;\ell \leq 4.9 \cdot 10^{+110}:\\ \;\;\;\;\mathsf{fma}\left(-0.25 \cdot \frac{D\_m}{\ell}, \frac{M\_m}{d} \cdot \left(\left(h \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right) \cdot M\_m\right), 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\ \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 -1e-309)
                                             (/ (* (sqrt (/ d h)) (sqrt (- d))) (sqrt (- l)))
                                             (if (<= l 4.9e+110)
                                               (*
                                                (fma
                                                 (* -0.25 (/ D_m l))
                                                 (* (/ M_m d) (* (* h (* (/ D_m d) 0.5)) M_m))
                                                 1.0)
                                                (/ d (sqrt (* l h))))
                                               (/ 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 <= -1e-309) {
                                          		tmp = (sqrt((d / h)) * sqrt(-d)) / sqrt(-l);
                                          	} else if (l <= 4.9e+110) {
                                          		tmp = fma((-0.25 * (D_m / l)), ((M_m / d) * ((h * ((D_m / d) * 0.5)) * M_m)), 1.0) * (d / sqrt((l * h)));
                                          	} 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)
                                          	tmp = 0.0
                                          	if (l <= -1e-309)
                                          		tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(-d))) / sqrt(Float64(-l)));
                                          	elseif (l <= 4.9e+110)
                                          		tmp = Float64(fma(Float64(-0.25 * Float64(D_m / l)), Float64(Float64(M_m / d) * Float64(Float64(h * Float64(Float64(D_m / d) * 0.5)) * M_m)), 1.0) * Float64(d / sqrt(Float64(l * h))));
                                          	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_] := If[LessEqual[l, -1e-309], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.9e+110], N[(N[(N[(-0.25 * N[(D$95$m / l), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * N[(N[(h * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $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 -1 \cdot 10^{-309}:\\
                                          \;\;\;\;\frac{\sqrt{\frac{d}{h}} \cdot \sqrt{-d}}{\sqrt{-\ell}}\\
                                          
                                          \mathbf{elif}\;\ell \leq 4.9 \cdot 10^{+110}:\\
                                          \;\;\;\;\mathsf{fma}\left(-0.25 \cdot \frac{D\_m}{\ell}, \frac{M\_m}{d} \cdot \left(\left(h \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right) \cdot M\_m\right), 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 3 regimes
                                          2. if l < -1.000000000000002e-309

                                            1. Initial program 62.7%

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

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

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

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

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

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

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

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

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

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

                                                \[\leadsto \frac{\color{blue}{\sqrt{\frac{d}{h}}} \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
                                              8. lower-/.f6440.1

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

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

                                            if -1.000000000000002e-309 < l < 4.90000000000000002e110

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                            if 4.90000000000000002e110 < l

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

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

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

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

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

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

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

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

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

                                                  \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
                                              3. Recombined 3 regimes into one program.
                                              4. Add Preprocessing

                                              Alternative 18: 26.9% 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{\ell \cdot h}} \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 (* 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) {
                                              	return d / sqrt((l * h));
                                              }
                                              
                                              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((l * h))
                                              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((l * h));
                                              }
                                              
                                              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((l * h))
                                              
                                              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(l * h)))
                                              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((l * h));
                                              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[(l * 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])\\
                                              \\
                                              \frac{d}{\sqrt{\ell \cdot h}}
                                              \end{array}
                                              
                                              Derivation
                                              1. Initial program 66.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. *-commutativeN/A

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

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

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

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

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

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

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

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

                                                Reproduce

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