Henrywood and Agarwal, Equation (12)

Percentage Accurate: 65.6% → 80.6%
Time: 17.3s
Alternatives: 19
Speedup: 3.2×

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

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

Initial Program: 65.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (*
  (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
  (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
	return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
	return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D):
	return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D)
	return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
end
function tmp = code(d, h, l, M, D)
	tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}

Alternative 1: 80.6% accurate, 1.2× speedup?

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

\mathbf{elif}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot \frac{t\_1}{\sqrt{-\ell}}\right) \cdot \left(1 - \frac{t\_0 \cdot 0.5}{\ell} \cdot \left(\left(\frac{M\_m}{d} \cdot \left(0.25 \cdot D\_m\right)\right) \cdot h\right)\right)\\

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


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

    1. Initial program 57.9%

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

      \[\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}}} \]

    if -9.49999999999999951e-62 < l < -5.00000000000023e-311

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000023e-311 < l

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

      \[\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. Applied rewrites75.4%

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

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{\frac{1}{2}}{\ell} \cdot \left(\frac{D}{d} \cdot M\right), -\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{d}}{\sqrt{h}} \]
      3. sqrt-divN/A

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

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{\frac{1}{2}}{\ell} \cdot \left(\frac{D}{d} \cdot M\right), -\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{d}}{\sqrt{h}} \]
      6. lower-sqrt.f6485.6

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

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

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

Alternative 2: 78.5% accurate, 1.1× speedup?

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

\mathbf{elif}\;h \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if h < -2.6999999999999999e76

    1. Initial program 54.4%

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

      \[\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}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]

    if -2.6999999999999999e76 < h < -3.999999999999988e-310

    1. Initial program 61.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-pow.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.999999999999988e-310 < h

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

      \[\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. Applied rewrites75.4%

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

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{\frac{1}{2}}{\ell} \cdot \left(\frac{D}{d} \cdot M\right), -\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{d}}{\sqrt{h}} \]
      3. sqrt-divN/A

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

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{\frac{1}{2}}{\ell} \cdot \left(\frac{D}{d} \cdot M\right), -\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{d}}{\sqrt{h}} \]
      6. lower-sqrt.f6485.6

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

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

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

Alternative 3: 77.8% accurate, 1.1× speedup?

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

\mathbf{elif}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -5e163

    1. Initial program 53.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5e163 < l < -5.00000000000023e-311

    1. Initial program 60.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-pow.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000023e-311 < l

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

      \[\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. Applied rewrites75.4%

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

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{\frac{1}{2}}{\ell} \cdot \left(\frac{D}{d} \cdot M\right), -\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{d}}{\sqrt{h}} \]
      3. sqrt-divN/A

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

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{\frac{1}{2}}{\ell} \cdot \left(\frac{D}{d} \cdot M\right), -\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{d}}{\sqrt{h}} \]
      6. lower-sqrt.f6485.6

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

      \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{0.5}{\ell} \cdot \left(\frac{D}{d} \cdot M\right), -\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{d}}{\sqrt{h}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.8%

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

Alternative 4: 76.5% accurate, 1.8× speedup?

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

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

\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(0.125 \cdot \left(D\_m \cdot D\_m\right)\right) \cdot \frac{M\_m \cdot M\_m}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -1.55999999999999992e156

    1. Initial program 46.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-*.f6482.1

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

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

    if -1.55999999999999992e156 < d < -9.9999999999999999e-232

    1. Initial program 75.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.9999999999999999e-232 < d < -1.999999999999994e-310

    1. Initial program 1.4%

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < d

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

      \[\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. Applied rewrites75.4%

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

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{\frac{1}{2}}{\ell} \cdot \left(\frac{D}{d} \cdot M\right), -\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{d}}{\sqrt{h}} \]
      3. sqrt-divN/A

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

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{\frac{1}{2}}{\ell} \cdot \left(\frac{D}{d} \cdot M\right), -\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{d}}{\sqrt{h}} \]
      6. lower-sqrt.f6485.6

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

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

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

Alternative 5: 76.1% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.55999999999999992e156

    1. Initial program 46.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-*.f6482.1

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

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

    if -1.55999999999999992e156 < d < -1.999999999999994e-310

    1. Initial program 64.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < d

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

      \[\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. Applied rewrites75.4%

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

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{\frac{1}{2}}{\ell} \cdot \left(\frac{D}{d} \cdot M\right), -\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{d}}{\sqrt{h}} \]
      3. sqrt-divN/A

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

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

        \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{\frac{1}{2}}{\ell} \cdot \left(\frac{D}{d} \cdot M\right), -\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{d}}{\sqrt{h}} \]
      6. lower-sqrt.f6485.6

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

      \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{0.5}{\ell} \cdot \left(\frac{D}{d} \cdot M\right), -\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{d}}{\sqrt{h}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification79.6%

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

Alternative 6: 75.6% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.55999999999999992e156

    1. Initial program 46.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-*.f6482.1

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

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

    if -1.55999999999999992e156 < d < -1.999999999999994e-310

    1. Initial program 64.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.999999999999994e-310 < d

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

      \[\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. Applied rewrites75.4%

      \[\leadsto \frac{\left(\color{blue}{\mathsf{fma}\left(\frac{0.5}{\ell} \cdot \left(\frac{D}{d} \cdot M\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{d}}{\sqrt{h}} \]
    5. Applied rewrites83.4%

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

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

Alternative 7: 79.0% accurate, 1.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -6.8e231

    1. Initial program 46.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-*.f640.7

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

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

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

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

        if -6.8e231 < d < -1.999999999999994e-310

        1. Initial program 61.3%

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

          \[\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}}} \]

        if -1.999999999999994e-310 < d

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

          \[\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. Applied rewrites75.4%

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

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

            \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{\frac{1}{2}}{\ell} \cdot \left(\frac{D}{d} \cdot M\right), -\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{d}}{\sqrt{h}} \]
          3. sqrt-divN/A

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

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

            \[\leadsto \frac{\left(\mathsf{fma}\left(\frac{\frac{1}{2}}{\ell} \cdot \left(\frac{D}{d} \cdot M\right), -\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{d}}{\sqrt{h}} \]
          6. lower-sqrt.f6485.6

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

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

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

      Alternative 8: 61.3% accurate, 3.0× speedup?

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

        1. Initial program 50.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-*.f645.3

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

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

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

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

            if -2.05e120 < h < -3.999999999999988e-310

            1. Initial program 62.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 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-*.f6457.6

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

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

            if -3.999999999999988e-310 < h

            1. Initial program 64.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 9: 48.7% accurate, 3.0× speedup?

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

            1. Initial program 50.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-*.f645.3

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

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

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

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

                if -2.05e120 < h < -3.999999999999988e-310

                1. Initial program 62.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 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-*.f6457.6

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

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

                if -3.999999999999988e-310 < h

                1. Initial program 64.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-*.f6440.1

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

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

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

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

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

                  Alternative 10: 48.9% accurate, 3.0× speedup?

                  \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -2.05 \cdot 10^{+105}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}\\ \mathbf{elif}\;h \leq -4 \cdot 10^{-310}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \end{array} \]
                  D_m = (fabs.f64 D)
                  M_m = (fabs.f64 M)
                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                  (FPCore (d h l M_m D_m)
                   :precision binary64
                   (if (<= h -2.05e+105)
                     (* (/ (sqrt (/ d h)) (sqrt (- l))) (sqrt (- d)))
                     (if (<= h -4e-310)
                       (* (- d) (sqrt (pow (* l h) -1.0)))
                       (/ d (* (sqrt l) (sqrt h))))))
                  D_m = fabs(D);
                  M_m = fabs(M);
                  assert(d < h && h < l && l < M_m && M_m < D_m);
                  double code(double d, double h, double l, double M_m, double D_m) {
                  	double tmp;
                  	if (h <= -2.05e+105) {
                  		tmp = (sqrt((d / h)) / sqrt(-l)) * sqrt(-d);
                  	} else if (h <= -4e-310) {
                  		tmp = -d * sqrt(pow((l * h), -1.0));
                  	} else {
                  		tmp = d / (sqrt(l) * sqrt(h));
                  	}
                  	return tmp;
                  }
                  
                  D_m = abs(d)
                  M_m = abs(m)
                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                  real(8) function code(d, h, l, m_m, d_m)
                      real(8), intent (in) :: d
                      real(8), intent (in) :: h
                      real(8), intent (in) :: l
                      real(8), intent (in) :: m_m
                      real(8), intent (in) :: d_m
                      real(8) :: tmp
                      if (h <= (-2.05d+105)) then
                          tmp = (sqrt((d / h)) / sqrt(-l)) * sqrt(-d)
                      else if (h <= (-4d-310)) then
                          tmp = -d * sqrt(((l * h) ** (-1.0d0)))
                      else
                          tmp = d / (sqrt(l) * sqrt(h))
                      end if
                      code = tmp
                  end function
                  
                  D_m = Math.abs(D);
                  M_m = Math.abs(M);
                  assert d < h && h < l && l < M_m && M_m < D_m;
                  public static double code(double d, double h, double l, double M_m, double D_m) {
                  	double tmp;
                  	if (h <= -2.05e+105) {
                  		tmp = (Math.sqrt((d / h)) / Math.sqrt(-l)) * Math.sqrt(-d);
                  	} else if (h <= -4e-310) {
                  		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
                  	} else {
                  		tmp = d / (Math.sqrt(l) * Math.sqrt(h));
                  	}
                  	return tmp;
                  }
                  
                  D_m = math.fabs(D)
                  M_m = math.fabs(M)
                  [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                  def code(d, h, l, M_m, D_m):
                  	tmp = 0
                  	if h <= -2.05e+105:
                  		tmp = (math.sqrt((d / h)) / math.sqrt(-l)) * math.sqrt(-d)
                  	elif h <= -4e-310:
                  		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
                  	else:
                  		tmp = d / (math.sqrt(l) * math.sqrt(h))
                  	return tmp
                  
                  D_m = abs(D)
                  M_m = abs(M)
                  d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                  function code(d, h, l, M_m, D_m)
                  	tmp = 0.0
                  	if (h <= -2.05e+105)
                  		tmp = Float64(Float64(sqrt(Float64(d / h)) / sqrt(Float64(-l))) * sqrt(Float64(-d)));
                  	elseif (h <= -4e-310)
                  		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
                  	else
                  		tmp = Float64(d / Float64(sqrt(l) * sqrt(h)));
                  	end
                  	return tmp
                  end
                  
                  D_m = abs(D);
                  M_m = abs(M);
                  d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                  function tmp_2 = code(d, h, l, M_m, D_m)
                  	tmp = 0.0;
                  	if (h <= -2.05e+105)
                  		tmp = (sqrt((d / h)) / sqrt(-l)) * sqrt(-d);
                  	elseif (h <= -4e-310)
                  		tmp = -d * sqrt(((l * h) ^ -1.0));
                  	else
                  		tmp = d / (sqrt(l) * sqrt(h));
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  D_m = N[Abs[D], $MachinePrecision]
                  M_m = N[Abs[M], $MachinePrecision]
                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                  code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, -2.05e+105], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -4e-310], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                  
                  \begin{array}{l}
                  D_m = \left|D\right|
                  \\
                  M_m = \left|M\right|
                  \\
                  [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;h \leq -2.05 \cdot 10^{+105}:\\
                  \;\;\;\;\frac{\sqrt{\frac{d}{h}}}{\sqrt{-\ell}} \cdot \sqrt{-d}\\
                  
                  \mathbf{elif}\;h \leq -4 \cdot 10^{-310}:\\
                  \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 3 regimes
                  2. if h < -2.0500000000000001e105

                    1. Initial program 53.6%

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

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

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

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

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

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

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

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

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

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

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

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

                          if -2.0500000000000001e105 < h < -3.999999999999988e-310

                          1. Initial program 61.5%

                            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                          2. Add Preprocessing
                          3. 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-*.f6458.9

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

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

                          if -3.999999999999988e-310 < h

                          1. Initial program 64.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-*.f6440.1

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

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

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

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

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

                            Alternative 11: 46.5% accurate, 3.0× speedup?

                            \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -3.7 \cdot 10^{+177}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;\ell \leq 5.5 \cdot 10^{-305}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \end{array} \]
                            D_m = (fabs.f64 D)
                            M_m = (fabs.f64 M)
                            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                            (FPCore (d h l M_m D_m)
                             :precision binary64
                             (if (<= l -3.7e+177)
                               (/ (sqrt (/ d l)) (sqrt (/ h d)))
                               (if (<= l 5.5e-305)
                                 (* (- d) (sqrt (pow (* l h) -1.0)))
                                 (/ d (* (sqrt l) (sqrt h))))))
                            D_m = fabs(D);
                            M_m = fabs(M);
                            assert(d < h && h < l && l < M_m && M_m < D_m);
                            double code(double d, double h, double l, double M_m, double D_m) {
                            	double tmp;
                            	if (l <= -3.7e+177) {
                            		tmp = sqrt((d / l)) / sqrt((h / d));
                            	} else if (l <= 5.5e-305) {
                            		tmp = -d * sqrt(pow((l * h), -1.0));
                            	} else {
                            		tmp = d / (sqrt(l) * sqrt(h));
                            	}
                            	return tmp;
                            }
                            
                            D_m = abs(d)
                            M_m = abs(m)
                            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                            real(8) function code(d, h, l, m_m, d_m)
                                real(8), intent (in) :: d
                                real(8), intent (in) :: h
                                real(8), intent (in) :: l
                                real(8), intent (in) :: m_m
                                real(8), intent (in) :: d_m
                                real(8) :: tmp
                                if (l <= (-3.7d+177)) then
                                    tmp = sqrt((d / l)) / sqrt((h / d))
                                else if (l <= 5.5d-305) then
                                    tmp = -d * sqrt(((l * h) ** (-1.0d0)))
                                else
                                    tmp = d / (sqrt(l) * sqrt(h))
                                end if
                                code = tmp
                            end function
                            
                            D_m = Math.abs(D);
                            M_m = Math.abs(M);
                            assert d < h && h < l && l < M_m && M_m < D_m;
                            public static double code(double d, double h, double l, double M_m, double D_m) {
                            	double tmp;
                            	if (l <= -3.7e+177) {
                            		tmp = Math.sqrt((d / l)) / Math.sqrt((h / d));
                            	} else if (l <= 5.5e-305) {
                            		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
                            	} else {
                            		tmp = d / (Math.sqrt(l) * Math.sqrt(h));
                            	}
                            	return tmp;
                            }
                            
                            D_m = math.fabs(D)
                            M_m = math.fabs(M)
                            [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                            def code(d, h, l, M_m, D_m):
                            	tmp = 0
                            	if l <= -3.7e+177:
                            		tmp = math.sqrt((d / l)) / math.sqrt((h / d))
                            	elif l <= 5.5e-305:
                            		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
                            	else:
                            		tmp = d / (math.sqrt(l) * math.sqrt(h))
                            	return tmp
                            
                            D_m = abs(D)
                            M_m = abs(M)
                            d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                            function code(d, h, l, M_m, D_m)
                            	tmp = 0.0
                            	if (l <= -3.7e+177)
                            		tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d)));
                            	elseif (l <= 5.5e-305)
                            		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
                            	else
                            		tmp = Float64(d / Float64(sqrt(l) * sqrt(h)));
                            	end
                            	return tmp
                            end
                            
                            D_m = abs(D);
                            M_m = abs(M);
                            d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                            function tmp_2 = code(d, h, l, M_m, D_m)
                            	tmp = 0.0;
                            	if (l <= -3.7e+177)
                            		tmp = sqrt((d / l)) / sqrt((h / d));
                            	elseif (l <= 5.5e-305)
                            		tmp = -d * sqrt(((l * h) ^ -1.0));
                            	else
                            		tmp = d / (sqrt(l) * sqrt(h));
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            D_m = N[Abs[D], $MachinePrecision]
                            M_m = N[Abs[M], $MachinePrecision]
                            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                            code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -3.7e+177], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.5e-305], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                            
                            \begin{array}{l}
                            D_m = \left|D\right|
                            \\
                            M_m = \left|M\right|
                            \\
                            [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                            \\
                            \begin{array}{l}
                            \mathbf{if}\;\ell \leq -3.7 \cdot 10^{+177}:\\
                            \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\
                            
                            \mathbf{elif}\;\ell \leq 5.5 \cdot 10^{-305}:\\
                            \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 3 regimes
                            2. if l < -3.70000000000000014e177

                              1. Initial program 52.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-*.f646.7

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

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

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

                                if -3.70000000000000014e177 < l < 5.5e-305

                                1. Initial program 61.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 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-*.f6456.0

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

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

                                if 5.5e-305 < l

                                1. Initial program 64.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-*.f6440.7

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

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

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

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

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

                                  Alternative 12: 75.2% accurate, 3.2× speedup?

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

                                    1. Initial program 46.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-*.f6482.1

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

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

                                    if -1.55999999999999992e156 < d < -1.999999999999994e-310

                                    1. Initial program 64.1%

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

                                      \[\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. Applied rewrites0.0%

                                      \[\leadsto \frac{\left(\color{blue}{\mathsf{fma}\left(\frac{0.5}{\ell} \cdot \left(\frac{D}{d} \cdot M\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{d}}{\sqrt{h}} \]
                                    5. Applied rewrites65.3%

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

                                    if -1.999999999999994e-310 < d

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

                                      \[\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. Applied rewrites75.4%

                                      \[\leadsto \frac{\left(\color{blue}{\mathsf{fma}\left(\frac{0.5}{\ell} \cdot \left(\frac{D}{d} \cdot M\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{d}}{\sqrt{h}} \]
                                    5. Applied rewrites83.4%

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

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

                                  Alternative 13: 71.0% accurate, 3.2× speedup?

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

                                    1. Initial program 46.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-*.f6482.1

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

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

                                    if -8.00000000000000006e155 < d < -1.000000000000002e-309

                                    1. Initial program 64.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    if -1.000000000000002e-309 < d

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

                                      \[\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. Applied rewrites75.4%

                                      \[\leadsto \frac{\left(\color{blue}{\mathsf{fma}\left(\frac{0.5}{\ell} \cdot \left(\frac{D}{d} \cdot M\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{d}}{\sqrt{h}} \]
                                    5. Applied rewrites83.4%

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

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

                                  Alternative 14: 67.1% accurate, 3.2× speedup?

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

                                    1. Initial program 46.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-*.f6482.1

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

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

                                    if -8.00000000000000006e155 < d < -3.000000000000001e-309

                                    1. Initial program 64.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    if -3.000000000000001e-309 < d

                                    1. Initial program 64.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  Alternative 15: 46.4% accurate, 3.2× speedup?

                                  \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -2.7 \cdot 10^{+96}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{\sqrt{-d}}{\sqrt{\frac{h}{d}} \cdot \sqrt{-\ell}}\\ \mathbf{elif}\;d \leq 1.2 \cdot 10^{+43}:\\ \;\;\;\;\frac{\left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right) \cdot \left(\frac{D\_m \cdot D\_m}{d} \cdot \sqrt{\ell \cdot h}\right)}{\ell \cdot \ell}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\ \end{array} \end{array} \]
                                  D_m = (fabs.f64 D)
                                  M_m = (fabs.f64 M)
                                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                  (FPCore (d h l M_m D_m)
                                   :precision binary64
                                   (if (<= d -2.7e+96)
                                     (* (- d) (sqrt (pow (* l h) -1.0)))
                                     (if (<= d -2e-310)
                                       (/ (sqrt (- d)) (* (sqrt (/ h d)) (sqrt (- l))))
                                       (if (<= d 1.2e+43)
                                         (/
                                          (* (* (* M_m M_m) -0.125) (* (/ (* D_m D_m) d) (sqrt (* l h))))
                                          (* l l))
                                         (/ d (* (sqrt l) (sqrt h)))))))
                                  D_m = fabs(D);
                                  M_m = fabs(M);
                                  assert(d < h && h < l && l < M_m && M_m < D_m);
                                  double code(double d, double h, double l, double M_m, double D_m) {
                                  	double tmp;
                                  	if (d <= -2.7e+96) {
                                  		tmp = -d * sqrt(pow((l * h), -1.0));
                                  	} else if (d <= -2e-310) {
                                  		tmp = sqrt(-d) / (sqrt((h / d)) * sqrt(-l));
                                  	} else if (d <= 1.2e+43) {
                                  		tmp = (((M_m * M_m) * -0.125) * (((D_m * D_m) / d) * sqrt((l * h)))) / (l * l);
                                  	} else {
                                  		tmp = d / (sqrt(l) * sqrt(h));
                                  	}
                                  	return tmp;
                                  }
                                  
                                  D_m = abs(d)
                                  M_m = abs(m)
                                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                  real(8) function code(d, h, l, m_m, d_m)
                                      real(8), intent (in) :: d
                                      real(8), intent (in) :: h
                                      real(8), intent (in) :: l
                                      real(8), intent (in) :: m_m
                                      real(8), intent (in) :: d_m
                                      real(8) :: tmp
                                      if (d <= (-2.7d+96)) then
                                          tmp = -d * sqrt(((l * h) ** (-1.0d0)))
                                      else if (d <= (-2d-310)) then
                                          tmp = sqrt(-d) / (sqrt((h / d)) * sqrt(-l))
                                      else if (d <= 1.2d+43) then
                                          tmp = (((m_m * m_m) * (-0.125d0)) * (((d_m * d_m) / d) * sqrt((l * h)))) / (l * l)
                                      else
                                          tmp = d / (sqrt(l) * sqrt(h))
                                      end if
                                      code = tmp
                                  end function
                                  
                                  D_m = Math.abs(D);
                                  M_m = Math.abs(M);
                                  assert d < h && h < l && l < M_m && M_m < D_m;
                                  public static double code(double d, double h, double l, double M_m, double D_m) {
                                  	double tmp;
                                  	if (d <= -2.7e+96) {
                                  		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
                                  	} else if (d <= -2e-310) {
                                  		tmp = Math.sqrt(-d) / (Math.sqrt((h / d)) * Math.sqrt(-l));
                                  	} else if (d <= 1.2e+43) {
                                  		tmp = (((M_m * M_m) * -0.125) * (((D_m * D_m) / d) * Math.sqrt((l * h)))) / (l * l);
                                  	} else {
                                  		tmp = d / (Math.sqrt(l) * Math.sqrt(h));
                                  	}
                                  	return tmp;
                                  }
                                  
                                  D_m = math.fabs(D)
                                  M_m = math.fabs(M)
                                  [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                                  def code(d, h, l, M_m, D_m):
                                  	tmp = 0
                                  	if d <= -2.7e+96:
                                  		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
                                  	elif d <= -2e-310:
                                  		tmp = math.sqrt(-d) / (math.sqrt((h / d)) * math.sqrt(-l))
                                  	elif d <= 1.2e+43:
                                  		tmp = (((M_m * M_m) * -0.125) * (((D_m * D_m) / d) * math.sqrt((l * h)))) / (l * l)
                                  	else:
                                  		tmp = d / (math.sqrt(l) * math.sqrt(h))
                                  	return tmp
                                  
                                  D_m = abs(D)
                                  M_m = abs(M)
                                  d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                  function code(d, h, l, M_m, D_m)
                                  	tmp = 0.0
                                  	if (d <= -2.7e+96)
                                  		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
                                  	elseif (d <= -2e-310)
                                  		tmp = Float64(sqrt(Float64(-d)) / Float64(sqrt(Float64(h / d)) * sqrt(Float64(-l))));
                                  	elseif (d <= 1.2e+43)
                                  		tmp = Float64(Float64(Float64(Float64(M_m * M_m) * -0.125) * Float64(Float64(Float64(D_m * D_m) / d) * sqrt(Float64(l * h)))) / Float64(l * l));
                                  	else
                                  		tmp = Float64(d / Float64(sqrt(l) * sqrt(h)));
                                  	end
                                  	return tmp
                                  end
                                  
                                  D_m = abs(D);
                                  M_m = abs(M);
                                  d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                                  function tmp_2 = code(d, h, l, M_m, D_m)
                                  	tmp = 0.0;
                                  	if (d <= -2.7e+96)
                                  		tmp = -d * sqrt(((l * h) ^ -1.0));
                                  	elseif (d <= -2e-310)
                                  		tmp = sqrt(-d) / (sqrt((h / d)) * sqrt(-l));
                                  	elseif (d <= 1.2e+43)
                                  		tmp = (((M_m * M_m) * -0.125) * (((D_m * D_m) / d) * sqrt((l * h)))) / (l * l);
                                  	else
                                  		tmp = d / (sqrt(l) * sqrt(h));
                                  	end
                                  	tmp_2 = tmp;
                                  end
                                  
                                  D_m = N[Abs[D], $MachinePrecision]
                                  M_m = N[Abs[M], $MachinePrecision]
                                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                  code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -2.7e+96], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], N[(N[Sqrt[(-d)], $MachinePrecision] / N[(N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision] * N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.2e+43], N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
                                  
                                  \begin{array}{l}
                                  D_m = \left|D\right|
                                  \\
                                  M_m = \left|M\right|
                                  \\
                                  [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                  \\
                                  \begin{array}{l}
                                  \mathbf{if}\;d \leq -2.7 \cdot 10^{+96}:\\
                                  \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                                  
                                  \mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
                                  \;\;\;\;\frac{\sqrt{-d}}{\sqrt{\frac{h}{d}} \cdot \sqrt{-\ell}}\\
                                  
                                  \mathbf{elif}\;d \leq 1.2 \cdot 10^{+43}:\\
                                  \;\;\;\;\frac{\left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right) \cdot \left(\frac{D\_m \cdot D\_m}{d} \cdot \sqrt{\ell \cdot h}\right)}{\ell \cdot \ell}\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 4 regimes
                                  2. if d < -2.70000000000000022e96

                                    1. Initial program 55.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 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-*.f6476.4

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

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

                                    if -2.70000000000000022e96 < d < -1.999999999999994e-310

                                    1. Initial program 61.5%

                                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                    2. Add Preprocessing
                                    3. 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-*.f648.6

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

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

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

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

                                        if -1.999999999999994e-310 < d < 1.20000000000000012e43

                                        1. Initial program 60.4%

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

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

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

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

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

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

                                          if 1.20000000000000012e43 < d

                                          1. Initial program 70.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-*.f6470.2

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

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

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

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

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

                                            Alternative 16: 47.1% accurate, 3.2× speedup?

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

                                              1. Initial program 59.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 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-*.f6450.4

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

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

                                              if 5.5e-305 < l

                                              1. Initial program 64.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-*.f6440.7

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

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

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

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

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

                                                Alternative 17: 43.1% accurate, 3.2× speedup?

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

                                                  1. Initial program 56.4%

                                                    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                  2. Add Preprocessing
                                                  3. 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-*.f6452.5

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

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

                                                  if -3.3000000000000002e-240 < l

                                                  1. Initial program 66.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-*.f6439.7

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

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

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

                                                Alternative 18: 26.8% accurate, 3.4× speedup?

                                                \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \end{array} \]
                                                D_m = (fabs.f64 D)
                                                M_m = (fabs.f64 M)
                                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                (FPCore (d h l M_m D_m) :precision binary64 (* (sqrt (pow (* l h) -1.0)) d))
                                                D_m = fabs(D);
                                                M_m = fabs(M);
                                                assert(d < h && h < l && l < M_m && M_m < D_m);
                                                double code(double d, double h, double l, double M_m, double D_m) {
                                                	return sqrt(pow((l * h), -1.0)) * d;
                                                }
                                                
                                                D_m = abs(d)
                                                M_m = abs(m)
                                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                real(8) function code(d, h, l, m_m, d_m)
                                                    real(8), intent (in) :: d
                                                    real(8), intent (in) :: h
                                                    real(8), intent (in) :: l
                                                    real(8), intent (in) :: m_m
                                                    real(8), intent (in) :: d_m
                                                    code = sqrt(((l * h) ** (-1.0d0))) * d
                                                end function
                                                
                                                D_m = Math.abs(D);
                                                M_m = Math.abs(M);
                                                assert d < h && h < l && l < M_m && M_m < D_m;
                                                public static double code(double d, double h, double l, double M_m, double D_m) {
                                                	return Math.sqrt(Math.pow((l * h), -1.0)) * d;
                                                }
                                                
                                                D_m = math.fabs(D)
                                                M_m = math.fabs(M)
                                                [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                                                def code(d, h, l, M_m, D_m):
                                                	return math.sqrt(math.pow((l * h), -1.0)) * d
                                                
                                                D_m = abs(D)
                                                M_m = abs(M)
                                                d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                function code(d, h, l, M_m, D_m)
                                                	return Float64(sqrt((Float64(l * h) ^ -1.0)) * d)
                                                end
                                                
                                                D_m = abs(D);
                                                M_m = abs(M);
                                                d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                                                function tmp = code(d, h, l, M_m, D_m)
                                                	tmp = sqrt(((l * h) ^ -1.0)) * d;
                                                end
                                                
                                                D_m = N[Abs[D], $MachinePrecision]
                                                M_m = N[Abs[M], $MachinePrecision]
                                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                code[d_, h_, l_, M$95$m_, D$95$m_] := N[(N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]
                                                
                                                \begin{array}{l}
                                                D_m = \left|D\right|
                                                \\
                                                M_m = \left|M\right|
                                                \\
                                                [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                \\
                                                \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d
                                                \end{array}
                                                
                                                Derivation
                                                1. Initial program 61.7%

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

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

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

                                                  \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                6. Final simplification23.9%

                                                  \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
                                                7. Add Preprocessing

                                                Alternative 19: 26.6% accurate, 15.3× speedup?

                                                \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \frac{d}{\sqrt{\ell \cdot h}} \end{array} \]
                                                D_m = (fabs.f64 D)
                                                M_m = (fabs.f64 M)
                                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                (FPCore (d h l M_m D_m) :precision binary64 (/ d (sqrt (* l h))))
                                                D_m = fabs(D);
                                                M_m = fabs(M);
                                                assert(d < h && h < l && l < M_m && M_m < D_m);
                                                double code(double d, double h, double l, double M_m, double D_m) {
                                                	return d / sqrt((l * h));
                                                }
                                                
                                                D_m = abs(d)
                                                M_m = abs(m)
                                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                real(8) function code(d, h, l, m_m, d_m)
                                                    real(8), intent (in) :: d
                                                    real(8), intent (in) :: h
                                                    real(8), intent (in) :: l
                                                    real(8), intent (in) :: m_m
                                                    real(8), intent (in) :: d_m
                                                    code = d / sqrt((l * h))
                                                end function
                                                
                                                D_m = Math.abs(D);
                                                M_m = Math.abs(M);
                                                assert d < h && h < l && l < M_m && M_m < D_m;
                                                public static double code(double d, double h, double l, double M_m, double D_m) {
                                                	return d / Math.sqrt((l * h));
                                                }
                                                
                                                D_m = math.fabs(D)
                                                M_m = math.fabs(M)
                                                [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                                                def code(d, h, l, M_m, D_m):
                                                	return d / math.sqrt((l * h))
                                                
                                                D_m = abs(D)
                                                M_m = abs(M)
                                                d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                                                function code(d, h, l, M_m, D_m)
                                                	return Float64(d / sqrt(Float64(l * h)))
                                                end
                                                
                                                D_m = abs(D);
                                                M_m = abs(M);
                                                d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                                                function tmp = code(d, h, l, M_m, D_m)
                                                	tmp = d / sqrt((l * h));
                                                end
                                                
                                                D_m = N[Abs[D], $MachinePrecision]
                                                M_m = N[Abs[M], $MachinePrecision]
                                                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                                                code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
                                                
                                                \begin{array}{l}
                                                D_m = \left|D\right|
                                                \\
                                                M_m = \left|M\right|
                                                \\
                                                [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                                                \\
                                                \frac{d}{\sqrt{\ell \cdot h}}
                                                \end{array}
                                                
                                                Derivation
                                                1. Initial program 61.7%

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

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

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

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

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

                                                  Reproduce

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