Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.5% → 80.6%
Time: 20.1s
Alternatives: 26
Speedup: 3.6×

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

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

Initial Program: 66.5% 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.6× speedup?

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

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


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

    1. Initial program 72.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < d

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 77.1% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+264}:\\
\;\;\;\;t\_2 \cdot t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -1e-167

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1e-167 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

    1. Initial program 27.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-*.f6427.0

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

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

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

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

      1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 76.6% accurate, 0.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -1e-167 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

        1. Initial program 27.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-*.f6427.0

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

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

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

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

          1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

          Alternative 4: 58.7% accurate, 0.3× speedup?

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

            1. Initial program 88.9%

              \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            2. Add Preprocessing
            3. Taylor expanded in h around -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. lower-*.f64N/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}}}} \]
            5. Applied rewrites39.3%

              \[\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}{\left(\ell \cdot \ell\right) \cdot \ell}}} \]

            if -1.00000000000000004e93 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

            1. Initial program 30.3%

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

              Alternative 5: 59.1% accurate, 0.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if -9.999999999999999e201 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                1. Initial program 32.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-*.f6425.2

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

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

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

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

                  1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 6: 54.8% accurate, 0.3× speedup?

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

                    1. Initial program 88.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-*.f6415.4

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

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

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

                      if -1e-167 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 2.00000000000000009e264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                      1. Initial program 27.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-*.f6427.0

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

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

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

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

                        1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

                        Alternative 7: 77.1% accurate, 0.4× speedup?

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

                          1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          1. Initial program 60.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-*.f6442.9

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

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

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

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

                            1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          Alternative 8: 51.2% accurate, 0.5× speedup?

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

                            1. Initial program 83.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-*.f6420.6

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

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

                                \[\leadsto \frac{1}{\color{blue}{\sqrt{\frac{\ell}{d \cdot \frac{d}{h}}}}} \]
                              2. Taylor expanded in d around -inf

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

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

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

                                1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

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

                                  1. Initial program 24.4%

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

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

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

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

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

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

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

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

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

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

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

                                  Alternative 9: 76.7% accurate, 0.7× speedup?

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

                                    1. Initial program 90.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    1. Initial program 24.4%

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

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

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

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

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

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

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

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

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

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

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

                                    Alternative 10: 46.8% accurate, 0.9× speedup?

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

                                      1. Initial program 89.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-*.f6415.8

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

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

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

                                      1. Initial program 64.4%

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

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

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

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

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

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

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

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

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

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

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

                                      Alternative 11: 46.6% accurate, 0.9× speedup?

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

                                        1. Initial program 89.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-*.f6415.8

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

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

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

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

                                          1. Initial program 64.4%

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

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

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

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

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

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

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

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

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

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

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

                                          Alternative 12: 74.9% accurate, 2.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                            if -1.2000000000000001e-65 < d < -4.999999999999985e-310

                                            1. Initial program 63.0%

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

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

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

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

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

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

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

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

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

                                            if -4.999999999999985e-310 < d

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          Alternative 13: 76.1% accurate, 3.0× speedup?

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

                                            1. Initial program 65.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                            if -4.29999999999999991e77 < l < -4.999999999999985e-310

                                            1. Initial program 77.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                            if -4.999999999999985e-310 < l

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          Alternative 14: 70.7% accurate, 3.2× speedup?

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

                                            1. Initial program 71.5%

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

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

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

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

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

                                                if -7e98 < d < -1.8500000000000001e-132

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

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

                                                if -1.8500000000000001e-132 < d < -1.3500000000000001e-298

                                                1. Initial program 59.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                  if -1.3500000000000001e-298 < d

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

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

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

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

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

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

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

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

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

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

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

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

                                                    \[\leadsto \left({\left(\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(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{\ell} \cdot \frac{\left(\frac{0.5}{d} \cdot D\right) \cdot M}{\frac{1}{h}}}\right) \]
                                                  5. Applied rewrites61.4%

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

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

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

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

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

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

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

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

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

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

                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -7 \cdot 10^{+98}:\\ \;\;\;\;\left|\frac{\frac{d}{\sqrt{-\ell}}}{\sqrt{-h}}\right|\\ \mathbf{elif}\;d \leq -1.85 \cdot 10^{-132}:\\ \;\;\;\;\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{d \cdot d}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;d \leq -1.35 \cdot 10^{-298}:\\ \;\;\;\;\frac{\left(\frac{-D}{\ell} \cdot \left(\left(\left(-0.125 \cdot \sqrt{\frac{h}{\left(d \cdot d\right) \cdot d}}\right) \cdot \left(M \cdot M\right)\right) \cdot D\right)\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\right) \cdot \frac{M \cdot \left(D \cdot 0.25\right)}{\left(-\ell\right) \cdot d}, h, 1\right) \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
                                                10. Add Preprocessing

                                                Alternative 15: 70.9% accurate, 3.2× speedup?

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

                                                  1. Initial program 71.5%

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

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

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

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

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

                                                      if -7e98 < d < -1.8500000000000001e-132

                                                      1. Initial program 85.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 rewrites69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                      if -1.8500000000000001e-132 < d < -1.3500000000000001e-298

                                                      1. Initial program 59.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                        if -1.3500000000000001e-298 < d

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

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

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

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

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

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

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

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

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

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

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

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

                                                          \[\leadsto \left({\left(\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(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{\ell} \cdot \frac{\left(\frac{0.5}{d} \cdot D\right) \cdot M}{\frac{1}{h}}}\right) \]
                                                        5. Applied rewrites61.4%

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

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

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

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

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

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

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

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

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

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

                                                        \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -7 \cdot 10^{+98}:\\ \;\;\;\;\left|\frac{\frac{d}{\sqrt{-\ell}}}{\sqrt{-h}}\right|\\ \mathbf{elif}\;d \leq -1.85 \cdot 10^{-132}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{\left(\left(\left(D \cdot D\right) \cdot 0.25\right) \cdot \left(M \cdot M\right)\right) \cdot h}{\left(d \cdot d\right) \cdot \ell}, -0.5, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq -1.35 \cdot 10^{-298}:\\ \;\;\;\;\frac{\left(\frac{-D}{\ell} \cdot \left(\left(\left(-0.125 \cdot \sqrt{\frac{h}{\left(d \cdot d\right) \cdot d}}\right) \cdot \left(M \cdot M\right)\right) \cdot D\right)\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\right) \cdot \frac{M \cdot \left(D \cdot 0.25\right)}{\left(-\ell\right) \cdot d}, h, 1\right) \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
                                                      10. Add Preprocessing

                                                      Alternative 16: 70.6% accurate, 3.2× speedup?

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

                                                        1. Initial program 71.5%

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

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

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

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

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

                                                            if -7e98 < d < -4.1e-123

                                                            1. Initial program 86.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                            if -4.1e-123 < d < -1.3500000000000001e-298

                                                            1. Initial program 58.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                            if -1.3500000000000001e-298 < d

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

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

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

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

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

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

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

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

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

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

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

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

                                                              \[\leadsto \left({\left(\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(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{\ell} \cdot \frac{\left(\frac{0.5}{d} \cdot D\right) \cdot M}{\frac{1}{h}}}\right) \]
                                                            5. Applied rewrites61.4%

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

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

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

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

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

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

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

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

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

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

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

                                                          Alternative 17: 70.6% accurate, 3.3× speedup?

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

                                                            1. Initial program 71.5%

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

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

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

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

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

                                                                if -7e98 < d < -4.1e-123

                                                                1. Initial program 86.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                if -4.1e-123 < d < -1.3500000000000001e-298

                                                                1. Initial program 58.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                  if -1.3500000000000001e-298 < d

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

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

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

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

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

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

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

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

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

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

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

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

                                                                    \[\leadsto \left({\left(\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(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{\ell} \cdot \frac{\left(\frac{0.5}{d} \cdot D\right) \cdot M}{\frac{1}{h}}}\right) \]
                                                                  5. Applied rewrites61.4%

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

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

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

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

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

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

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

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

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

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

                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -7 \cdot 10^{+98}:\\ \;\;\;\;\left|\frac{\frac{d}{\sqrt{-\ell}}}{\sqrt{-h}}\right|\\ \mathbf{elif}\;d \leq -4.1 \cdot 10^{-123}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{\left(\left(\left(D \cdot D\right) \cdot 0.25\right) \cdot \left(M \cdot M\right)\right) \cdot h}{\left(d \cdot d\right) \cdot \ell}, -0.5, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;d \leq -1.35 \cdot 10^{-298}:\\ \;\;\;\;\frac{\left(\left(\frac{M \cdot M}{\ell} \cdot \left(0.125 \cdot \left(D \cdot D\right)\right)\right) \cdot \sqrt{\frac{h}{\left(d \cdot d\right) \cdot d}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\right) \cdot \frac{M \cdot \left(D \cdot 0.25\right)}{\left(-\ell\right) \cdot d}, h, 1\right) \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
                                                                11. Add Preprocessing

                                                                Alternative 18: 72.7% accurate, 3.4× speedup?

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

                                                                  1. Initial program 71.5%

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

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

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

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

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

                                                                      if -7e98 < d < -3.2000000000000001e-138

                                                                      1. Initial program 84.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 rewrites68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                      if -3.2000000000000001e-138 < d < -4.999999999999985e-310

                                                                      1. Initial program 57.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 rewrites45.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                        \[\leadsto \frac{\color{blue}{\left(\left(-0.125 \cdot \sqrt{\frac{h}{\left(d \cdot d\right) \cdot d}}\right) \cdot \left(\left(\left(-M\right) \cdot M\right) \cdot \frac{D \cdot D}{\ell}\right)\right)} \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
                                                                      7. Taylor expanded in l 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) + \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                      8. Step-by-step derivation
                                                                        1. *-commutativeN/A

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

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

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

                                                                      if -4.999999999999985e-310 < d

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                    Alternative 19: 71.2% accurate, 3.6× speedup?

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

                                                                      1. Initial program 78.8%

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

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

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

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

                                                                          \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                        2. Step-by-step derivation
                                                                          1. Applied rewrites67.6%

                                                                            \[\leadsto \left|\frac{-d}{\sqrt{-\ell} \cdot \left(-\sqrt{-h}\right)}\right| \]

                                                                          if -2.04999999999999981e-77 < d < -4.999999999999985e-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. Applied rewrites47.4%

                                                                            \[\leadsto \color{blue}{\frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{d \cdot d}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}} \]
                                                                          4. Taylor expanded in h around -inf

                                                                            \[\leadsto \frac{\color{blue}{\left(\frac{-1}{8} \cdot \left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{\ell} \cdot \sqrt{\frac{h}{{d}^{3}}}\right)\right)} \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                          5. Step-by-step derivation
                                                                            1. *-commutativeN/A

                                                                              \[\leadsto \frac{\left(\frac{-1}{8} \cdot \color{blue}{\left(\sqrt{\frac{h}{{d}^{3}}} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{\ell}\right)}\right) \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                            2. associate-*r*N/A

                                                                              \[\leadsto \frac{\color{blue}{\left(\left(\frac{-1}{8} \cdot \sqrt{\frac{h}{{d}^{3}}}\right) \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{\ell}\right)} \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                            3. lower-*.f64N/A

                                                                              \[\leadsto \frac{\color{blue}{\left(\left(\frac{-1}{8} \cdot \sqrt{\frac{h}{{d}^{3}}}\right) \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{\ell}\right)} \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                            4. lower-*.f64N/A

                                                                              \[\leadsto \frac{\left(\color{blue}{\left(\frac{-1}{8} \cdot \sqrt{\frac{h}{{d}^{3}}}\right)} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{\ell}\right) \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                            5. lower-sqrt.f64N/A

                                                                              \[\leadsto \frac{\left(\left(\frac{-1}{8} \cdot \color{blue}{\sqrt{\frac{h}{{d}^{3}}}}\right) \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{\ell}\right) \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                            6. lower-/.f64N/A

                                                                              \[\leadsto \frac{\left(\left(\frac{-1}{8} \cdot \sqrt{\color{blue}{\frac{h}{{d}^{3}}}}\right) \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{\ell}\right) \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                            7. unpow3N/A

                                                                              \[\leadsto \frac{\left(\left(\frac{-1}{8} \cdot \sqrt{\frac{h}{\color{blue}{\left(d \cdot d\right) \cdot d}}}\right) \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{\ell}\right) \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                            8. unpow2N/A

                                                                              \[\leadsto \frac{\left(\left(\frac{-1}{8} \cdot \sqrt{\frac{h}{\color{blue}{{d}^{2}} \cdot d}}\right) \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{\ell}\right) \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                            9. lower-*.f64N/A

                                                                              \[\leadsto \frac{\left(\left(\frac{-1}{8} \cdot \sqrt{\frac{h}{\color{blue}{{d}^{2} \cdot d}}}\right) \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{\ell}\right) \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                            10. unpow2N/A

                                                                              \[\leadsto \frac{\left(\left(\frac{-1}{8} \cdot \sqrt{\frac{h}{\color{blue}{\left(d \cdot d\right)} \cdot d}}\right) \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{\ell}\right) \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                            11. lower-*.f64N/A

                                                                              \[\leadsto \frac{\left(\left(\frac{-1}{8} \cdot \sqrt{\frac{h}{\color{blue}{\left(d \cdot d\right)} \cdot d}}\right) \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{\ell}\right) \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                            12. *-commutativeN/A

                                                                              \[\leadsto \frac{\left(\left(\frac{-1}{8} \cdot \sqrt{\frac{h}{\left(d \cdot d\right) \cdot d}}\right) \cdot \frac{\color{blue}{\left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot {D}^{2}}}{\ell}\right) \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                            13. associate-/l*N/A

                                                                              \[\leadsto \frac{\left(\left(\frac{-1}{8} \cdot \sqrt{\frac{h}{\left(d \cdot d\right) \cdot d}}\right) \cdot \color{blue}{\left(\left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \frac{{D}^{2}}{\ell}\right)}\right) \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                            14. lower-*.f64N/A

                                                                              \[\leadsto \frac{\left(\left(\frac{-1}{8} \cdot \sqrt{\frac{h}{\left(d \cdot d\right) \cdot d}}\right) \cdot \color{blue}{\left(\left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \frac{{D}^{2}}{\ell}\right)}\right) \cdot \sqrt{\mathsf{neg}\left(d\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \]
                                                                          6. Applied rewrites49.7%

                                                                            \[\leadsto \frac{\color{blue}{\left(\left(-0.125 \cdot \sqrt{\frac{h}{\left(d \cdot d\right) \cdot d}}\right) \cdot \left(\left(\left(-M\right) \cdot M\right) \cdot \frac{D \cdot D}{\ell}\right)\right)} \cdot \sqrt{-d}}{\sqrt{-\ell}} \]
                                                                          7. Taylor expanded in l 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) + \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                          8. Step-by-step derivation
                                                                            1. *-commutativeN/A

                                                                              \[\leadsto \color{blue}{\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \cdot \frac{-1}{8}} + \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                                                            2. lower-fma.f64N/A

                                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}, \frac{-1}{8}, \left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                                                                          9. Applied rewrites45.8%

                                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}} \cdot \left(D \cdot D\right)\right) \cdot \left(\left(-M\right) \cdot \frac{M}{d}\right), -0.125, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right)} \]

                                                                          if -4.999999999999985e-310 < d

                                                                          1. Initial program 73.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. lift-pow.f64N/A

                                                                              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\frac{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
                                                                            7. unpow2N/A

                                                                              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}}{\frac{\ell}{h}}\right) \]
                                                                            8. associate-*r*N/A

                                                                              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\color{blue}{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}\right) \]
                                                                            9. div-invN/A

                                                                              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
                                                                            10. times-fracN/A

                                                                              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                            11. lower-*.f64N/A

                                                                              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                          4. Applied rewrites71.3%

                                                                            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{\ell} \cdot \frac{\left(\frac{0.5}{d} \cdot D\right) \cdot M}{\frac{1}{h}}}\right) \]
                                                                          5. Applied rewrites62.4%

                                                                            \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\left(-\frac{\left(0.25 \cdot D\right) \cdot M}{\ell \cdot d}\right) \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}}} \]
                                                                          6. Step-by-step derivation
                                                                            1. lift-sqrt.f64N/A

                                                                              \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\color{blue}{\sqrt{\ell \cdot h}}} \]
                                                                            2. lift-*.f64N/A

                                                                              \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\color{blue}{\ell \cdot h}}} \]
                                                                            3. sqrt-prodN/A

                                                                              \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
                                                                            4. pow1/2N/A

                                                                              \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\color{blue}{{\ell}^{\frac{1}{2}}} \cdot \sqrt{h}} \]
                                                                            5. lower-*.f64N/A

                                                                              \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\color{blue}{{\ell}^{\frac{1}{2}} \cdot \sqrt{h}}} \]
                                                                            6. pow1/2N/A

                                                                              \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\color{blue}{\sqrt{\ell}} \cdot \sqrt{h}} \]
                                                                            7. lower-sqrt.f64N/A

                                                                              \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\color{blue}{\sqrt{\ell}} \cdot \sqrt{h}} \]
                                                                            8. lower-sqrt.f6481.1

                                                                              \[\leadsto \frac{\mathsf{fma}\left(\left(-\frac{\left(0.25 \cdot D\right) \cdot M}{\ell \cdot d}\right) \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
                                                                          7. Applied rewrites81.1%

                                                                            \[\leadsto \frac{\mathsf{fma}\left(\left(-\frac{\left(0.25 \cdot D\right) \cdot M}{\ell \cdot d}\right) \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right), h, 1\right) \cdot d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
                                                                        3. Recombined 3 regimes into one program.
                                                                        4. Final simplification68.9%

                                                                          \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.05 \cdot 10^{-77}:\\ \;\;\;\;\left|\frac{d}{\sqrt{-h} \cdot \sqrt{-\ell}}\right|\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(\left(-D\right) \cdot D\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\right) \cdot \left(\frac{M}{d} \cdot M\right), -0.125, \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\right) \cdot \frac{M \cdot \left(D \cdot 0.25\right)}{\left(-\ell\right) \cdot d}, h, 1\right) \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
                                                                        5. Add Preprocessing

                                                                        Alternative 20: 62.6% accurate, 3.6× speedup?

                                                                        \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \frac{-1}{\ell \cdot h}\\ \mathbf{if}\;\ell \leq -7.8 \cdot 10^{-169}:\\ \;\;\;\;\left|\frac{d}{\sqrt{-h} \cdot \sqrt{-\ell}}\right|\\ \mathbf{elif}\;\ell \leq -4.1 \cdot 10^{-297}:\\ \;\;\;\;\sqrt{\sqrt{t\_0 \cdot t\_0}} \cdot d\\ \mathbf{elif}\;\ell \leq 7.6 \cdot 10^{+69}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{\frac{-0.25 \cdot \left(M\_m \cdot D\right)}{\ell}}{d} \cdot \left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\_m\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
                                                                        M_m = (fabs.f64 M)
                                                                        NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                        (FPCore (d h l M_m D)
                                                                         :precision binary64
                                                                         (let* ((t_0 (/ -1.0 (* l h))))
                                                                           (if (<= l -7.8e-169)
                                                                             (fabs (/ d (* (sqrt (- h)) (sqrt (- l)))))
                                                                             (if (<= l -4.1e-297)
                                                                               (* (sqrt (sqrt (* t_0 t_0))) d)
                                                                               (if (<= l 7.6e+69)
                                                                                 (/
                                                                                  (*
                                                                                   (fma
                                                                                    (* (/ (/ (* -0.25 (* M_m D)) l) d) (* (* (/ 0.5 d) D) M_m))
                                                                                    h
                                                                                    1.0)
                                                                                   d)
                                                                                  (sqrt (* l h)))
                                                                                 (/ d (* (sqrt h) (sqrt l))))))))
                                                                        M_m = fabs(M);
                                                                        assert(d < h && h < l && l < M_m && M_m < D);
                                                                        double code(double d, double h, double l, double M_m, double D) {
                                                                        	double t_0 = -1.0 / (l * h);
                                                                        	double tmp;
                                                                        	if (l <= -7.8e-169) {
                                                                        		tmp = fabs((d / (sqrt(-h) * sqrt(-l))));
                                                                        	} else if (l <= -4.1e-297) {
                                                                        		tmp = sqrt(sqrt((t_0 * t_0))) * d;
                                                                        	} else if (l <= 7.6e+69) {
                                                                        		tmp = (fma(((((-0.25 * (M_m * D)) / l) / d) * (((0.5 / d) * D) * M_m)), h, 1.0) * d) / sqrt((l * h));
                                                                        	} else {
                                                                        		tmp = d / (sqrt(h) * sqrt(l));
                                                                        	}
                                                                        	return tmp;
                                                                        }
                                                                        
                                                                        M_m = abs(M)
                                                                        d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                                                        function code(d, h, l, M_m, D)
                                                                        	t_0 = Float64(-1.0 / Float64(l * h))
                                                                        	tmp = 0.0
                                                                        	if (l <= -7.8e-169)
                                                                        		tmp = abs(Float64(d / Float64(sqrt(Float64(-h)) * sqrt(Float64(-l)))));
                                                                        	elseif (l <= -4.1e-297)
                                                                        		tmp = Float64(sqrt(sqrt(Float64(t_0 * t_0))) * d);
                                                                        	elseif (l <= 7.6e+69)
                                                                        		tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(-0.25 * Float64(M_m * D)) / l) / d) * Float64(Float64(Float64(0.5 / d) * D) * M_m)), h, 1.0) * d) / sqrt(Float64(l * h)));
                                                                        	else
                                                                        		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
                                                                        	end
                                                                        	return tmp
                                                                        end
                                                                        
                                                                        M_m = N[Abs[M], $MachinePrecision]
                                                                        NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                        code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(-1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -7.8e-169], N[Abs[N[(d / N[(N[Sqrt[(-h)], $MachinePrecision] * N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, -4.1e-297], N[(N[Sqrt[N[Sqrt[N[(t$95$0 * t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision], If[LessEqual[l, 7.6e+69], N[(N[(N[(N[(N[(N[(N[(-0.25 * N[(M$95$m * D), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(0.5 / d), $MachinePrecision] * D), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * d), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
                                                                        
                                                                        \begin{array}{l}
                                                                        M_m = \left|M\right|
                                                                        \\
                                                                        [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                                                        \\
                                                                        \begin{array}{l}
                                                                        t_0 := \frac{-1}{\ell \cdot h}\\
                                                                        \mathbf{if}\;\ell \leq -7.8 \cdot 10^{-169}:\\
                                                                        \;\;\;\;\left|\frac{d}{\sqrt{-h} \cdot \sqrt{-\ell}}\right|\\
                                                                        
                                                                        \mathbf{elif}\;\ell \leq -4.1 \cdot 10^{-297}:\\
                                                                        \;\;\;\;\sqrt{\sqrt{t\_0 \cdot t\_0}} \cdot d\\
                                                                        
                                                                        \mathbf{elif}\;\ell \leq 7.6 \cdot 10^{+69}:\\
                                                                        \;\;\;\;\frac{\mathsf{fma}\left(\frac{\frac{-0.25 \cdot \left(M\_m \cdot D\right)}{\ell}}{d} \cdot \left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\_m\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}}\\
                                                                        
                                                                        \mathbf{else}:\\
                                                                        \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
                                                                        
                                                                        
                                                                        \end{array}
                                                                        \end{array}
                                                                        
                                                                        Derivation
                                                                        1. Split input into 4 regimes
                                                                        2. if l < -7.79999999999999954e-169

                                                                          1. Initial program 69.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-*.f646.9

                                                                              \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                          5. Applied rewrites6.9%

                                                                            \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                                          6. Step-by-step derivation
                                                                            1. Applied rewrites49.6%

                                                                              \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                            2. Step-by-step derivation
                                                                              1. Applied rewrites58.1%

                                                                                \[\leadsto \left|\frac{-d}{\sqrt{-\ell} \cdot \left(-\sqrt{-h}\right)}\right| \]

                                                                              if -7.79999999999999954e-169 < l < -4.1000000000000002e-297

                                                                              1. Initial program 88.8%

                                                                                \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                              2. Add Preprocessing
                                                                              3. Taylor expanded in d around inf

                                                                                \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                              4. Step-by-step derivation
                                                                                1. *-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-*.f6436.1

                                                                                  \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                              5. Applied rewrites36.1%

                                                                                \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                                              6. Step-by-step derivation
                                                                                1. Applied rewrites54.8%

                                                                                  \[\leadsto \sqrt{\sqrt{\frac{1}{\ell \cdot h} \cdot \frac{1}{\ell \cdot h}}} \cdot d \]

                                                                                if -4.1000000000000002e-297 < l < 7.60000000000000055e69

                                                                                1. Initial program 81.3%

                                                                                  \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                                2. Add Preprocessing
                                                                                3. Step-by-step derivation
                                                                                  1. lift-*.f64N/A

                                                                                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}}\right) \]
                                                                                  2. lift-/.f64N/A

                                                                                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
                                                                                  3. clear-numN/A

                                                                                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{1}{\frac{\ell}{h}}}\right) \]
                                                                                  4. un-div-invN/A

                                                                                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\frac{\ell}{h}}}\right) \]
                                                                                  5. lift-*.f64N/A

                                                                                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\color{blue}{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
                                                                                  6. lift-pow.f64N/A

                                                                                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\frac{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
                                                                                  7. unpow2N/A

                                                                                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}}{\frac{\ell}{h}}\right) \]
                                                                                  8. associate-*r*N/A

                                                                                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\color{blue}{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}\right) \]
                                                                                  9. div-invN/A

                                                                                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
                                                                                  10. times-fracN/A

                                                                                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                                  11. lower-*.f64N/A

                                                                                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                                4. Applied rewrites79.9%

                                                                                  \[\leadsto \left({\left(\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(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{\ell} \cdot \frac{\left(\frac{0.5}{d} \cdot D\right) \cdot M}{\frac{1}{h}}}\right) \]
                                                                                5. Applied rewrites75.9%

                                                                                  \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\left(-\frac{\left(0.25 \cdot D\right) \cdot M}{\ell \cdot d}\right) \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}}} \]
                                                                                6. Step-by-step derivation
                                                                                  1. lift-neg.f64N/A

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right)} \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                  2. lift-/.f64N/A

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\color{blue}{\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                  3. distribute-neg-fracN/A

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{\mathsf{neg}\left(\left(\frac{1}{4} \cdot D\right) \cdot M\right)}{\ell \cdot d}} \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                  4. lift-*.f64N/A

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\frac{\mathsf{neg}\left(\left(\frac{1}{4} \cdot D\right) \cdot M\right)}{\color{blue}{\ell \cdot d}} \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                  5. associate-/r*N/A

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{\frac{\mathsf{neg}\left(\left(\frac{1}{4} \cdot D\right) \cdot M\right)}{\ell}}{d}} \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                  6. lower-/.f64N/A

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{\frac{\mathsf{neg}\left(\left(\frac{1}{4} \cdot D\right) \cdot M\right)}{\ell}}{d}} \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                  7. lower-/.f64N/A

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\frac{\color{blue}{\frac{\mathsf{neg}\left(\left(\frac{1}{4} \cdot D\right) \cdot M\right)}{\ell}}}{d} \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                  8. lift-*.f64N/A

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\frac{\frac{\mathsf{neg}\left(\color{blue}{\left(\frac{1}{4} \cdot D\right) \cdot M}\right)}{\ell}}{d} \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                  9. lift-*.f64N/A

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\frac{\frac{\mathsf{neg}\left(\color{blue}{\left(\frac{1}{4} \cdot D\right)} \cdot M\right)}{\ell}}{d} \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                  10. associate-*l*N/A

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\frac{\frac{\mathsf{neg}\left(\color{blue}{\frac{1}{4} \cdot \left(D \cdot M\right)}\right)}{\ell}}{d} \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                  11. *-commutativeN/A

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\frac{\frac{\mathsf{neg}\left(\frac{1}{4} \cdot \color{blue}{\left(M \cdot D\right)}\right)}{\ell}}{d} \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                  12. distribute-lft-neg-inN/A

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\frac{\frac{\color{blue}{\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(M \cdot D\right)}}{\ell}}{d} \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                  13. lower-*.f64N/A

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\frac{\frac{\color{blue}{\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left(M \cdot D\right)}}{\ell}}{d} \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                  14. metadata-evalN/A

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\frac{\frac{\color{blue}{\frac{-1}{4}} \cdot \left(M \cdot D\right)}{\ell}}{d} \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                  15. lower-*.f6480.3

                                                                                    \[\leadsto \frac{\mathsf{fma}\left(\frac{\frac{-0.25 \cdot \color{blue}{\left(M \cdot D\right)}}{\ell}}{d} \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]
                                                                                7. Applied rewrites80.3%

                                                                                  \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{\frac{-0.25 \cdot \left(M \cdot D\right)}{\ell}}{d}} \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}} \]

                                                                                if 7.60000000000000055e69 < l

                                                                                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. Taylor expanded in d around inf

                                                                                  \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                4. Step-by-step derivation
                                                                                  1. *-commutativeN/A

                                                                                    \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                                                                  2. lower-*.f64N/A

                                                                                    \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                                                                  3. lower-sqrt.f64N/A

                                                                                    \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                                                                                  4. lower-/.f64N/A

                                                                                    \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                                                                                  5. *-commutativeN/A

                                                                                    \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                                  6. lower-*.f6445.4

                                                                                    \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                                5. Applied rewrites45.4%

                                                                                  \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                                                6. Step-by-step derivation
                                                                                  1. Applied rewrites45.4%

                                                                                    \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                                                                                  2. Step-by-step derivation
                                                                                    1. Applied rewrites69.1%

                                                                                      \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
                                                                                  3. Recombined 4 regimes into one program.
                                                                                  4. Final simplification65.7%

                                                                                    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -7.8 \cdot 10^{-169}:\\ \;\;\;\;\left|\frac{d}{\sqrt{-h} \cdot \sqrt{-\ell}}\right|\\ \mathbf{elif}\;\ell \leq -4.1 \cdot 10^{-297}:\\ \;\;\;\;\sqrt{\sqrt{\frac{-1}{\ell \cdot h} \cdot \frac{-1}{\ell \cdot h}}} \cdot d\\ \mathbf{elif}\;\ell \leq 7.6 \cdot 10^{+69}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{\frac{-0.25 \cdot \left(M \cdot D\right)}{\ell}}{d} \cdot \left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
                                                                                  5. Add Preprocessing

                                                                                  Alternative 21: 68.9% accurate, 3.6× speedup?

                                                                                  \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -4 \cdot 10^{-121}:\\ \;\;\;\;\left|\frac{\frac{d}{\sqrt{-\ell}}}{\sqrt{-h}}\right|\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left(\frac{M\_m \cdot M\_m}{d} \cdot \left(0.125 \cdot \left(D \cdot D\right)\right)\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\_m\right) \cdot \frac{M\_m \cdot \left(D \cdot 0.25\right)}{\left(-\ell\right) \cdot d}, h, 1\right) \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
                                                                                  M_m = (fabs.f64 M)
                                                                                  NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                  (FPCore (d h l M_m D)
                                                                                   :precision binary64
                                                                                   (if (<= d -4e-121)
                                                                                     (fabs (/ (/ d (sqrt (- l))) (sqrt (- h))))
                                                                                     (if (<= d -5e-310)
                                                                                       (* (* (/ (* M_m M_m) d) (* 0.125 (* D D))) (sqrt (/ h (* (* l l) l))))
                                                                                       (/
                                                                                        (*
                                                                                         (fma
                                                                                          (* (* (* (/ 0.5 d) D) M_m) (/ (* M_m (* D 0.25)) (* (- l) d)))
                                                                                          h
                                                                                          1.0)
                                                                                         d)
                                                                                        (* (sqrt h) (sqrt l))))))
                                                                                  M_m = fabs(M);
                                                                                  assert(d < h && h < l && l < M_m && M_m < D);
                                                                                  double code(double d, double h, double l, double M_m, double D) {
                                                                                  	double tmp;
                                                                                  	if (d <= -4e-121) {
                                                                                  		tmp = fabs(((d / sqrt(-l)) / sqrt(-h)));
                                                                                  	} else if (d <= -5e-310) {
                                                                                  		tmp = (((M_m * M_m) / d) * (0.125 * (D * D))) * sqrt((h / ((l * l) * l)));
                                                                                  	} else {
                                                                                  		tmp = (fma(((((0.5 / d) * D) * M_m) * ((M_m * (D * 0.25)) / (-l * d))), h, 1.0) * d) / (sqrt(h) * sqrt(l));
                                                                                  	}
                                                                                  	return tmp;
                                                                                  }
                                                                                  
                                                                                  M_m = abs(M)
                                                                                  d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                                                                  function code(d, h, l, M_m, D)
                                                                                  	tmp = 0.0
                                                                                  	if (d <= -4e-121)
                                                                                  		tmp = abs(Float64(Float64(d / sqrt(Float64(-l))) / sqrt(Float64(-h))));
                                                                                  	elseif (d <= -5e-310)
                                                                                  		tmp = Float64(Float64(Float64(Float64(M_m * M_m) / d) * Float64(0.125 * Float64(D * D))) * sqrt(Float64(h / Float64(Float64(l * l) * l))));
                                                                                  	else
                                                                                  		tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(0.5 / d) * D) * M_m) * Float64(Float64(M_m * Float64(D * 0.25)) / Float64(Float64(-l) * d))), h, 1.0) * d) / Float64(sqrt(h) * sqrt(l)));
                                                                                  	end
                                                                                  	return tmp
                                                                                  end
                                                                                  
                                                                                  M_m = N[Abs[M], $MachinePrecision]
                                                                                  NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                  code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -4e-121], N[Abs[N[(N[(d / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision] * N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(0.5 / d), $MachinePrecision] * D), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(N[(M$95$m * N[(D * 0.25), $MachinePrecision]), $MachinePrecision] / N[((-l) * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * d), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                                                                                  
                                                                                  \begin{array}{l}
                                                                                  M_m = \left|M\right|
                                                                                  \\
                                                                                  [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                                                                  \\
                                                                                  \begin{array}{l}
                                                                                  \mathbf{if}\;d \leq -4 \cdot 10^{-121}:\\
                                                                                  \;\;\;\;\left|\frac{\frac{d}{\sqrt{-\ell}}}{\sqrt{-h}}\right|\\
                                                                                  
                                                                                  \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
                                                                                  \;\;\;\;\left(\frac{M\_m \cdot M\_m}{d} \cdot \left(0.125 \cdot \left(D \cdot D\right)\right)\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\
                                                                                  
                                                                                  \mathbf{else}:\\
                                                                                  \;\;\;\;\frac{\mathsf{fma}\left(\left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\_m\right) \cdot \frac{M\_m \cdot \left(D \cdot 0.25\right)}{\left(-\ell\right) \cdot d}, h, 1\right) \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\\
                                                                                  
                                                                                  
                                                                                  \end{array}
                                                                                  \end{array}
                                                                                  
                                                                                  Derivation
                                                                                  1. Split input into 3 regimes
                                                                                  2. if d < -3.9999999999999999e-121

                                                                                    1. Initial program 79.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-*.f646.5

                                                                                        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                                    5. Applied rewrites6.5%

                                                                                      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                                                    6. Step-by-step derivation
                                                                                      1. Applied rewrites55.0%

                                                                                        \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                                      2. Step-by-step derivation
                                                                                        1. Applied rewrites66.2%

                                                                                          \[\leadsto \left|\frac{\frac{d}{\sqrt{-\ell}}}{\sqrt{-h}}\right| \]

                                                                                        if -3.9999999999999999e-121 < d < -4.999999999999985e-310

                                                                                        1. Initial program 57.8%

                                                                                          \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                                        2. Add Preprocessing
                                                                                        3. Taylor expanded in h around -inf

                                                                                          \[\leadsto \color{blue}{\frac{-1}{8} \cdot \left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
                                                                                        4. Step-by-step derivation
                                                                                          1. associate-*r*N/A

                                                                                            \[\leadsto \color{blue}{\left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot {\left(\sqrt{-1}\right)}^{2}\right)}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
                                                                                          2. lower-*.f64N/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}}}} \]
                                                                                        5. Applied rewrites43.5%

                                                                                          \[\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}{\left(\ell \cdot \ell\right) \cdot \ell}}} \]

                                                                                        if -4.999999999999985e-310 < d

                                                                                        1. Initial program 73.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. lift-pow.f64N/A

                                                                                            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\frac{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
                                                                                          7. unpow2N/A

                                                                                            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}}{\frac{\ell}{h}}\right) \]
                                                                                          8. associate-*r*N/A

                                                                                            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\color{blue}{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}\right) \]
                                                                                          9. div-invN/A

                                                                                            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
                                                                                          10. times-fracN/A

                                                                                            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                                          11. lower-*.f64N/A

                                                                                            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                                        4. Applied rewrites71.3%

                                                                                          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\left(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{\ell} \cdot \frac{\left(\frac{0.5}{d} \cdot D\right) \cdot M}{\frac{1}{h}}}\right) \]
                                                                                        5. Applied rewrites62.4%

                                                                                          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\left(-\frac{\left(0.25 \cdot D\right) \cdot M}{\ell \cdot d}\right) \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}}} \]
                                                                                        6. Step-by-step derivation
                                                                                          1. lift-sqrt.f64N/A

                                                                                            \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\color{blue}{\sqrt{\ell \cdot h}}} \]
                                                                                          2. lift-*.f64N/A

                                                                                            \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\color{blue}{\ell \cdot h}}} \]
                                                                                          3. sqrt-prodN/A

                                                                                            \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
                                                                                          4. pow1/2N/A

                                                                                            \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\color{blue}{{\ell}^{\frac{1}{2}}} \cdot \sqrt{h}} \]
                                                                                          5. lower-*.f64N/A

                                                                                            \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\color{blue}{{\ell}^{\frac{1}{2}} \cdot \sqrt{h}}} \]
                                                                                          6. pow1/2N/A

                                                                                            \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\color{blue}{\sqrt{\ell}} \cdot \sqrt{h}} \]
                                                                                          7. lower-sqrt.f64N/A

                                                                                            \[\leadsto \frac{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{\left(\frac{1}{4} \cdot D\right) \cdot M}{\ell \cdot d}\right)\right) \cdot \left(M \cdot \left(D \cdot \frac{\frac{1}{2}}{d}\right)\right), h, 1\right) \cdot d}{\color{blue}{\sqrt{\ell}} \cdot \sqrt{h}} \]
                                                                                          8. lower-sqrt.f6481.1

                                                                                            \[\leadsto \frac{\mathsf{fma}\left(\left(-\frac{\left(0.25 \cdot D\right) \cdot M}{\ell \cdot d}\right) \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
                                                                                        7. Applied rewrites81.1%

                                                                                          \[\leadsto \frac{\mathsf{fma}\left(\left(-\frac{\left(0.25 \cdot D\right) \cdot M}{\ell \cdot d}\right) \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right), h, 1\right) \cdot d}{\color{blue}{\sqrt{\ell} \cdot \sqrt{h}}} \]
                                                                                      3. Recombined 3 regimes into one program.
                                                                                      4. Final simplification68.7%

                                                                                        \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4 \cdot 10^{-121}:\\ \;\;\;\;\left|\frac{\frac{d}{\sqrt{-\ell}}}{\sqrt{-h}}\right|\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left(\frac{M \cdot M}{d} \cdot \left(0.125 \cdot \left(D \cdot D\right)\right)\right) \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\right) \cdot \frac{M \cdot \left(D \cdot 0.25\right)}{\left(-\ell\right) \cdot d}, h, 1\right) \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
                                                                                      5. Add Preprocessing

                                                                                      Alternative 22: 62.6% accurate, 3.8× speedup?

                                                                                      \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \frac{-1}{\ell \cdot h}\\ \mathbf{if}\;\ell \leq -7.8 \cdot 10^{-169}:\\ \;\;\;\;\left|\frac{d}{\sqrt{-h} \cdot \sqrt{-\ell}}\right|\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\sqrt{t\_0 \cdot t\_0}} \cdot d\\ \mathbf{elif}\;\ell \leq 7.6 \cdot 10^{+69}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.25 \cdot \left(M\_m \cdot D\right)}{\ell \cdot d}, \left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\_m\right) \cdot h, 1\right)}{\sqrt{\ell \cdot h}} \cdot d\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
                                                                                      M_m = (fabs.f64 M)
                                                                                      NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                      (FPCore (d h l M_m D)
                                                                                       :precision binary64
                                                                                       (let* ((t_0 (/ -1.0 (* l h))))
                                                                                         (if (<= l -7.8e-169)
                                                                                           (fabs (/ d (* (sqrt (- h)) (sqrt (- l)))))
                                                                                           (if (<= l -5e-310)
                                                                                             (* (sqrt (sqrt (* t_0 t_0))) d)
                                                                                             (if (<= l 7.6e+69)
                                                                                               (*
                                                                                                (/
                                                                                                 (fma
                                                                                                  (/ (* -0.25 (* M_m D)) (* l d))
                                                                                                  (* (* (* (/ 0.5 d) D) M_m) h)
                                                                                                  1.0)
                                                                                                 (sqrt (* l h)))
                                                                                                d)
                                                                                               (/ d (* (sqrt h) (sqrt l))))))))
                                                                                      M_m = fabs(M);
                                                                                      assert(d < h && h < l && l < M_m && M_m < D);
                                                                                      double code(double d, double h, double l, double M_m, double D) {
                                                                                      	double t_0 = -1.0 / (l * h);
                                                                                      	double tmp;
                                                                                      	if (l <= -7.8e-169) {
                                                                                      		tmp = fabs((d / (sqrt(-h) * sqrt(-l))));
                                                                                      	} else if (l <= -5e-310) {
                                                                                      		tmp = sqrt(sqrt((t_0 * t_0))) * d;
                                                                                      	} else if (l <= 7.6e+69) {
                                                                                      		tmp = (fma(((-0.25 * (M_m * D)) / (l * d)), ((((0.5 / d) * D) * M_m) * h), 1.0) / sqrt((l * h))) * d;
                                                                                      	} else {
                                                                                      		tmp = d / (sqrt(h) * sqrt(l));
                                                                                      	}
                                                                                      	return tmp;
                                                                                      }
                                                                                      
                                                                                      M_m = abs(M)
                                                                                      d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                                                                      function code(d, h, l, M_m, D)
                                                                                      	t_0 = Float64(-1.0 / Float64(l * h))
                                                                                      	tmp = 0.0
                                                                                      	if (l <= -7.8e-169)
                                                                                      		tmp = abs(Float64(d / Float64(sqrt(Float64(-h)) * sqrt(Float64(-l)))));
                                                                                      	elseif (l <= -5e-310)
                                                                                      		tmp = Float64(sqrt(sqrt(Float64(t_0 * t_0))) * d);
                                                                                      	elseif (l <= 7.6e+69)
                                                                                      		tmp = Float64(Float64(fma(Float64(Float64(-0.25 * Float64(M_m * D)) / Float64(l * d)), Float64(Float64(Float64(Float64(0.5 / d) * D) * M_m) * h), 1.0) / sqrt(Float64(l * h))) * d);
                                                                                      	else
                                                                                      		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
                                                                                      	end
                                                                                      	return tmp
                                                                                      end
                                                                                      
                                                                                      M_m = N[Abs[M], $MachinePrecision]
                                                                                      NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                      code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(-1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -7.8e-169], N[Abs[N[(d / N[(N[Sqrt[(-h)], $MachinePrecision] * N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[Sqrt[N[Sqrt[N[(t$95$0 * t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision], If[LessEqual[l, 7.6e+69], N[(N[(N[(N[(N[(-0.25 * N[(M$95$m * D), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(0.5 / d), $MachinePrecision] * D), $MachinePrecision] * M$95$m), $MachinePrecision] * h), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
                                                                                      
                                                                                      \begin{array}{l}
                                                                                      M_m = \left|M\right|
                                                                                      \\
                                                                                      [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                                                                      \\
                                                                                      \begin{array}{l}
                                                                                      t_0 := \frac{-1}{\ell \cdot h}\\
                                                                                      \mathbf{if}\;\ell \leq -7.8 \cdot 10^{-169}:\\
                                                                                      \;\;\;\;\left|\frac{d}{\sqrt{-h} \cdot \sqrt{-\ell}}\right|\\
                                                                                      
                                                                                      \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
                                                                                      \;\;\;\;\sqrt{\sqrt{t\_0 \cdot t\_0}} \cdot d\\
                                                                                      
                                                                                      \mathbf{elif}\;\ell \leq 7.6 \cdot 10^{+69}:\\
                                                                                      \;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.25 \cdot \left(M\_m \cdot D\right)}{\ell \cdot d}, \left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\_m\right) \cdot h, 1\right)}{\sqrt{\ell \cdot h}} \cdot d\\
                                                                                      
                                                                                      \mathbf{else}:\\
                                                                                      \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
                                                                                      
                                                                                      
                                                                                      \end{array}
                                                                                      \end{array}
                                                                                      
                                                                                      Derivation
                                                                                      1. Split input into 4 regimes
                                                                                      2. if l < -7.79999999999999954e-169

                                                                                        1. Initial program 69.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-*.f646.9

                                                                                            \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                                        5. Applied rewrites6.9%

                                                                                          \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                                                        6. Step-by-step derivation
                                                                                          1. Applied rewrites49.6%

                                                                                            \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                                          2. Step-by-step derivation
                                                                                            1. Applied rewrites58.1%

                                                                                              \[\leadsto \left|\frac{-d}{\sqrt{-\ell} \cdot \left(-\sqrt{-h}\right)}\right| \]

                                                                                            if -7.79999999999999954e-169 < l < -4.999999999999985e-310

                                                                                            1. Initial program 86.4%

                                                                                              \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                                            2. Add Preprocessing
                                                                                            3. Taylor expanded in 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-*.f6433.5

                                                                                                \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                                            5. Applied rewrites33.5%

                                                                                              \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                                                            6. Step-by-step derivation
                                                                                              1. Applied rewrites50.9%

                                                                                                \[\leadsto \sqrt{\sqrt{\frac{1}{\ell \cdot h} \cdot \frac{1}{\ell \cdot h}}} \cdot d \]

                                                                                              if -4.999999999999985e-310 < l < 7.60000000000000055e69

                                                                                              1. Initial program 82.1%

                                                                                                \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                                              2. Add Preprocessing
                                                                                              3. Step-by-step derivation
                                                                                                1. lift-*.f64N/A

                                                                                                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}}\right) \]
                                                                                                2. lift-/.f64N/A

                                                                                                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
                                                                                                3. clear-numN/A

                                                                                                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{1}{\frac{\ell}{h}}}\right) \]
                                                                                                4. un-div-invN/A

                                                                                                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\frac{\ell}{h}}}\right) \]
                                                                                                5. lift-*.f64N/A

                                                                                                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\color{blue}{\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
                                                                                                6. lift-pow.f64N/A

                                                                                                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\frac{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}}{\frac{\ell}{h}}\right) \]
                                                                                                7. unpow2N/A

                                                                                                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\frac{1}{2} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}}{\frac{\ell}{h}}\right) \]
                                                                                                8. associate-*r*N/A

                                                                                                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\color{blue}{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}\right) \]
                                                                                                9. div-invN/A

                                                                                                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left(\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}{\color{blue}{\ell \cdot \frac{1}{h}}}\right) \]
                                                                                                10. times-fracN/A

                                                                                                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                                                11. lower-*.f64N/A

                                                                                                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{\frac{1}{2} \cdot \frac{M \cdot D}{2 \cdot d}}{\ell} \cdot \frac{\frac{M \cdot D}{2 \cdot d}}{\frac{1}{h}}}\right) \]
                                                                                              4. Applied rewrites80.6%

                                                                                                \[\leadsto \left({\left(\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(0.5 \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{M}{d}}{\ell} \cdot \frac{\left(\frac{0.5}{d} \cdot D\right) \cdot M}{\frac{1}{h}}}\right) \]
                                                                                              5. Applied rewrites78.2%

                                                                                                \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\left(-\frac{\left(0.25 \cdot D\right) \cdot M}{\ell \cdot d}\right) \cdot \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right), h, 1\right) \cdot d}{\sqrt{\ell \cdot h}}} \]
                                                                                              6. Applied rewrites79.6%

                                                                                                \[\leadsto \color{blue}{d \cdot \frac{\mathsf{fma}\left(\frac{-0.25 \cdot \left(M \cdot D\right)}{\ell \cdot d}, \left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right) \cdot h, 1\right)}{\sqrt{\ell \cdot h}}} \]

                                                                                              if 7.60000000000000055e69 < l

                                                                                              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. Taylor expanded in d around inf

                                                                                                \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                              4. Step-by-step derivation
                                                                                                1. *-commutativeN/A

                                                                                                  \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                                                                                2. lower-*.f64N/A

                                                                                                  \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                                                                                3. lower-sqrt.f64N/A

                                                                                                  \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                                                                                                4. lower-/.f64N/A

                                                                                                  \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                                                                                                5. *-commutativeN/A

                                                                                                  \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                                                6. lower-*.f6445.4

                                                                                                  \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                                              5. Applied rewrites45.4%

                                                                                                \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                                                              6. Step-by-step derivation
                                                                                                1. Applied rewrites45.4%

                                                                                                  \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                                                                                                2. Step-by-step derivation
                                                                                                  1. Applied rewrites69.1%

                                                                                                    \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
                                                                                                3. Recombined 4 regimes into one program.
                                                                                                4. Final simplification64.9%

                                                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -7.8 \cdot 10^{-169}:\\ \;\;\;\;\left|\frac{d}{\sqrt{-h} \cdot \sqrt{-\ell}}\right|\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\sqrt{\sqrt{\frac{-1}{\ell \cdot h} \cdot \frac{-1}{\ell \cdot h}}} \cdot d\\ \mathbf{elif}\;\ell \leq 7.6 \cdot 10^{+69}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.25 \cdot \left(M \cdot D\right)}{\ell \cdot d}, \left(\left(\frac{0.5}{d} \cdot D\right) \cdot M\right) \cdot h, 1\right)}{\sqrt{\ell \cdot h}} \cdot d\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
                                                                                                5. Add Preprocessing

                                                                                                Alternative 23: 49.7% accurate, 8.4× speedup?

                                                                                                \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left|\frac{d}{\sqrt{-h} \cdot \sqrt{-\ell}}\right|\\ \mathbf{elif}\;\ell \leq 4.7 \cdot 10^{-228}:\\ \;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
                                                                                                M_m = (fabs.f64 M)
                                                                                                NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                                (FPCore (d h l M_m D)
                                                                                                 :precision binary64
                                                                                                 (if (<= l -5e-310)
                                                                                                   (fabs (/ d (* (sqrt (- h)) (sqrt (- l)))))
                                                                                                   (if (<= l 4.7e-228)
                                                                                                     (* (sqrt (/ 1.0 (* l h))) (- d))
                                                                                                     (/ d (* (sqrt h) (sqrt l))))))
                                                                                                M_m = fabs(M);
                                                                                                assert(d < h && h < l && l < M_m && M_m < D);
                                                                                                double code(double d, double h, double l, double M_m, double D) {
                                                                                                	double tmp;
                                                                                                	if (l <= -5e-310) {
                                                                                                		tmp = fabs((d / (sqrt(-h) * sqrt(-l))));
                                                                                                	} else if (l <= 4.7e-228) {
                                                                                                		tmp = sqrt((1.0 / (l * h))) * -d;
                                                                                                	} else {
                                                                                                		tmp = d / (sqrt(h) * sqrt(l));
                                                                                                	}
                                                                                                	return tmp;
                                                                                                }
                                                                                                
                                                                                                M_m = abs(m)
                                                                                                NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                                real(8) function code(d, h, l, m_m, d_1)
                                                                                                    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_1
                                                                                                    real(8) :: tmp
                                                                                                    if (l <= (-5d-310)) then
                                                                                                        tmp = abs((d / (sqrt(-h) * sqrt(-l))))
                                                                                                    else if (l <= 4.7d-228) then
                                                                                                        tmp = sqrt((1.0d0 / (l * h))) * -d
                                                                                                    else
                                                                                                        tmp = d / (sqrt(h) * sqrt(l))
                                                                                                    end if
                                                                                                    code = tmp
                                                                                                end function
                                                                                                
                                                                                                M_m = Math.abs(M);
                                                                                                assert d < h && h < l && l < M_m && M_m < D;
                                                                                                public static double code(double d, double h, double l, double M_m, double D) {
                                                                                                	double tmp;
                                                                                                	if (l <= -5e-310) {
                                                                                                		tmp = Math.abs((d / (Math.sqrt(-h) * Math.sqrt(-l))));
                                                                                                	} else if (l <= 4.7e-228) {
                                                                                                		tmp = Math.sqrt((1.0 / (l * h))) * -d;
                                                                                                	} else {
                                                                                                		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
                                                                                                	}
                                                                                                	return tmp;
                                                                                                }
                                                                                                
                                                                                                M_m = math.fabs(M)
                                                                                                [d, h, l, M_m, D] = sort([d, h, l, M_m, D])
                                                                                                def code(d, h, l, M_m, D):
                                                                                                	tmp = 0
                                                                                                	if l <= -5e-310:
                                                                                                		tmp = math.fabs((d / (math.sqrt(-h) * math.sqrt(-l))))
                                                                                                	elif l <= 4.7e-228:
                                                                                                		tmp = math.sqrt((1.0 / (l * h))) * -d
                                                                                                	else:
                                                                                                		tmp = d / (math.sqrt(h) * math.sqrt(l))
                                                                                                	return tmp
                                                                                                
                                                                                                M_m = abs(M)
                                                                                                d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                                                                                function code(d, h, l, M_m, D)
                                                                                                	tmp = 0.0
                                                                                                	if (l <= -5e-310)
                                                                                                		tmp = abs(Float64(d / Float64(sqrt(Float64(-h)) * sqrt(Float64(-l)))));
                                                                                                	elseif (l <= 4.7e-228)
                                                                                                		tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d));
                                                                                                	else
                                                                                                		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
                                                                                                	end
                                                                                                	return tmp
                                                                                                end
                                                                                                
                                                                                                M_m = abs(M);
                                                                                                d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
                                                                                                function tmp_2 = code(d, h, l, M_m, D)
                                                                                                	tmp = 0.0;
                                                                                                	if (l <= -5e-310)
                                                                                                		tmp = abs((d / (sqrt(-h) * sqrt(-l))));
                                                                                                	elseif (l <= 4.7e-228)
                                                                                                		tmp = sqrt((1.0 / (l * h))) * -d;
                                                                                                	else
                                                                                                		tmp = d / (sqrt(h) * sqrt(l));
                                                                                                	end
                                                                                                	tmp_2 = tmp;
                                                                                                end
                                                                                                
                                                                                                M_m = N[Abs[M], $MachinePrecision]
                                                                                                NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                                code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -5e-310], N[Abs[N[(d / N[(N[Sqrt[(-h)], $MachinePrecision] * N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 4.7e-228], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                                                                                                
                                                                                                \begin{array}{l}
                                                                                                M_m = \left|M\right|
                                                                                                \\
                                                                                                [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                                                                                \\
                                                                                                \begin{array}{l}
                                                                                                \mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
                                                                                                \;\;\;\;\left|\frac{d}{\sqrt{-h} \cdot \sqrt{-\ell}}\right|\\
                                                                                                
                                                                                                \mathbf{elif}\;\ell \leq 4.7 \cdot 10^{-228}:\\
                                                                                                \;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
                                                                                                
                                                                                                \mathbf{else}:\\
                                                                                                \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
                                                                                                
                                                                                                
                                                                                                \end{array}
                                                                                                \end{array}
                                                                                                
                                                                                                Derivation
                                                                                                1. Split input into 3 regimes
                                                                                                2. if l < -4.999999999999985e-310

                                                                                                  1. Initial program 72.4%

                                                                                                    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                                                  2. Add Preprocessing
                                                                                                  3. Taylor expanded in d around inf

                                                                                                    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                  4. Step-by-step derivation
                                                                                                    1. *-commutativeN/A

                                                                                                      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                                                                                    2. lower-*.f64N/A

                                                                                                      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}} \cdot d} \]
                                                                                                    3. lower-sqrt.f64N/A

                                                                                                      \[\leadsto \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \cdot d \]
                                                                                                    4. lower-/.f64N/A

                                                                                                      \[\leadsto \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \cdot d \]
                                                                                                    5. *-commutativeN/A

                                                                                                      \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                                                    6. lower-*.f6412.1

                                                                                                      \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                                                  5. Applied rewrites12.1%

                                                                                                    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                                                                  6. Step-by-step derivation
                                                                                                    1. Applied rewrites44.2%

                                                                                                      \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                                                    2. Step-by-step derivation
                                                                                                      1. Applied rewrites51.6%

                                                                                                        \[\leadsto \left|\frac{-d}{\sqrt{-\ell} \cdot \left(-\sqrt{-h}\right)}\right| \]

                                                                                                      if -4.999999999999985e-310 < l < 4.7000000000000002e-228

                                                                                                      1. Initial program 83.3%

                                                                                                        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                                                      2. Add Preprocessing
                                                                                                      3. Taylor expanded in l around -inf

                                                                                                        \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                      4. Step-by-step derivation
                                                                                                        1. *-commutativeN/A

                                                                                                          \[\leadsto \color{blue}{\left({\left(\sqrt{-1}\right)}^{2} \cdot d\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                                                                                        2. unpow2N/A

                                                                                                          \[\leadsto \left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                                                                                        3. rem-square-sqrtN/A

                                                                                                          \[\leadsto \left(\color{blue}{-1} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                                                                                        4. lower-*.f64N/A

                                                                                                          \[\leadsto \color{blue}{\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                        5. mul-1-negN/A

                                                                                                          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                                                                                        6. lower-neg.f64N/A

                                                                                                          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                                                                                        7. lower-sqrt.f64N/A

                                                                                                          \[\leadsto \left(\mathsf{neg}\left(d\right)\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                        8. lower-/.f64N/A

                                                                                                          \[\leadsto \left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                                                                                                        9. *-commutativeN/A

                                                                                                          \[\leadsto \left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
                                                                                                        10. lower-*.f6458.7

                                                                                                          \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
                                                                                                      5. Applied rewrites58.7%

                                                                                                        \[\leadsto \color{blue}{\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]

                                                                                                      if 4.7000000000000002e-228 < l

                                                                                                      1. Initial program 71.8%

                                                                                                        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                                                      2. Add Preprocessing
                                                                                                      3. Taylor expanded in d around inf

                                                                                                        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                      4. Step-by-step derivation
                                                                                                        1. *-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-*.f6442.0

                                                                                                          \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                                                      5. Applied rewrites42.0%

                                                                                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                                                                      6. Step-by-step derivation
                                                                                                        1. Applied rewrites42.0%

                                                                                                          \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                                                                                                        2. Step-by-step derivation
                                                                                                          1. Applied rewrites56.0%

                                                                                                            \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
                                                                                                        3. Recombined 3 regimes into one program.
                                                                                                        4. Final simplification53.7%

                                                                                                          \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left|\frac{d}{\sqrt{-h} \cdot \sqrt{-\ell}}\right|\\ \mathbf{elif}\;\ell \leq 4.7 \cdot 10^{-228}:\\ \;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
                                                                                                        5. Add Preprocessing

                                                                                                        Alternative 24: 45.8% accurate, 9.0× speedup?

                                                                                                        \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 4.7 \cdot 10^{-228}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{\ell \cdot h}}{-d}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
                                                                                                        M_m = (fabs.f64 M)
                                                                                                        NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                                        (FPCore (d h l M_m D)
                                                                                                         :precision binary64
                                                                                                         (if (<= l 4.7e-228)
                                                                                                           (/ 1.0 (/ (sqrt (* l h)) (- d)))
                                                                                                           (/ d (* (sqrt h) (sqrt l)))))
                                                                                                        M_m = fabs(M);
                                                                                                        assert(d < h && h < l && l < M_m && M_m < D);
                                                                                                        double code(double d, double h, double l, double M_m, double D) {
                                                                                                        	double tmp;
                                                                                                        	if (l <= 4.7e-228) {
                                                                                                        		tmp = 1.0 / (sqrt((l * h)) / -d);
                                                                                                        	} else {
                                                                                                        		tmp = d / (sqrt(h) * sqrt(l));
                                                                                                        	}
                                                                                                        	return tmp;
                                                                                                        }
                                                                                                        
                                                                                                        M_m = abs(m)
                                                                                                        NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                                        real(8) function code(d, h, l, m_m, d_1)
                                                                                                            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_1
                                                                                                            real(8) :: tmp
                                                                                                            if (l <= 4.7d-228) then
                                                                                                                tmp = 1.0d0 / (sqrt((l * h)) / -d)
                                                                                                            else
                                                                                                                tmp = d / (sqrt(h) * sqrt(l))
                                                                                                            end if
                                                                                                            code = tmp
                                                                                                        end function
                                                                                                        
                                                                                                        M_m = Math.abs(M);
                                                                                                        assert d < h && h < l && l < M_m && M_m < D;
                                                                                                        public static double code(double d, double h, double l, double M_m, double D) {
                                                                                                        	double tmp;
                                                                                                        	if (l <= 4.7e-228) {
                                                                                                        		tmp = 1.0 / (Math.sqrt((l * h)) / -d);
                                                                                                        	} else {
                                                                                                        		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
                                                                                                        	}
                                                                                                        	return tmp;
                                                                                                        }
                                                                                                        
                                                                                                        M_m = math.fabs(M)
                                                                                                        [d, h, l, M_m, D] = sort([d, h, l, M_m, D])
                                                                                                        def code(d, h, l, M_m, D):
                                                                                                        	tmp = 0
                                                                                                        	if l <= 4.7e-228:
                                                                                                        		tmp = 1.0 / (math.sqrt((l * h)) / -d)
                                                                                                        	else:
                                                                                                        		tmp = d / (math.sqrt(h) * math.sqrt(l))
                                                                                                        	return tmp
                                                                                                        
                                                                                                        M_m = abs(M)
                                                                                                        d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                                                                                        function code(d, h, l, M_m, D)
                                                                                                        	tmp = 0.0
                                                                                                        	if (l <= 4.7e-228)
                                                                                                        		tmp = Float64(1.0 / Float64(sqrt(Float64(l * h)) / Float64(-d)));
                                                                                                        	else
                                                                                                        		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
                                                                                                        	end
                                                                                                        	return tmp
                                                                                                        end
                                                                                                        
                                                                                                        M_m = abs(M);
                                                                                                        d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
                                                                                                        function tmp_2 = code(d, h, l, M_m, D)
                                                                                                        	tmp = 0.0;
                                                                                                        	if (l <= 4.7e-228)
                                                                                                        		tmp = 1.0 / (sqrt((l * h)) / -d);
                                                                                                        	else
                                                                                                        		tmp = d / (sqrt(h) * sqrt(l));
                                                                                                        	end
                                                                                                        	tmp_2 = tmp;
                                                                                                        end
                                                                                                        
                                                                                                        M_m = N[Abs[M], $MachinePrecision]
                                                                                                        NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                                        code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 4.7e-228], N[(1.0 / N[(N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision] / (-d)), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                                                                        
                                                                                                        \begin{array}{l}
                                                                                                        M_m = \left|M\right|
                                                                                                        \\
                                                                                                        [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                                                                                        \\
                                                                                                        \begin{array}{l}
                                                                                                        \mathbf{if}\;\ell \leq 4.7 \cdot 10^{-228}:\\
                                                                                                        \;\;\;\;\frac{1}{\frac{\sqrt{\ell \cdot h}}{-d}}\\
                                                                                                        
                                                                                                        \mathbf{else}:\\
                                                                                                        \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
                                                                                                        
                                                                                                        
                                                                                                        \end{array}
                                                                                                        \end{array}
                                                                                                        
                                                                                                        Derivation
                                                                                                        1. Split input into 2 regimes
                                                                                                        2. if l < 4.7000000000000002e-228

                                                                                                          1. Initial program 73.2%

                                                                                                            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                                                          2. Add Preprocessing
                                                                                                          3. 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-*.f6412.5

                                                                                                              \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                                                          5. Applied rewrites12.5%

                                                                                                            \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                                                                          6. Step-by-step derivation
                                                                                                            1. Applied rewrites29.8%

                                                                                                              \[\leadsto \frac{1}{\color{blue}{\sqrt{\frac{\ell}{d \cdot \frac{d}{h}}}}} \]
                                                                                                            2. Taylor expanded in d around -inf

                                                                                                              \[\leadsto \frac{1}{-1 \cdot \color{blue}{\left(\frac{1}{d} \cdot \sqrt{h \cdot \ell}\right)}} \]
                                                                                                            3. Step-by-step derivation
                                                                                                              1. Applied rewrites45.3%

                                                                                                                \[\leadsto \frac{1}{\frac{\sqrt{\ell \cdot h}}{\color{blue}{-d}}} \]

                                                                                                              if 4.7000000000000002e-228 < l

                                                                                                              1. Initial program 71.8%

                                                                                                                \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                                                              2. Add Preprocessing
                                                                                                              3. Taylor expanded in d around inf

                                                                                                                \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                              4. Step-by-step derivation
                                                                                                                1. *-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-*.f6442.0

                                                                                                                  \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                                                              5. Applied rewrites42.0%

                                                                                                                \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                                                                              6. Step-by-step derivation
                                                                                                                1. Applied rewrites42.0%

                                                                                                                  \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                                                                                                                2. Step-by-step derivation
                                                                                                                  1. Applied rewrites56.0%

                                                                                                                    \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
                                                                                                                3. Recombined 2 regimes into one program.
                                                                                                                4. Final simplification49.6%

                                                                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 4.7 \cdot 10^{-228}:\\ \;\;\;\;\frac{1}{\frac{\sqrt{\ell \cdot h}}{-d}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
                                                                                                                5. Add Preprocessing

                                                                                                                Alternative 25: 45.9% accurate, 9.6× speedup?

                                                                                                                \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 4.7 \cdot 10^{-228}:\\ \;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
                                                                                                                M_m = (fabs.f64 M)
                                                                                                                NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                                                (FPCore (d h l M_m D)
                                                                                                                 :precision binary64
                                                                                                                 (if (<= l 4.7e-228)
                                                                                                                   (* (sqrt (/ 1.0 (* l h))) (- d))
                                                                                                                   (/ d (* (sqrt h) (sqrt l)))))
                                                                                                                M_m = fabs(M);
                                                                                                                assert(d < h && h < l && l < M_m && M_m < D);
                                                                                                                double code(double d, double h, double l, double M_m, double D) {
                                                                                                                	double tmp;
                                                                                                                	if (l <= 4.7e-228) {
                                                                                                                		tmp = sqrt((1.0 / (l * h))) * -d;
                                                                                                                	} else {
                                                                                                                		tmp = d / (sqrt(h) * sqrt(l));
                                                                                                                	}
                                                                                                                	return tmp;
                                                                                                                }
                                                                                                                
                                                                                                                M_m = abs(m)
                                                                                                                NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                                                real(8) function code(d, h, l, m_m, d_1)
                                                                                                                    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_1
                                                                                                                    real(8) :: tmp
                                                                                                                    if (l <= 4.7d-228) then
                                                                                                                        tmp = sqrt((1.0d0 / (l * h))) * -d
                                                                                                                    else
                                                                                                                        tmp = d / (sqrt(h) * sqrt(l))
                                                                                                                    end if
                                                                                                                    code = tmp
                                                                                                                end function
                                                                                                                
                                                                                                                M_m = Math.abs(M);
                                                                                                                assert d < h && h < l && l < M_m && M_m < D;
                                                                                                                public static double code(double d, double h, double l, double M_m, double D) {
                                                                                                                	double tmp;
                                                                                                                	if (l <= 4.7e-228) {
                                                                                                                		tmp = Math.sqrt((1.0 / (l * h))) * -d;
                                                                                                                	} else {
                                                                                                                		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
                                                                                                                	}
                                                                                                                	return tmp;
                                                                                                                }
                                                                                                                
                                                                                                                M_m = math.fabs(M)
                                                                                                                [d, h, l, M_m, D] = sort([d, h, l, M_m, D])
                                                                                                                def code(d, h, l, M_m, D):
                                                                                                                	tmp = 0
                                                                                                                	if l <= 4.7e-228:
                                                                                                                		tmp = math.sqrt((1.0 / (l * h))) * -d
                                                                                                                	else:
                                                                                                                		tmp = d / (math.sqrt(h) * math.sqrt(l))
                                                                                                                	return tmp
                                                                                                                
                                                                                                                M_m = abs(M)
                                                                                                                d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                                                                                                function code(d, h, l, M_m, D)
                                                                                                                	tmp = 0.0
                                                                                                                	if (l <= 4.7e-228)
                                                                                                                		tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d));
                                                                                                                	else
                                                                                                                		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
                                                                                                                	end
                                                                                                                	return tmp
                                                                                                                end
                                                                                                                
                                                                                                                M_m = abs(M);
                                                                                                                d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
                                                                                                                function tmp_2 = code(d, h, l, M_m, D)
                                                                                                                	tmp = 0.0;
                                                                                                                	if (l <= 4.7e-228)
                                                                                                                		tmp = sqrt((1.0 / (l * h))) * -d;
                                                                                                                	else
                                                                                                                		tmp = d / (sqrt(h) * sqrt(l));
                                                                                                                	end
                                                                                                                	tmp_2 = tmp;
                                                                                                                end
                                                                                                                
                                                                                                                M_m = N[Abs[M], $MachinePrecision]
                                                                                                                NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                                                code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, 4.7e-228], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                                                                                
                                                                                                                \begin{array}{l}
                                                                                                                M_m = \left|M\right|
                                                                                                                \\
                                                                                                                [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                                                                                                \\
                                                                                                                \begin{array}{l}
                                                                                                                \mathbf{if}\;\ell \leq 4.7 \cdot 10^{-228}:\\
                                                                                                                \;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
                                                                                                                
                                                                                                                \mathbf{else}:\\
                                                                                                                \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
                                                                                                                
                                                                                                                
                                                                                                                \end{array}
                                                                                                                \end{array}
                                                                                                                
                                                                                                                Derivation
                                                                                                                1. Split input into 2 regimes
                                                                                                                2. if l < 4.7000000000000002e-228

                                                                                                                  1. Initial program 73.2%

                                                                                                                    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                                                                  2. Add Preprocessing
                                                                                                                  3. 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(\mathsf{neg}\left(d\right)\right)} \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                                                                                                                    7. lower-sqrt.f64N/A

                                                                                                                      \[\leadsto \left(\mathsf{neg}\left(d\right)\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                    8. lower-/.f64N/A

                                                                                                                      \[\leadsto \left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
                                                                                                                    9. *-commutativeN/A

                                                                                                                      \[\leadsto \left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
                                                                                                                    10. lower-*.f6444.9

                                                                                                                      \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
                                                                                                                  5. Applied rewrites44.9%

                                                                                                                    \[\leadsto \color{blue}{\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]

                                                                                                                  if 4.7000000000000002e-228 < l

                                                                                                                  1. Initial program 71.8%

                                                                                                                    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                                                                                                                  2. Add Preprocessing
                                                                                                                  3. Taylor expanded in d around inf

                                                                                                                    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                                                                                                                  4. Step-by-step derivation
                                                                                                                    1. *-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-*.f6442.0

                                                                                                                      \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                                                                  5. Applied rewrites42.0%

                                                                                                                    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                                                                                  6. Step-by-step derivation
                                                                                                                    1. Applied rewrites42.0%

                                                                                                                      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                                                                                                                    2. Step-by-step derivation
                                                                                                                      1. Applied rewrites56.0%

                                                                                                                        \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
                                                                                                                    3. Recombined 2 regimes into one program.
                                                                                                                    4. Final simplification49.3%

                                                                                                                      \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 4.7 \cdot 10^{-228}:\\ \;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
                                                                                                                    5. Add Preprocessing

                                                                                                                    Alternative 26: 26.5% accurate, 15.3× speedup?

                                                                                                                    \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \frac{d}{\sqrt{\ell \cdot h}} \end{array} \]
                                                                                                                    M_m = (fabs.f64 M)
                                                                                                                    NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                                                    (FPCore (d h l M_m D) :precision binary64 (/ d (sqrt (* l h))))
                                                                                                                    M_m = fabs(M);
                                                                                                                    assert(d < h && h < l && l < M_m && M_m < D);
                                                                                                                    double code(double d, double h, double l, double M_m, double D) {
                                                                                                                    	return d / sqrt((l * h));
                                                                                                                    }
                                                                                                                    
                                                                                                                    M_m = abs(m)
                                                                                                                    NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                                                    real(8) function code(d, h, l, m_m, d_1)
                                                                                                                        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_1
                                                                                                                        code = d / sqrt((l * h))
                                                                                                                    end function
                                                                                                                    
                                                                                                                    M_m = Math.abs(M);
                                                                                                                    assert d < h && h < l && l < M_m && M_m < D;
                                                                                                                    public static double code(double d, double h, double l, double M_m, double D) {
                                                                                                                    	return d / Math.sqrt((l * h));
                                                                                                                    }
                                                                                                                    
                                                                                                                    M_m = math.fabs(M)
                                                                                                                    [d, h, l, M_m, D] = sort([d, h, l, M_m, D])
                                                                                                                    def code(d, h, l, M_m, D):
                                                                                                                    	return d / math.sqrt((l * h))
                                                                                                                    
                                                                                                                    M_m = abs(M)
                                                                                                                    d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                                                                                                    function code(d, h, l, M_m, D)
                                                                                                                    	return Float64(d / sqrt(Float64(l * h)))
                                                                                                                    end
                                                                                                                    
                                                                                                                    M_m = abs(M);
                                                                                                                    d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
                                                                                                                    function tmp = code(d, h, l, M_m, D)
                                                                                                                    	tmp = d / sqrt((l * h));
                                                                                                                    end
                                                                                                                    
                                                                                                                    M_m = N[Abs[M], $MachinePrecision]
                                                                                                                    NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                                                                                    code[d_, h_, l_, M$95$m_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
                                                                                                                    
                                                                                                                    \begin{array}{l}
                                                                                                                    M_m = \left|M\right|
                                                                                                                    \\
                                                                                                                    [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                                                                                                    \\
                                                                                                                    \frac{d}{\sqrt{\ell \cdot h}}
                                                                                                                    \end{array}
                                                                                                                    
                                                                                                                    Derivation
                                                                                                                    1. Initial program 72.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-*.f6424.3

                                                                                                                        \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
                                                                                                                    5. Applied rewrites24.3%

                                                                                                                      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                                                                                    6. Step-by-step derivation
                                                                                                                      1. Applied rewrites22.8%

                                                                                                                        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                                                                                                                      2. Add Preprocessing

                                                                                                                      Reproduce

                                                                                                                      ?
                                                                                                                      herbie shell --seed 2024235 
                                                                                                                      (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)))))