Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.3% → 82.6%
Time: 19.6s
Alternatives: 25
Speedup: 2.8×

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 25 alternatives:

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

Initial Program: 66.3% 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.6% accurate, 1.2× speedup?

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

\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{-251}:\\
\;\;\;\;\left(1 - \frac{\left(\left(0.25 \cdot D\_m\right) \cdot M\right) \cdot h}{d} \cdot \frac{\left(\frac{0.5}{d} \cdot D\_m\right) \cdot M}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -3.49999999999999981e-184

    1. Initial program 60.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 rewrites73.5%

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

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

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

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

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

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

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

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

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

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

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

    if -3.49999999999999981e-184 < l < 6.5000000000000002e-251

    1. Initial program 78.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 rewrites89.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.5000000000000002e-251 < l

    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. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

        \[\leadsto \color{blue}{\left({\left(\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) \]
      3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 75.7% accurate, 0.3× speedup?

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

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_1 \leq 10^{+248}:\\
\;\;\;\;t\_2 \cdot t\_3\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\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.9999999999999999e-161

    1. Initial program 81.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

        \[\leadsto \color{blue}{\left({\left(\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) \]
      3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999999e-161 < (*.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 or 1.00000000000000005e248 < (*.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 23.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-*.f6428.7

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

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

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

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

      1. Initial program 98.6%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

          \[\leadsto \color{blue}{\left({\left(\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) \]
        3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

    Alternative 3: 70.5% accurate, 0.3× speedup?

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

      1. Initial program 79.9%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

          \[\leadsto \color{blue}{\left({\left(\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) \]
        3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\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}}\right) \cdot \sqrt{\frac{d}{h}} \]
        3. Step-by-step derivation
          1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

        if -9.99999999999999977e101 < (*.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 49.0%

          \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

            \[\leadsto \color{blue}{\left({\left(\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) \]
          3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\left(\left(D \cdot M\right) \cdot 0.5\right) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{d}}, \frac{h}{\ell} \cdot -0.5, 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)))) < 1.00000000000000005e248

        1. Initial program 98.6%

          \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

            \[\leadsto \color{blue}{\left({\left(\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) \]
          3. associate-*l*N/A

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

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

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

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

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

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

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

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

        if 1.00000000000000005e248 < (*.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 23.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-*.f6422.8

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

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

            \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
        7. Recombined 4 regimes into one program.
        8. Final simplification68.7%

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

        Alternative 4: 68.9% accurate, 0.3× speedup?

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

          1. Initial program 76.4%

            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

              \[\leadsto \color{blue}{\left({\left(\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) \]
            3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                \[\leadsto \color{blue}{\left({\left(\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) \]
              3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{\left(\left(D \cdot M\right) \cdot 0.5\right) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}{d}}, \frac{h}{\ell} \cdot -0.5, 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)))) < 1.00000000000000005e248

            1. Initial program 98.6%

              \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                \[\leadsto \color{blue}{\left({\left(\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) \]
              3. associate-*l*N/A

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

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

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

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

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

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

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

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

            if 1.00000000000000005e248 < (*.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 23.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-*.f6422.8

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

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

                \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
            7. Recombined 4 regimes into one program.
            8. Final simplification68.2%

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

            Alternative 5: 59.4% accurate, 0.3× speedup?

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

              1. Initial program 80.8%

                \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                  \[\leadsto \color{blue}{\left({\left(\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) \]
                3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if -1.99999999999999999e-73 < (*.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 or 1.00000000000000005e248 < (*.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 25.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-*.f6428.1

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

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

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

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

                1. Initial program 98.6%

                  \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-*.f64N/A

                    \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                    \[\leadsto \color{blue}{\left({\left(\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) \]
                  3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

              Alternative 6: 58.6% accurate, 0.3× speedup?

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

                1. Initial program 80.8%

                  \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-*.f64N/A

                    \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                    \[\leadsto \color{blue}{\left({\left(\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) \]
                  3. associate-*l*N/A

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

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

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

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

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

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

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

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

                if -1.99999999999999999e-73 < (*.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 or 1.00000000000000005e248 < (*.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 25.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-*.f6428.1

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

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

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

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

                  1. Initial program 98.6%

                    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                  2. Add Preprocessing
                  3. Step-by-step derivation
                    1. lift-*.f64N/A

                      \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                      \[\leadsto \color{blue}{\left({\left(\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) \]
                    3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

                Alternative 7: 58.4% accurate, 0.3× speedup?

                \[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\ t_1 := \frac{d}{\sqrt{h \cdot \ell}}\\ t_2 := \left|t\_1\right|\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{+127}:\\ \;\;\;\;\left(\left(\frac{\frac{D\_m \cdot D\_m}{d}}{d} \cdot -0.125\right) \cdot \frac{\left(M \cdot M\right) \cdot h}{\ell}\right) \cdot t\_1\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_0 \leq 10^{+248}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
                D_m = (fabs.f64 D)
                NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                (FPCore (d h l M D_m)
                 :precision binary64
                 (let* ((t_0
                         (*
                          (- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
                          (* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
                        (t_1 (/ d (sqrt (* h l))))
                        (t_2 (fabs t_1)))
                   (if (<= t_0 -1e+127)
                     (* (* (* (/ (/ (* D_m D_m) d) d) -0.125) (/ (* (* M M) h) l)) t_1)
                     (if (<= t_0 0.0)
                       t_2
                       (if (<= t_0 1e+248) (* (sqrt (/ d l)) (sqrt (/ d h))) t_2)))))
                D_m = fabs(D);
                assert(d < h && h < l && l < M && M < D_m);
                double code(double d, double h, double l, double M, double D_m) {
                	double t_0 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
                	double t_1 = d / sqrt((h * l));
                	double t_2 = fabs(t_1);
                	double tmp;
                	if (t_0 <= -1e+127) {
                		tmp = (((((D_m * D_m) / d) / d) * -0.125) * (((M * M) * h) / l)) * t_1;
                	} else if (t_0 <= 0.0) {
                		tmp = t_2;
                	} else if (t_0 <= 1e+248) {
                		tmp = sqrt((d / l)) * sqrt((d / h));
                	} else {
                		tmp = t_2;
                	}
                	return tmp;
                }
                
                D_m = abs(d)
                NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                real(8) function code(d, h, l, m, d_m)
                    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_m
                    real(8) :: t_0
                    real(8) :: t_1
                    real(8) :: t_2
                    real(8) :: tmp
                    t_0 = (1.0d0 - (((((d_m * m) / (d * 2.0d0)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))
                    t_1 = d / sqrt((h * l))
                    t_2 = abs(t_1)
                    if (t_0 <= (-1d+127)) then
                        tmp = (((((d_m * d_m) / d) / d) * (-0.125d0)) * (((m * m) * h) / l)) * t_1
                    else if (t_0 <= 0.0d0) then
                        tmp = t_2
                    else if (t_0 <= 1d+248) then
                        tmp = sqrt((d / l)) * sqrt((d / h))
                    else
                        tmp = t_2
                    end if
                    code = tmp
                end function
                
                D_m = Math.abs(D);
                assert d < h && h < l && l < M && M < D_m;
                public static double code(double d, double h, double l, double M, double D_m) {
                	double t_0 = (1.0 - ((Math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)));
                	double t_1 = d / Math.sqrt((h * l));
                	double t_2 = Math.abs(t_1);
                	double tmp;
                	if (t_0 <= -1e+127) {
                		tmp = (((((D_m * D_m) / d) / d) * -0.125) * (((M * M) * h) / l)) * t_1;
                	} else if (t_0 <= 0.0) {
                		tmp = t_2;
                	} else if (t_0 <= 1e+248) {
                		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
                	} else {
                		tmp = t_2;
                	}
                	return tmp;
                }
                
                D_m = math.fabs(D)
                [d, h, l, M, D_m] = sort([d, h, l, M, D_m])
                def code(d, h, l, M, D_m):
                	t_0 = (1.0 - ((math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0)))
                	t_1 = d / math.sqrt((h * l))
                	t_2 = math.fabs(t_1)
                	tmp = 0
                	if t_0 <= -1e+127:
                		tmp = (((((D_m * D_m) / d) / d) * -0.125) * (((M * M) * h) / l)) * t_1
                	elif t_0 <= 0.0:
                		tmp = t_2
                	elif t_0 <= 1e+248:
                		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
                	else:
                		tmp = t_2
                	return tmp
                
                D_m = abs(D)
                d, h, l, M, D_m = sort([d, h, l, M, D_m])
                function code(d, h, l, M, D_m)
                	t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))))
                	t_1 = Float64(d / sqrt(Float64(h * l)))
                	t_2 = abs(t_1)
                	tmp = 0.0
                	if (t_0 <= -1e+127)
                		tmp = Float64(Float64(Float64(Float64(Float64(Float64(D_m * D_m) / d) / d) * -0.125) * Float64(Float64(Float64(M * M) * h) / l)) * t_1);
                	elseif (t_0 <= 0.0)
                		tmp = t_2;
                	elseif (t_0 <= 1e+248)
                		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
                	else
                		tmp = t_2;
                	end
                	return tmp
                end
                
                D_m = abs(D);
                d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
                function tmp_2 = code(d, h, l, M, D_m)
                	t_0 = (1.0 - (((((D_m * M) / (d * 2.0)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)));
                	t_1 = d / sqrt((h * l));
                	t_2 = abs(t_1);
                	tmp = 0.0;
                	if (t_0 <= -1e+127)
                		tmp = (((((D_m * D_m) / d) / d) * -0.125) * (((M * M) * h) / l)) * t_1;
                	elseif (t_0 <= 0.0)
                		tmp = t_2;
                	elseif (t_0 <= 1e+248)
                		tmp = sqrt((d / l)) * sqrt((d / h));
                	else
                		tmp = t_2;
                	end
                	tmp_2 = tmp;
                end
                
                D_m = N[Abs[D], $MachinePrecision]
                NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[t$95$1], $MachinePrecision]}, If[LessEqual[t$95$0, -1e+127], N[(N[(N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$2, If[LessEqual[t$95$0, 1e+248], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
                
                \begin{array}{l}
                D_m = \left|D\right|
                \\
                [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
                \\
                \begin{array}{l}
                t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
                t_1 := \frac{d}{\sqrt{h \cdot \ell}}\\
                t_2 := \left|t\_1\right|\\
                \mathbf{if}\;t\_0 \leq -1 \cdot 10^{+127}:\\
                \;\;\;\;\left(\left(\frac{\frac{D\_m \cdot D\_m}{d}}{d} \cdot -0.125\right) \cdot \frac{\left(M \cdot M\right) \cdot h}{\ell}\right) \cdot t\_1\\
                
                \mathbf{elif}\;t\_0 \leq 0:\\
                \;\;\;\;t\_2\\
                
                \mathbf{elif}\;t\_0 \leq 10^{+248}:\\
                \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{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)))) < -9.99999999999999955e126

                  1. Initial program 79.5%

                    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                  2. Add Preprocessing
                  3. Step-by-step derivation
                    1. lift-*.f64N/A

                      \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                      \[\leadsto \color{blue}{\left({\left(\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) \]
                    3. associate-*l*N/A

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(0.25 \cdot {\left(\frac{\frac{d}{D}}{M}\right)}^{-2}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot 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 \frac{d}{\sqrt{\ell \cdot h}} \]
                  7. Step-by-step derivation
                    1. times-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  if -9.99999999999999955e126 < (*.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 or 1.00000000000000005e248 < (*.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 31.2%

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

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

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

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

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

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

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

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

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

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

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

                    1. Initial program 98.6%

                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. lift-*.f64N/A

                        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                        \[\leadsto \color{blue}{\left({\left(\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) \]
                      3. associate-*l*N/A

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

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

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

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

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

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

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

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

                    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(1 - \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq -1 \cdot 10^{+127}:\\ \;\;\;\;\left(\left(\frac{\frac{D \cdot D}{d}}{d} \cdot -0.125\right) \cdot \frac{\left(M \cdot M\right) \cdot h}{\ell}\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\\ \mathbf{elif}\;\left(1 - \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq 0:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \mathbf{elif}\;\left(1 - \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq 10^{+248}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ \end{array} \]
                  9. Add Preprocessing

                  Alternative 8: 54.5% accurate, 0.3× speedup?

                  \[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \sqrt{\frac{d}{h}}\\ t_2 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ t_3 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\ \mathbf{if}\;t\_3 \leq -5 \cdot 10^{-161}:\\ \;\;\;\;\left(-t\_0\right) \cdot t\_1\\ \mathbf{elif}\;t\_3 \leq 0:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_3 \leq 10^{+248}:\\ \;\;\;\;t\_0 \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
                  D_m = (fabs.f64 D)
                  NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                  (FPCore (d h l M D_m)
                   :precision binary64
                   (let* ((t_0 (sqrt (/ d l)))
                          (t_1 (sqrt (/ d h)))
                          (t_2 (fabs (/ d (sqrt (* h l)))))
                          (t_3
                           (*
                            (- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
                            (* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))))
                     (if (<= t_3 -5e-161)
                       (* (- t_0) t_1)
                       (if (<= t_3 0.0) t_2 (if (<= t_3 1e+248) (* t_0 t_1) t_2)))))
                  D_m = fabs(D);
                  assert(d < h && h < l && l < M && M < D_m);
                  double code(double d, double h, double l, double M, double D_m) {
                  	double t_0 = sqrt((d / l));
                  	double t_1 = sqrt((d / h));
                  	double t_2 = fabs((d / sqrt((h * l))));
                  	double t_3 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
                  	double tmp;
                  	if (t_3 <= -5e-161) {
                  		tmp = -t_0 * t_1;
                  	} else if (t_3 <= 0.0) {
                  		tmp = t_2;
                  	} else if (t_3 <= 1e+248) {
                  		tmp = t_0 * t_1;
                  	} else {
                  		tmp = t_2;
                  	}
                  	return tmp;
                  }
                  
                  D_m = abs(d)
                  NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                  real(8) function code(d, h, l, m, d_m)
                      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_m
                      real(8) :: t_0
                      real(8) :: t_1
                      real(8) :: t_2
                      real(8) :: t_3
                      real(8) :: tmp
                      t_0 = sqrt((d / l))
                      t_1 = sqrt((d / h))
                      t_2 = abs((d / sqrt((h * l))))
                      t_3 = (1.0d0 - (((((d_m * m) / (d * 2.0d0)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))
                      if (t_3 <= (-5d-161)) then
                          tmp = -t_0 * t_1
                      else if (t_3 <= 0.0d0) then
                          tmp = t_2
                      else if (t_3 <= 1d+248) then
                          tmp = t_0 * t_1
                      else
                          tmp = t_2
                      end if
                      code = tmp
                  end function
                  
                  D_m = Math.abs(D);
                  assert d < h && h < l && l < M && M < D_m;
                  public static double code(double d, double h, double l, double M, double D_m) {
                  	double t_0 = Math.sqrt((d / l));
                  	double t_1 = Math.sqrt((d / h));
                  	double t_2 = Math.abs((d / Math.sqrt((h * l))));
                  	double t_3 = (1.0 - ((Math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)));
                  	double tmp;
                  	if (t_3 <= -5e-161) {
                  		tmp = -t_0 * t_1;
                  	} else if (t_3 <= 0.0) {
                  		tmp = t_2;
                  	} else if (t_3 <= 1e+248) {
                  		tmp = t_0 * t_1;
                  	} else {
                  		tmp = t_2;
                  	}
                  	return tmp;
                  }
                  
                  D_m = math.fabs(D)
                  [d, h, l, M, D_m] = sort([d, h, l, M, D_m])
                  def code(d, h, l, M, D_m):
                  	t_0 = math.sqrt((d / l))
                  	t_1 = math.sqrt((d / h))
                  	t_2 = math.fabs((d / math.sqrt((h * l))))
                  	t_3 = (1.0 - ((math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0)))
                  	tmp = 0
                  	if t_3 <= -5e-161:
                  		tmp = -t_0 * t_1
                  	elif t_3 <= 0.0:
                  		tmp = t_2
                  	elif t_3 <= 1e+248:
                  		tmp = t_0 * t_1
                  	else:
                  		tmp = t_2
                  	return tmp
                  
                  D_m = abs(D)
                  d, h, l, M, D_m = sort([d, h, l, M, D_m])
                  function code(d, h, l, M, D_m)
                  	t_0 = sqrt(Float64(d / l))
                  	t_1 = sqrt(Float64(d / h))
                  	t_2 = abs(Float64(d / sqrt(Float64(h * l))))
                  	t_3 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))))
                  	tmp = 0.0
                  	if (t_3 <= -5e-161)
                  		tmp = Float64(Float64(-t_0) * t_1);
                  	elseif (t_3 <= 0.0)
                  		tmp = t_2;
                  	elseif (t_3 <= 1e+248)
                  		tmp = Float64(t_0 * t_1);
                  	else
                  		tmp = t_2;
                  	end
                  	return tmp
                  end
                  
                  D_m = abs(D);
                  d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
                  function tmp_2 = code(d, h, l, M, D_m)
                  	t_0 = sqrt((d / l));
                  	t_1 = sqrt((d / h));
                  	t_2 = abs((d / sqrt((h * l))));
                  	t_3 = (1.0 - (((((D_m * M) / (d * 2.0)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)));
                  	tmp = 0.0;
                  	if (t_3 <= -5e-161)
                  		tmp = -t_0 * t_1;
                  	elseif (t_3 <= 0.0)
                  		tmp = t_2;
                  	elseif (t_3 <= 1e+248)
                  		tmp = t_0 * t_1;
                  	else
                  		tmp = t_2;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  D_m = N[Abs[D], $MachinePrecision]
                  NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                  code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -5e-161], N[((-t$95$0) * t$95$1), $MachinePrecision], If[LessEqual[t$95$3, 0.0], t$95$2, If[LessEqual[t$95$3, 1e+248], N[(t$95$0 * t$95$1), $MachinePrecision], t$95$2]]]]]]]
                  
                  \begin{array}{l}
                  D_m = \left|D\right|
                  \\
                  [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
                  \\
                  \begin{array}{l}
                  t_0 := \sqrt{\frac{d}{\ell}}\\
                  t_1 := \sqrt{\frac{d}{h}}\\
                  t_2 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
                  t_3 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
                  \mathbf{if}\;t\_3 \leq -5 \cdot 10^{-161}:\\
                  \;\;\;\;\left(-t\_0\right) \cdot t\_1\\
                  
                  \mathbf{elif}\;t\_3 \leq 0:\\
                  \;\;\;\;t\_2\\
                  
                  \mathbf{elif}\;t\_3 \leq 10^{+248}:\\
                  \;\;\;\;t\_0 \cdot t\_1\\
                  
                  \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)))) < -4.9999999999999999e-161

                    1. Initial program 81.2%

                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. lift-*.f64N/A

                        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                        \[\leadsto \color{blue}{\left({\left(\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) \]
                      3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                    if -4.9999999999999999e-161 < (*.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 or 1.00000000000000005e248 < (*.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 23.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-*.f6428.7

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

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

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

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

                      1. Initial program 98.6%

                        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                      2. Add Preprocessing
                      3. Step-by-step derivation
                        1. lift-*.f64N/A

                          \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                          \[\leadsto \color{blue}{\left({\left(\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) \]
                        3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

                    Alternative 9: 52.3% accurate, 0.3× speedup?

                    \[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ t_1 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-73}:\\ \;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 10^{+248}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                    D_m = (fabs.f64 D)
                    NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                    (FPCore (d h l M D_m)
                     :precision binary64
                     (let* ((t_0 (fabs (/ d (sqrt (* h l)))))
                            (t_1
                             (*
                              (- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
                              (* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))))
                       (if (<= t_1 -2e-73)
                         (* (sqrt (/ 1.0 (* h l))) (- d))
                         (if (<= t_1 0.0)
                           t_0
                           (if (<= t_1 1e+248) (* (sqrt (/ d l)) (sqrt (/ d h))) t_0)))))
                    D_m = fabs(D);
                    assert(d < h && h < l && l < M && M < D_m);
                    double code(double d, double h, double l, double M, double D_m) {
                    	double t_0 = fabs((d / sqrt((h * l))));
                    	double t_1 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
                    	double tmp;
                    	if (t_1 <= -2e-73) {
                    		tmp = sqrt((1.0 / (h * l))) * -d;
                    	} else if (t_1 <= 0.0) {
                    		tmp = t_0;
                    	} else if (t_1 <= 1e+248) {
                    		tmp = sqrt((d / l)) * sqrt((d / h));
                    	} else {
                    		tmp = t_0;
                    	}
                    	return tmp;
                    }
                    
                    D_m = abs(d)
                    NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                    real(8) function code(d, h, l, m, d_m)
                        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_m
                        real(8) :: t_0
                        real(8) :: t_1
                        real(8) :: tmp
                        t_0 = abs((d / sqrt((h * l))))
                        t_1 = (1.0d0 - (((((d_m * m) / (d * 2.0d0)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))
                        if (t_1 <= (-2d-73)) then
                            tmp = sqrt((1.0d0 / (h * l))) * -d
                        else if (t_1 <= 0.0d0) then
                            tmp = t_0
                        else if (t_1 <= 1d+248) then
                            tmp = sqrt((d / l)) * sqrt((d / h))
                        else
                            tmp = t_0
                        end if
                        code = tmp
                    end function
                    
                    D_m = Math.abs(D);
                    assert d < h && h < l && l < M && M < D_m;
                    public static double code(double d, double h, double l, double M, double D_m) {
                    	double t_0 = Math.abs((d / Math.sqrt((h * l))));
                    	double t_1 = (1.0 - ((Math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)));
                    	double tmp;
                    	if (t_1 <= -2e-73) {
                    		tmp = Math.sqrt((1.0 / (h * l))) * -d;
                    	} else if (t_1 <= 0.0) {
                    		tmp = t_0;
                    	} else if (t_1 <= 1e+248) {
                    		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
                    	} else {
                    		tmp = t_0;
                    	}
                    	return tmp;
                    }
                    
                    D_m = math.fabs(D)
                    [d, h, l, M, D_m] = sort([d, h, l, M, D_m])
                    def code(d, h, l, M, D_m):
                    	t_0 = math.fabs((d / math.sqrt((h * l))))
                    	t_1 = (1.0 - ((math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0)))
                    	tmp = 0
                    	if t_1 <= -2e-73:
                    		tmp = math.sqrt((1.0 / (h * l))) * -d
                    	elif t_1 <= 0.0:
                    		tmp = t_0
                    	elif t_1 <= 1e+248:
                    		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
                    	else:
                    		tmp = t_0
                    	return tmp
                    
                    D_m = abs(D)
                    d, h, l, M, D_m = sort([d, h, l, M, D_m])
                    function code(d, h, l, M, D_m)
                    	t_0 = abs(Float64(d / sqrt(Float64(h * l))))
                    	t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))))
                    	tmp = 0.0
                    	if (t_1 <= -2e-73)
                    		tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d));
                    	elseif (t_1 <= 0.0)
                    		tmp = t_0;
                    	elseif (t_1 <= 1e+248)
                    		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
                    	else
                    		tmp = t_0;
                    	end
                    	return tmp
                    end
                    
                    D_m = abs(D);
                    d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
                    function tmp_2 = code(d, h, l, M, D_m)
                    	t_0 = abs((d / sqrt((h * l))));
                    	t_1 = (1.0 - (((((D_m * M) / (d * 2.0)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)));
                    	tmp = 0.0;
                    	if (t_1 <= -2e-73)
                    		tmp = sqrt((1.0 / (h * l))) * -d;
                    	elseif (t_1 <= 0.0)
                    		tmp = t_0;
                    	elseif (t_1 <= 1e+248)
                    		tmp = sqrt((d / l)) * sqrt((d / h));
                    	else
                    		tmp = t_0;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    D_m = N[Abs[D], $MachinePrecision]
                    NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                    code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-73], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$0, If[LessEqual[t$95$1, 1e+248], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
                    
                    \begin{array}{l}
                    D_m = \left|D\right|
                    \\
                    [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
                    \\
                    \begin{array}{l}
                    t_0 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
                    t_1 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
                    \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-73}:\\
                    \;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\
                    
                    \mathbf{elif}\;t\_1 \leq 0:\\
                    \;\;\;\;t\_0\\
                    
                    \mathbf{elif}\;t\_1 \leq 10^{+248}:\\
                    \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;t\_0\\
                    
                    
                    \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)))) < -1.99999999999999999e-73

                      1. Initial program 80.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 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-*.f649.5

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

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

                      if -1.99999999999999999e-73 < (*.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 or 1.00000000000000005e248 < (*.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 25.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-*.f6428.1

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

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

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

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

                        1. Initial program 98.6%

                          \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                        2. Add Preprocessing
                        3. Step-by-step derivation
                          1. lift-*.f64N/A

                            \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                            \[\leadsto \color{blue}{\left({\left(\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) \]
                          3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

                      Alternative 10: 49.9% accurate, 0.3× speedup?

                      \[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\ t_1 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-73}:\\ \;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-150}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 10^{+96}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                      D_m = (fabs.f64 D)
                      NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                      (FPCore (d h l M D_m)
                       :precision binary64
                       (let* ((t_0 (fabs (/ d (sqrt (* h l)))))
                              (t_1
                               (*
                                (- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
                                (* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))))
                         (if (<= t_1 -2e-73)
                           (* (sqrt (/ 1.0 (* h l))) (- d))
                           (if (<= t_1 2e-150)
                             t_0
                             (if (<= t_1 1e+96) (sqrt (* (/ d l) (/ d h))) t_0)))))
                      D_m = fabs(D);
                      assert(d < h && h < l && l < M && M < D_m);
                      double code(double d, double h, double l, double M, double D_m) {
                      	double t_0 = fabs((d / sqrt((h * l))));
                      	double t_1 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
                      	double tmp;
                      	if (t_1 <= -2e-73) {
                      		tmp = sqrt((1.0 / (h * l))) * -d;
                      	} else if (t_1 <= 2e-150) {
                      		tmp = t_0;
                      	} else if (t_1 <= 1e+96) {
                      		tmp = sqrt(((d / l) * (d / h)));
                      	} else {
                      		tmp = t_0;
                      	}
                      	return tmp;
                      }
                      
                      D_m = abs(d)
                      NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                      real(8) function code(d, h, l, m, d_m)
                          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_m
                          real(8) :: t_0
                          real(8) :: t_1
                          real(8) :: tmp
                          t_0 = abs((d / sqrt((h * l))))
                          t_1 = (1.0d0 - (((((d_m * m) / (d * 2.0d0)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))
                          if (t_1 <= (-2d-73)) then
                              tmp = sqrt((1.0d0 / (h * l))) * -d
                          else if (t_1 <= 2d-150) then
                              tmp = t_0
                          else if (t_1 <= 1d+96) then
                              tmp = sqrt(((d / l) * (d / h)))
                          else
                              tmp = t_0
                          end if
                          code = tmp
                      end function
                      
                      D_m = Math.abs(D);
                      assert d < h && h < l && l < M && M < D_m;
                      public static double code(double d, double h, double l, double M, double D_m) {
                      	double t_0 = Math.abs((d / Math.sqrt((h * l))));
                      	double t_1 = (1.0 - ((Math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)));
                      	double tmp;
                      	if (t_1 <= -2e-73) {
                      		tmp = Math.sqrt((1.0 / (h * l))) * -d;
                      	} else if (t_1 <= 2e-150) {
                      		tmp = t_0;
                      	} else if (t_1 <= 1e+96) {
                      		tmp = Math.sqrt(((d / l) * (d / h)));
                      	} else {
                      		tmp = t_0;
                      	}
                      	return tmp;
                      }
                      
                      D_m = math.fabs(D)
                      [d, h, l, M, D_m] = sort([d, h, l, M, D_m])
                      def code(d, h, l, M, D_m):
                      	t_0 = math.fabs((d / math.sqrt((h * l))))
                      	t_1 = (1.0 - ((math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0)))
                      	tmp = 0
                      	if t_1 <= -2e-73:
                      		tmp = math.sqrt((1.0 / (h * l))) * -d
                      	elif t_1 <= 2e-150:
                      		tmp = t_0
                      	elif t_1 <= 1e+96:
                      		tmp = math.sqrt(((d / l) * (d / h)))
                      	else:
                      		tmp = t_0
                      	return tmp
                      
                      D_m = abs(D)
                      d, h, l, M, D_m = sort([d, h, l, M, D_m])
                      function code(d, h, l, M, D_m)
                      	t_0 = abs(Float64(d / sqrt(Float64(h * l))))
                      	t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))))
                      	tmp = 0.0
                      	if (t_1 <= -2e-73)
                      		tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d));
                      	elseif (t_1 <= 2e-150)
                      		tmp = t_0;
                      	elseif (t_1 <= 1e+96)
                      		tmp = sqrt(Float64(Float64(d / l) * Float64(d / h)));
                      	else
                      		tmp = t_0;
                      	end
                      	return tmp
                      end
                      
                      D_m = abs(D);
                      d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
                      function tmp_2 = code(d, h, l, M, D_m)
                      	t_0 = abs((d / sqrt((h * l))));
                      	t_1 = (1.0 - (((((D_m * M) / (d * 2.0)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)));
                      	tmp = 0.0;
                      	if (t_1 <= -2e-73)
                      		tmp = sqrt((1.0 / (h * l))) * -d;
                      	elseif (t_1 <= 2e-150)
                      		tmp = t_0;
                      	elseif (t_1 <= 1e+96)
                      		tmp = sqrt(((d / l) * (d / h)));
                      	else
                      		tmp = t_0;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      D_m = N[Abs[D], $MachinePrecision]
                      NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                      code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-73], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[t$95$1, 2e-150], t$95$0, If[LessEqual[t$95$1, 1e+96], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
                      
                      \begin{array}{l}
                      D_m = \left|D\right|
                      \\
                      [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
                      \\
                      \begin{array}{l}
                      t_0 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
                      t_1 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
                      \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-73}:\\
                      \;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\
                      
                      \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-150}:\\
                      \;\;\;\;t\_0\\
                      
                      \mathbf{elif}\;t\_1 \leq 10^{+96}:\\
                      \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;t\_0\\
                      
                      
                      \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)))) < -1.99999999999999999e-73

                        1. Initial program 80.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 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-*.f649.5

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

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

                        if -1.99999999999999999e-73 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000001e-150 or 1.00000000000000005e96 < (*.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 39.9%

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

                          \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                        4. Step-by-step derivation
                          1. *-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-*.f6428.7

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

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

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

                          if 2.00000000000000001e-150 < (*.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.00000000000000005e96

                          1. Initial program 99.5%

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

                            \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                          4. Step-by-step derivation
                            1. *-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-*.f6438.8

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

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

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

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

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

                            Alternative 11: 61.5% accurate, 0.5× speedup?

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

                              1. Initial program 73.2%

                                \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                              2. Add Preprocessing
                              3. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                  \[\leadsto \color{blue}{\left({\left(\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) \]
                                3. associate-*l*N/A

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

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

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

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

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

                                \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot \left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right), D \cdot \left(M \cdot \frac{0.5}{d}\right), 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)))) < 1.00000000000000005e248

                              1. Initial program 98.6%

                                \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                              2. Add Preprocessing
                              3. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                  \[\leadsto \color{blue}{\left({\left(\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) \]
                                3. associate-*l*N/A

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

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

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

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

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

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

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

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

                              if 1.00000000000000005e248 < (*.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 23.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-*.f6422.8

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

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

                                  \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                              7. Recombined 3 regimes into one program.
                              8. Final simplification60.4%

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

                              Alternative 12: 60.6% accurate, 0.5× speedup?

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

                                1. Initial program 73.2%

                                  \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                2. Add Preprocessing
                                3. Step-by-step derivation
                                  1. lift-*.f64N/A

                                    \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                    \[\leadsto \color{blue}{\left({\left(\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) \]
                                  3. associate-*l*N/A

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

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

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

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

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

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

                                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)))) < 1.00000000000000005e248

                                1. Initial program 98.6%

                                  \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                2. Add Preprocessing
                                3. Step-by-step derivation
                                  1. lift-*.f64N/A

                                    \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                    \[\leadsto \color{blue}{\left({\left(\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) \]
                                  3. associate-*l*N/A

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

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

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

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

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

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

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

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

                                if 1.00000000000000005e248 < (*.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 23.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-*.f6422.8

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

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

                                    \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                7. Recombined 3 regimes into one program.
                                8. Final simplification60.3%

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

                                Alternative 13: 60.8% accurate, 0.5× speedup?

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

                                  1. Initial program 73.2%

                                    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                  2. Add Preprocessing
                                  3. Step-by-step derivation
                                    1. lift-*.f64N/A

                                      \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                      \[\leadsto \color{blue}{\left({\left(\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) \]
                                    3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\frac{D}{d} \cdot M\right) \cdot \left(\left(\frac{D}{d} \cdot M\right) \cdot 0.25\right)}, \frac{h}{\ell} \cdot -0.5, 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)))) < 1.00000000000000005e248

                                  1. Initial program 98.6%

                                    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                  2. Add Preprocessing
                                  3. Step-by-step derivation
                                    1. lift-*.f64N/A

                                      \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                      \[\leadsto \color{blue}{\left({\left(\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) \]
                                    3. associate-*l*N/A

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

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

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

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

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

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

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

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

                                  if 1.00000000000000005e248 < (*.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 23.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-*.f6422.8

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

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

                                      \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                  7. Recombined 3 regimes into one program.
                                  8. Final simplification59.1%

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

                                  Alternative 14: 57.2% accurate, 0.5× speedup?

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

                                    1. Initial program 73.2%

                                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                    2. Add Preprocessing
                                    3. Step-by-step derivation
                                      1. lift-*.f64N/A

                                        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                        \[\leadsto \color{blue}{\left({\left(\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) \]
                                      3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    1. Initial program 98.6%

                                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                    2. Add Preprocessing
                                    3. Step-by-step derivation
                                      1. lift-*.f64N/A

                                        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                        \[\leadsto \color{blue}{\left({\left(\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) \]
                                      3. associate-*l*N/A

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

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

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

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

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

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

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

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

                                    if 1.00000000000000005e248 < (*.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 23.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-*.f6422.8

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

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

                                        \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                    7. Recombined 3 regimes into one program.
                                    8. Final simplification55.9%

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

                                    Alternative 15: 75.1% accurate, 0.8× speedup?

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

                                      1. Initial program 82.5%

                                        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                      2. Add Preprocessing
                                      3. Step-by-step derivation
                                        1. lift-*.f64N/A

                                          \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                          \[\leadsto \color{blue}{\left({\left(\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) \]
                                        3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      if 1.00000000000000005e248 < (*.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 23.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-*.f6422.8

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

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

                                          \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                      7. Recombined 2 regimes into one program.
                                      8. Final simplification74.2%

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

                                      Alternative 16: 75.4% accurate, 0.8× speedup?

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

                                        1. Initial program 82.5%

                                          \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                        2. Add Preprocessing
                                        3. Step-by-step derivation
                                          1. lift-*.f64N/A

                                            \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                            \[\leadsto \color{blue}{\left({\left(\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) \]
                                          3. associate-*l*N/A

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

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

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

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

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

                                        if 1.00000000000000005e248 < (*.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 23.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-*.f6422.8

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

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

                                            \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                        7. Recombined 2 regimes into one program.
                                        8. Final simplification74.2%

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

                                        Alternative 17: 76.2% accurate, 0.8× speedup?

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

                                          1. Initial program 82.5%

                                            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                          2. Add Preprocessing
                                          3. Step-by-step derivation
                                            1. lift-*.f64N/A

                                              \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                              \[\leadsto \color{blue}{\left({\left(\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) \]
                                            3. associate-*l*N/A

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

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

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

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

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

                                          if 1.00000000000000005e248 < (*.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 23.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-*.f6422.8

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

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

                                              \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                          7. Recombined 2 regimes into one program.
                                          8. Final simplification74.9%

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

                                          Alternative 18: 73.3% accurate, 0.8× speedup?

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

                                            1. Initial program 81.5%

                                              \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                            2. Add Preprocessing
                                            3. Step-by-step derivation
                                              1. lift-*.f64N/A

                                                \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                                \[\leadsto \color{blue}{\left({\left(\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) \]
                                              3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

                                            if 1.00000000000000005e96 < (*.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 33.2%

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

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

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

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

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

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

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

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

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

                                                \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                            7. Recombined 2 regimes into one program.
                                            8. Final simplification73.5%

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

                                            Alternative 19: 45.9% accurate, 0.9× speedup?

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

                                              1. Initial program 80.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 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-*.f649.5

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

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

                                              if -1.99999999999999999e-73 < (*.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 56.0%

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

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

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

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

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

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

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

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

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

                                                  \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                              7. Recombined 2 regimes into one program.
                                              8. Final simplification42.0%

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

                                              Alternative 20: 45.9% accurate, 0.9× speedup?

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

                                                1. Initial program 80.7%

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

                                                  \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                4. Step-by-step derivation
                                                  1. *-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-*.f645.4

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

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

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

                                                  if -1.00000000000000001e-41 < (*.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 56.3%

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

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

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

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

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

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

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

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

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

                                                      \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                  7. Recombined 2 regimes into one program.
                                                  8. Final simplification40.4%

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

                                                  Alternative 21: 82.7% accurate, 1.7× speedup?

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

                                                    1. Initial program 60.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 rewrites73.5%

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

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

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

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

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

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

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

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

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

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

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

                                                    if -6.8000000000000003e-187 < l < 5.0000000000000002e-271

                                                    1. Initial program 79.2%

                                                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                    2. Add Preprocessing
                                                    3. Step-by-step derivation
                                                      1. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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) \]
                                                      3. associate-*l*N/A

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

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

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

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

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

                                                    if 5.0000000000000002e-271 < l

                                                    1. Initial program 66.3%

                                                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                    2. Add Preprocessing
                                                    3. Step-by-step derivation
                                                      1. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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) \]
                                                      3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                  Alternative 22: 82.3% accurate, 2.8× speedup?

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

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

                                                        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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) \]
                                                      3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                    if -7.60000000000000004e-72 < h < -4.999999999999985e-310

                                                    1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

                                                    if -4.999999999999985e-310 < h

                                                    1. Initial program 65.3%

                                                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                    2. Add Preprocessing
                                                    3. Step-by-step derivation
                                                      1. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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) \]
                                                      3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                  Alternative 23: 79.1% accurate, 2.8× speedup?

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

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

                                                        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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) \]
                                                      3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                    if -7.60000000000000004e-72 < h < -4.999999999999985e-310

                                                    1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

                                                    if -4.999999999999985e-310 < h < 1.2999999999999999e82

                                                    1. Initial program 61.9%

                                                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                    2. Add Preprocessing
                                                    3. Step-by-step derivation
                                                      1. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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) \]
                                                      3. associate-*l*N/A

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

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

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

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

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

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

                                                    if 1.2999999999999999e82 < h

                                                    1. Initial program 71.0%

                                                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                    2. Add Preprocessing
                                                    3. Step-by-step derivation
                                                      1. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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) \]
                                                      3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                  Alternative 24: 77.3% accurate, 2.8× speedup?

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

                                                    1. Initial program 70.8%

                                                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                    2. Add Preprocessing
                                                    3. Step-by-step derivation
                                                      1. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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) \]
                                                      3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                    if -8e-242 < h < -4.999999999999985e-310

                                                    1. Initial program 27.6%

                                                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                    2. Add Preprocessing
                                                    3. Taylor expanded in 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-*.f6475.1

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

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

                                                    if -4.999999999999985e-310 < h < 1.2999999999999999e82

                                                    1. Initial program 61.9%

                                                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                    2. Add Preprocessing
                                                    3. Step-by-step derivation
                                                      1. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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) \]
                                                      3. associate-*l*N/A

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

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

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

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

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

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

                                                    if 1.2999999999999999e82 < h

                                                    1. Initial program 71.0%

                                                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                    2. Add Preprocessing
                                                    3. Step-by-step derivation
                                                      1. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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. lift-*.f64N/A

                                                        \[\leadsto \color{blue}{\left({\left(\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) \]
                                                      3. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                  Alternative 25: 26.2% accurate, 15.3× speedup?

                                                  \[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \frac{d}{\sqrt{h \cdot \ell}} \end{array} \]
                                                  D_m = (fabs.f64 D)
                                                  NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                                                  (FPCore (d h l M D_m) :precision binary64 (/ d (sqrt (* h l))))
                                                  D_m = fabs(D);
                                                  assert(d < h && h < l && l < M && M < D_m);
                                                  double code(double d, double h, double l, double M, double D_m) {
                                                  	return d / sqrt((h * l));
                                                  }
                                                  
                                                  D_m = abs(d)
                                                  NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                                                  real(8) function code(d, h, l, m, d_m)
                                                      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_m
                                                      code = d / sqrt((h * l))
                                                  end function
                                                  
                                                  D_m = Math.abs(D);
                                                  assert d < h && h < l && l < M && M < D_m;
                                                  public static double code(double d, double h, double l, double M, double D_m) {
                                                  	return d / Math.sqrt((h * l));
                                                  }
                                                  
                                                  D_m = math.fabs(D)
                                                  [d, h, l, M, D_m] = sort([d, h, l, M, D_m])
                                                  def code(d, h, l, M, D_m):
                                                  	return d / math.sqrt((h * l))
                                                  
                                                  D_m = abs(D)
                                                  d, h, l, M, D_m = sort([d, h, l, M, D_m])
                                                  function code(d, h, l, M, D_m)
                                                  	return Float64(d / sqrt(Float64(h * l)))
                                                  end
                                                  
                                                  D_m = abs(D);
                                                  d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
                                                  function tmp = code(d, h, l, M, D_m)
                                                  	tmp = d / sqrt((h * l));
                                                  end
                                                  
                                                  D_m = N[Abs[D], $MachinePrecision]
                                                  NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
                                                  code[d_, h_, l_, M_, D$95$m_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
                                                  
                                                  \begin{array}{l}
                                                  D_m = \left|D\right|
                                                  \\
                                                  [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
                                                  \\
                                                  \frac{d}{\sqrt{h \cdot \ell}}
                                                  \end{array}
                                                  
                                                  Derivation
                                                  1. Initial program 65.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-*.f6421.6

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

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

                                                      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                                                    2. Final simplification21.6%

                                                      \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
                                                    3. Add Preprocessing

                                                    Reproduce

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