Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.8% → 78.4%
Time: 15.6s
Alternatives: 16
Speedup: 1.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 16 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.8% accurate, 1.0× speedup?

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

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

Alternative 1: 78.4% accurate, 1.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} t_0 := \sqrt{-d}\\ t_1 := M\_m \cdot \frac{D}{d}\\ t_2 := \mathsf{fma}\left(\frac{t\_1}{\ell}, \frac{t\_1 \cdot -0.125}{{h}^{-1}}, 1\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{if}\;h \leq -2.9 \cdot 10^{-238}:\\ \;\;\;\;t\_2 \cdot \frac{t\_0}{\sqrt{-\ell}}\\ \mathbf{elif}\;h \leq -4 \cdot 10^{-310}:\\ \;\;\;\;\frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d}{M\_m} \cdot \frac{2}{D}\right)}^{-2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_0}{\sqrt{-h}}\\ \mathbf{else}:\\ \;\;\;\;t\_2 \cdot \frac{\sqrt{d}}{\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)))
        (t_1 (* M_m (/ D d)))
        (t_2
         (*
          (fma (/ t_1 l) (/ (* t_1 -0.125) (pow h -1.0)) 1.0)
          (sqrt (/ d h)))))
   (if (<= h -2.9e-238)
     (* t_2 (/ t_0 (sqrt (- l))))
     (if (<= h -4e-310)
       (/
        (*
         (*
          (fma (* -0.5 (/ h l)) (pow (* (/ d M_m) (/ 2.0 D)) -2.0) 1.0)
          (sqrt (/ d l)))
         t_0)
        (sqrt (- h)))
       (* t_2 (/ (sqrt d) (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);
	double t_1 = M_m * (D / d);
	double t_2 = fma((t_1 / l), ((t_1 * -0.125) / pow(h, -1.0)), 1.0) * sqrt((d / h));
	double tmp;
	if (h <= -2.9e-238) {
		tmp = t_2 * (t_0 / sqrt(-l));
	} else if (h <= -4e-310) {
		tmp = ((fma((-0.5 * (h / l)), pow(((d / M_m) * (2.0 / D)), -2.0), 1.0) * sqrt((d / l))) * t_0) / sqrt(-h);
	} else {
		tmp = t_2 * (sqrt(d) / 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))
	t_1 = Float64(M_m * Float64(D / d))
	t_2 = Float64(fma(Float64(t_1 / l), Float64(Float64(t_1 * -0.125) / (h ^ -1.0)), 1.0) * sqrt(Float64(d / h)))
	tmp = 0.0
	if (h <= -2.9e-238)
		tmp = Float64(t_2 * Float64(t_0 / sqrt(Float64(-l))));
	elseif (h <= -4e-310)
		tmp = Float64(Float64(Float64(fma(Float64(-0.5 * Float64(h / l)), (Float64(Float64(d / M_m) * Float64(2.0 / D)) ^ -2.0), 1.0) * sqrt(Float64(d / l))) * t_0) / sqrt(Float64(-h)));
	else
		tmp = Float64(t_2 * Float64(sqrt(d) / 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[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$1 / l), $MachinePrecision] * N[(N[(t$95$1 * -0.125), $MachinePrecision] / N[Power[h, -1.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2.9e-238], N[(t$95$2 * N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -4e-310], N[(N[(N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(d / M$95$m), $MachinePrecision] * N[(2.0 / D), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(N[Sqrt[d], $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{-d}\\
t_1 := M\_m \cdot \frac{D}{d}\\
t_2 := \mathsf{fma}\left(\frac{t\_1}{\ell}, \frac{t\_1 \cdot -0.125}{{h}^{-1}}, 1\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{if}\;h \leq -2.9 \cdot 10^{-238}:\\
\;\;\;\;t\_2 \cdot \frac{t\_0}{\sqrt{-\ell}}\\

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

\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if h < -2.8999999999999998e-238

    1. Initial program 69.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.8999999999999998e-238 < h < -3.999999999999988e-310

    1. Initial program 39.5%

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

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

    if -3.999999999999988e-310 < h

    1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 49.5% accurate, 0.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 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-220}:\\ \;\;\;\;\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-161} \lor \neg \left(t\_0 \leq 5 \cdot 10^{+135}\right):\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{\frac{d}{\ell}}{h} \cdot d}\\ \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
         (*
          (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
          (-
           1.0
           (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))))
   (if (<= t_0 -4e-220)
     (* (sqrt (pow (* l h) -1.0)) d)
     (if (or (<= t_0 2e-161) (not (<= t_0 5e+135)))
       (fabs (/ d (sqrt (* l h))))
       (sqrt (* (/ (/ d l) h) d))))))
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 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
	double tmp;
	if (t_0 <= -4e-220) {
		tmp = sqrt(pow((l * h), -1.0)) * d;
	} else if ((t_0 <= 2e-161) || !(t_0 <= 5e+135)) {
		tmp = fabs((d / sqrt((l * h))));
	} else {
		tmp = sqrt((((d / l) / h) * d));
	}
	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 / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m_m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
    if (t_0 <= (-4d-220)) then
        tmp = sqrt(((l * h) ** (-1.0d0))) * d
    else if ((t_0 <= 2d-161) .or. (.not. (t_0 <= 5d+135))) then
        tmp = abs((d / sqrt((l * h))))
    else
        tmp = sqrt((((d / l) / h) * d))
    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.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
	double tmp;
	if (t_0 <= -4e-220) {
		tmp = Math.sqrt(Math.pow((l * h), -1.0)) * d;
	} else if ((t_0 <= 2e-161) || !(t_0 <= 5e+135)) {
		tmp = Math.abs((d / Math.sqrt((l * h))));
	} else {
		tmp = Math.sqrt((((d / l) / h) * d));
	}
	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.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))
	tmp = 0
	if t_0 <= -4e-220:
		tmp = math.sqrt(math.pow((l * h), -1.0)) * d
	elif (t_0 <= 2e-161) or not (t_0 <= 5e+135):
		tmp = math.fabs((d / math.sqrt((l * h))))
	else:
		tmp = math.sqrt((((d / l) / h) * d))
	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((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
	tmp = 0.0
	if (t_0 <= -4e-220)
		tmp = Float64(sqrt((Float64(l * h) ^ -1.0)) * d);
	elseif ((t_0 <= 2e-161) || !(t_0 <= 5e+135))
		tmp = abs(Float64(d / sqrt(Float64(l * h))));
	else
		tmp = sqrt(Float64(Float64(Float64(d / l) / h) * d));
	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 / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M_m * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
	tmp = 0.0;
	if (t_0 <= -4e-220)
		tmp = sqrt(((l * h) ^ -1.0)) * d;
	elseif ((t_0 <= 2e-161) || ~((t_0 <= 5e+135)))
		tmp = abs((d / sqrt((l * h))));
	else
		tmp = sqrt((((d / l) / h) * d));
	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[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e-220], N[(N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision], If[Or[LessEqual[t$95$0, 2e-161], N[Not[LessEqual[t$95$0, 5e+135]], $MachinePrecision]], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Sqrt[N[(N[(N[(d / l), $MachinePrecision] / h), $MachinePrecision] * d), $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 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-220}:\\
\;\;\;\;\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\\

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-161} \lor \neg \left(t\_0 \leq 5 \cdot 10^{+135}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{\ell}}{h} \cdot d}\\


\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)))) < -3.99999999999999997e-220

    1. Initial program 83.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.3

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

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

    if -3.99999999999999997e-220 < (*.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.00000000000000006e-161 or 5.00000000000000029e135 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

    1. Initial program 39.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-*.f6432.2

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

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

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

      if 2.00000000000000006e-161 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.00000000000000029e135

      1. Initial program 99.5%

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

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

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

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

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

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

          \[\leadsto \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \cdot d \]
        6. lower-*.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 rewrites97.5%

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

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

      Alternative 3: 68.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({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_1 := \sqrt{\frac{d}{h}}\\ t_2 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{-15}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(\frac{\frac{D \cdot D}{d}}{d} \cdot h\right) \cdot -0.125, \frac{M\_m \cdot M\_m}{\ell}, 1\right) \cdot t\_1\right) \cdot t\_2\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+270}:\\ \;\;\;\;t\_2 \cdot t\_1\\ \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
       (let* ((t_0
               (*
                (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                (-
                 1.0
                 (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l)))))
              (t_1 (sqrt (/ d h)))
              (t_2 (sqrt (/ d l))))
         (if (<= t_0 -5e-15)
           (*
            (* (fma (* (* (/ (/ (* D D) d) d) h) -0.125) (/ (* M_m M_m) l) 1.0) t_1)
            t_2)
           (if (<= t_0 5e+270) (* t_2 t_1) (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 t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
      	double t_1 = sqrt((d / h));
      	double t_2 = sqrt((d / l));
      	double tmp;
      	if (t_0 <= -5e-15) {
      		tmp = (fma((((((D * D) / d) / d) * h) * -0.125), ((M_m * M_m) / l), 1.0) * t_1) * t_2;
      	} else if (t_0 <= 5e+270) {
      		tmp = t_2 * t_1;
      	} else {
      		tmp = fabs((d / 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)
      	t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
      	t_1 = sqrt(Float64(d / h))
      	t_2 = sqrt(Float64(d / l))
      	tmp = 0.0
      	if (t_0 <= -5e-15)
      		tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(Float64(D * D) / d) / d) * h) * -0.125), Float64(Float64(M_m * M_m) / l), 1.0) * t_1) * t_2);
      	elseif (t_0 <= 5e+270)
      		tmp = Float64(t_2 * t_1);
      	else
      		tmp = abs(Float64(d / sqrt(Float64(l * h))));
      	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[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $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]}, If[LessEqual[t$95$0, -5e-15], N[(N[(N[(N[(N[(N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, 5e+270], N[(t$95$2 * t$95$1), $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}
      t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
      t_1 := \sqrt{\frac{d}{h}}\\
      t_2 := \sqrt{\frac{d}{\ell}}\\
      \mathbf{if}\;t\_0 \leq -5 \cdot 10^{-15}:\\
      \;\;\;\;\left(\mathsf{fma}\left(\left(\frac{\frac{D \cdot D}{d}}{d} \cdot h\right) \cdot -0.125, \frac{M\_m \cdot M\_m}{\ell}, 1\right) \cdot t\_1\right) \cdot t\_2\\
      
      \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+270}:\\
      \;\;\;\;t\_2 \cdot t\_1\\
      
      \mathbf{else}:\\
      \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\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)))) < -4.99999999999999999e-15

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -4.99999999999999999e-15 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.99999999999999976e270

        1. Initial program 89.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-*.f6441.9

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

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

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

          if 4.99999999999999976e270 < (*.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 22.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-*.f6426.5

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

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{-15}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(\frac{\frac{D \cdot D}{d}}{d} \cdot h\right) \cdot -0.125, \frac{M \cdot M}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\ \;\;\;\;\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: 68.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({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_1 := \sqrt{\frac{d}{h}}\\ t_2 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{-15}:\\ \;\;\;\;\left(\left(\left(\left(\frac{\frac{D \cdot D}{d}}{d} \cdot h\right) \cdot -0.125\right) \cdot \frac{M\_m \cdot M\_m}{\ell}\right) \cdot t\_1\right) \cdot t\_2\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+270}:\\ \;\;\;\;t\_2 \cdot t\_1\\ \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
           (let* ((t_0
                   (*
                    (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                    (-
                     1.0
                     (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l)))))
                  (t_1 (sqrt (/ d h)))
                  (t_2 (sqrt (/ d l))))
             (if (<= t_0 -5e-15)
               (* (* (* (* (* (/ (/ (* D D) d) d) h) -0.125) (/ (* M_m M_m) l)) t_1) t_2)
               (if (<= t_0 5e+270) (* t_2 t_1) (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 t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
          	double t_1 = sqrt((d / h));
          	double t_2 = sqrt((d / l));
          	double tmp;
          	if (t_0 <= -5e-15) {
          		tmp = (((((((D * D) / d) / d) * h) * -0.125) * ((M_m * M_m) / l)) * t_1) * t_2;
          	} else if (t_0 <= 5e+270) {
          		tmp = t_2 * t_1;
          	} 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) :: t_0
              real(8) :: t_1
              real(8) :: t_2
              real(8) :: tmp
              t_0 = (((d / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m_m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
              t_1 = sqrt((d / h))
              t_2 = sqrt((d / l))
              if (t_0 <= (-5d-15)) then
                  tmp = (((((((d_1 * d_1) / d) / d) * h) * (-0.125d0)) * ((m_m * m_m) / l)) * t_1) * t_2
              else if (t_0 <= 5d+270) then
                  tmp = t_2 * t_1
              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 t_0 = (Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
          	double t_1 = Math.sqrt((d / h));
          	double t_2 = Math.sqrt((d / l));
          	double tmp;
          	if (t_0 <= -5e-15) {
          		tmp = (((((((D * D) / d) / d) * h) * -0.125) * ((M_m * M_m) / l)) * t_1) * t_2;
          	} else if (t_0 <= 5e+270) {
          		tmp = t_2 * t_1;
          	} 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):
          	t_0 = (math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))
          	t_1 = math.sqrt((d / h))
          	t_2 = math.sqrt((d / l))
          	tmp = 0
          	if t_0 <= -5e-15:
          		tmp = (((((((D * D) / d) / d) * h) * -0.125) * ((M_m * M_m) / l)) * t_1) * t_2
          	elif t_0 <= 5e+270:
          		tmp = t_2 * t_1
          	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)
          	t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
          	t_1 = sqrt(Float64(d / h))
          	t_2 = sqrt(Float64(d / l))
          	tmp = 0.0
          	if (t_0 <= -5e-15)
          		tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(D * D) / d) / d) * h) * -0.125) * Float64(Float64(M_m * M_m) / l)) * t_1) * t_2);
          	elseif (t_0 <= 5e+270)
          		tmp = Float64(t_2 * t_1);
          	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)
          	t_0 = (((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M_m * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
          	t_1 = sqrt((d / h));
          	t_2 = sqrt((d / l));
          	tmp = 0.0;
          	if (t_0 <= -5e-15)
          		tmp = (((((((D * D) / d) / d) * h) * -0.125) * ((M_m * M_m) / l)) * t_1) * t_2;
          	elseif (t_0 <= 5e+270)
          		tmp = t_2 * t_1;
          	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_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $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]}, If[LessEqual[t$95$0, -5e-15], N[(N[(N[(N[(N[(N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, 5e+270], N[(t$95$2 * t$95$1), $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}
          t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
          t_1 := \sqrt{\frac{d}{h}}\\
          t_2 := \sqrt{\frac{d}{\ell}}\\
          \mathbf{if}\;t\_0 \leq -5 \cdot 10^{-15}:\\
          \;\;\;\;\left(\left(\left(\left(\frac{\frac{D \cdot D}{d}}{d} \cdot h\right) \cdot -0.125\right) \cdot \frac{M\_m \cdot M\_m}{\ell}\right) \cdot t\_1\right) \cdot t\_2\\
          
          \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+270}:\\
          \;\;\;\;t\_2 \cdot t\_1\\
          
          \mathbf{else}:\\
          \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\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)))) < -4.99999999999999999e-15

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if -4.99999999999999999e-15 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.99999999999999976e270

            1. Initial program 89.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-*.f6441.9

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

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

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

              if 4.99999999999999976e270 < (*.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 22.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-*.f6426.5

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

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{-15}:\\ \;\;\;\;\left(\left(\left(\left(\frac{\frac{D \cdot D}{d}}{d} \cdot h\right) \cdot -0.125\right) \cdot \frac{M \cdot M}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\ \;\;\;\;\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: 51.2% 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({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+270}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\ \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
               (let* ((t_0
                       (*
                        (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                        (-
                         1.0
                         (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))))
                 (if (<= t_0 0.0)
                   (* (sqrt (pow (* l h) -1.0)) d)
                   (if (<= t_0 5e+270)
                     (* (sqrt (/ d l)) (sqrt (/ d h)))
                     (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 t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
              	double tmp;
              	if (t_0 <= 0.0) {
              		tmp = sqrt(pow((l * h), -1.0)) * d;
              	} else if (t_0 <= 5e+270) {
              		tmp = sqrt((d / l)) * sqrt((d / h));
              	} 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) :: t_0
                  real(8) :: tmp
                  t_0 = (((d / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m_m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
                  if (t_0 <= 0.0d0) then
                      tmp = sqrt(((l * h) ** (-1.0d0))) * d
                  else if (t_0 <= 5d+270) then
                      tmp = sqrt((d / l)) * sqrt((d / h))
                  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 t_0 = (Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
              	double tmp;
              	if (t_0 <= 0.0) {
              		tmp = Math.sqrt(Math.pow((l * h), -1.0)) * d;
              	} else if (t_0 <= 5e+270) {
              		tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
              	} 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):
              	t_0 = (math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))
              	tmp = 0
              	if t_0 <= 0.0:
              		tmp = math.sqrt(math.pow((l * h), -1.0)) * d
              	elif t_0 <= 5e+270:
              		tmp = math.sqrt((d / l)) * math.sqrt((d / h))
              	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)
              	t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
              	tmp = 0.0
              	if (t_0 <= 0.0)
              		tmp = Float64(sqrt((Float64(l * h) ^ -1.0)) * d);
              	elseif (t_0 <= 5e+270)
              		tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)));
              	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)
              	t_0 = (((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M_m * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
              	tmp = 0.0;
              	if (t_0 <= 0.0)
              		tmp = sqrt(((l * h) ^ -1.0)) * d;
              	elseif (t_0 <= 5e+270)
              		tmp = sqrt((d / l)) * sqrt((d / h));
              	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_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision], If[LessEqual[t$95$0, 5e+270], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $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}
              t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
              \mathbf{if}\;t\_0 \leq 0:\\
              \;\;\;\;\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\\
              
              \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+270}:\\
              \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
              
              \mathbf{else}:\\
              \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\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 78.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-*.f6418.2

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

                  \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot 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)))) < 4.99999999999999976e270

                1. Initial program 98.9%

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

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

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

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

                  if 4.99999999999999976e270 < (*.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 22.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-*.f6426.5

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

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

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

                    \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 0:\\ \;\;\;\;\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\ \;\;\;\;\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: 76.7% 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 := M\_m \cdot \frac{D}{d}\\ \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{t\_0}{\ell}, \frac{t\_0 \cdot -0.125}{{h}^{-1}}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \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
                   (let* ((t_0 (* M_m (/ D d))))
                     (if (<=
                          (*
                           (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                           (-
                            1.0
                            (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
                          5e+270)
                       (*
                        (* (fma (/ t_0 l) (/ (* t_0 -0.125) (pow h -1.0)) 1.0) (sqrt (/ d h)))
                        (sqrt (/ 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 t_0 = M_m * (D / d);
                  	double tmp;
                  	if (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+270) {
                  		tmp = (fma((t_0 / l), ((t_0 * -0.125) / pow(h, -1.0)), 1.0) * sqrt((d / h))) * sqrt((d / l));
                  	} else {
                  		tmp = fabs((d / 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)
                  	t_0 = Float64(M_m * Float64(D / d))
                  	tmp = 0.0
                  	if (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+270)
                  		tmp = Float64(Float64(fma(Float64(t_0 / l), Float64(Float64(t_0 * -0.125) / (h ^ -1.0)), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l)));
                  	else
                  		tmp = abs(Float64(d / sqrt(Float64(l * h))));
                  	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 / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+270], N[(N[(N[(N[(t$95$0 / l), $MachinePrecision] * N[(N[(t$95$0 * -0.125), $MachinePrecision] / N[Power[h, -1.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(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}
                  t_0 := M\_m \cdot \frac{D}{d}\\
                  \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\
                  \;\;\;\;\left(\mathsf{fma}\left(\frac{t\_0}{\ell}, \frac{t\_0 \cdot -0.125}{{h}^{-1}}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
                  
                  \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)))) < 4.99999999999999976e270

                    1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    if 4.99999999999999976e270 < (*.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 22.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-*.f6426.5

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

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

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

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

                    Alternative 7: 74.7% 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 := \frac{D}{d} \cdot M\_m\\ t_1 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\ \;\;\;\;\left(\frac{\frac{t\_0}{\ell} \cdot \left(0.125 \cdot t\_0\right)}{\frac{-1}{h}} \cdot t\_1 + t\_1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \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
                     (let* ((t_0 (* (/ D d) M_m)) (t_1 (sqrt (/ d h))))
                       (if (<=
                            (*
                             (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                             (-
                              1.0
                              (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
                            5e+270)
                         (*
                          (+ (* (/ (* (/ t_0 l) (* 0.125 t_0)) (/ -1.0 h)) t_1) t_1)
                          (sqrt (/ 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 t_0 = (D / d) * M_m;
                    	double t_1 = sqrt((d / h));
                    	double tmp;
                    	if (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+270) {
                    		tmp = (((((t_0 / l) * (0.125 * t_0)) / (-1.0 / h)) * t_1) + t_1) * sqrt((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) :: t_0
                        real(8) :: t_1
                        real(8) :: tmp
                        t_0 = (d_1 / d) * m_m
                        t_1 = sqrt((d / h))
                        if (((((d / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m_m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= 5d+270) then
                            tmp = (((((t_0 / l) * (0.125d0 * t_0)) / ((-1.0d0) / h)) * t_1) + t_1) * sqrt((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 t_0 = (D / d) * M_m;
                    	double t_1 = Math.sqrt((d / h));
                    	double tmp;
                    	if (((Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+270) {
                    		tmp = (((((t_0 / l) * (0.125 * t_0)) / (-1.0 / h)) * t_1) + t_1) * Math.sqrt((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):
                    	t_0 = (D / d) * M_m
                    	t_1 = math.sqrt((d / h))
                    	tmp = 0
                    	if ((math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+270:
                    		tmp = (((((t_0 / l) * (0.125 * t_0)) / (-1.0 / h)) * t_1) + t_1) * math.sqrt((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)
                    	t_0 = Float64(Float64(D / d) * M_m)
                    	t_1 = sqrt(Float64(d / h))
                    	tmp = 0.0
                    	if (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+270)
                    		tmp = Float64(Float64(Float64(Float64(Float64(Float64(t_0 / l) * Float64(0.125 * t_0)) / Float64(-1.0 / h)) * t_1) + t_1) * sqrt(Float64(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)
                    	t_0 = (D / d) * M_m;
                    	t_1 = sqrt((d / h));
                    	tmp = 0.0;
                    	if (((((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M_m * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= 5e+270)
                    		tmp = (((((t_0 / l) * (0.125 * t_0)) / (-1.0 / h)) * t_1) + t_1) * sqrt((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_] := Block[{t$95$0 = N[(N[(D / d), $MachinePrecision] * M$95$m), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+270], N[(N[(N[(N[(N[(N[(t$95$0 / l), $MachinePrecision] * N[(0.125 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(-1.0 / h), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] + t$95$1), $MachinePrecision] * N[Sqrt[N[(d / l), $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}
                    t_0 := \frac{D}{d} \cdot M\_m\\
                    t_1 := \sqrt{\frac{d}{h}}\\
                    \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\
                    \;\;\;\;\left(\frac{\frac{t\_0}{\ell} \cdot \left(0.125 \cdot t\_0\right)}{\frac{-1}{h}} \cdot t\_1 + t\_1\right) \cdot \sqrt{\frac{d}{\ell}}\\
                    
                    \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)))) < 4.99999999999999976e270

                      1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      if 4.99999999999999976e270 < (*.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 22.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-*.f6426.5

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

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

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

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

                      Alternative 8: 76.6% 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 := \left(0.5 \cdot \frac{D}{d}\right) \cdot M\_m\\ \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot t\_0, t\_0, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \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
                       (let* ((t_0 (* (* 0.5 (/ D d)) M_m)))
                         (if (<=
                              (*
                               (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                               (-
                                1.0
                                (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
                              5e+270)
                           (*
                            (* (fma (* (* (/ h l) -0.5) t_0) t_0 1.0) (sqrt (/ d h)))
                            (sqrt (/ 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 t_0 = (0.5 * (D / d)) * M_m;
                      	double tmp;
                      	if (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+270) {
                      		tmp = (fma((((h / l) * -0.5) * t_0), t_0, 1.0) * sqrt((d / h))) * sqrt((d / l));
                      	} else {
                      		tmp = fabs((d / 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)
                      	t_0 = Float64(Float64(0.5 * Float64(D / d)) * M_m)
                      	tmp = 0.0
                      	if (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+270)
                      		tmp = Float64(Float64(fma(Float64(Float64(Float64(h / l) * -0.5) * t_0), t_0, 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l)));
                      	else
                      		tmp = abs(Float64(d / sqrt(Float64(l * h))));
                      	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[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+270], N[(N[(N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(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}
                      t_0 := \left(0.5 \cdot \frac{D}{d}\right) \cdot M\_m\\
                      \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\
                      \;\;\;\;\left(\mathsf{fma}\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot t\_0, t\_0, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
                      
                      \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)))) < 4.99999999999999976e270

                        1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        if 4.99999999999999976e270 < (*.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 22.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-*.f6426.5

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

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

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

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

                        Alternative 9: 46.1% 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} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-220}:\\ \;\;\;\;\sqrt{{\left(\ell \cdot h\right)}^{-1}} \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 (<=
                              (*
                               (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                               (-
                                1.0
                                (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
                              -4e-220)
                           (* (sqrt (pow (* l h) -1.0)) 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 (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-220) {
                        		tmp = sqrt(pow((l * h), -1.0)) * 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 (((((d / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m_m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-4d-220)) then
                                tmp = sqrt(((l * h) ** (-1.0d0))) * 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 (((Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-220) {
                        		tmp = Math.sqrt(Math.pow((l * h), -1.0)) * 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 ((math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-220:
                        		tmp = math.sqrt(math.pow((l * h), -1.0)) * 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((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -4e-220)
                        		tmp = Float64(sqrt((Float64(l * h) ^ -1.0)) * 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 (((((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M_m * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -4e-220)
                        		tmp = sqrt(((l * h) ^ -1.0)) * 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[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -4e-220], N[(N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $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({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-220}:\\
                        \;\;\;\;\sqrt{{\left(\ell \cdot h\right)}^{-1}} \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)))) < -3.99999999999999997e-220

                          1. Initial program 83.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.3

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

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

                          if -3.99999999999999997e-220 < (*.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 59.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-*.f6435.8

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

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

                              \[\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({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-220}:\\ \;\;\;\;\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                          9. Add Preprocessing

                          Alternative 10: 74.4% 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} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{M\_m \cdot \frac{D}{d}}{\ell}, \frac{D}{d} \cdot \left(M\_m \cdot \left(h \cdot -0.125\right)\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \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 (<=
                                (*
                                 (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                                 (-
                                  1.0
                                  (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
                                5e+270)
                             (*
                              (*
                               (fma (/ (* M_m (/ D d)) l) (* (/ D d) (* M_m (* h -0.125))) 1.0)
                               (sqrt (/ d h)))
                              (sqrt (/ 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 (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+270) {
                          		tmp = (fma(((M_m * (D / d)) / l), ((D / d) * (M_m * (h * -0.125))), 1.0) * sqrt((d / h))) * sqrt((d / l));
                          	} else {
                          		tmp = fabs((d / 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((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+270)
                          		tmp = Float64(Float64(fma(Float64(Float64(M_m * Float64(D / d)) / l), Float64(Float64(D / d) * Float64(M_m * Float64(h * -0.125))), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l)));
                          	else
                          		tmp = abs(Float64(d / sqrt(Float64(l * h))));
                          	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[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+270], N[(N[(N[(N[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(M$95$m * N[(h * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(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({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\
                          \;\;\;\;\left(\mathsf{fma}\left(\frac{M\_m \cdot \frac{D}{d}}{\ell}, \frac{D}{d} \cdot \left(M\_m \cdot \left(h \cdot -0.125\right)\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
                          
                          \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)))) < 4.99999999999999976e270

                            1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            if 4.99999999999999976e270 < (*.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 22.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-*.f6426.5

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

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

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

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

                            Alternative 11: 74.6% 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} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{M\_m \cdot \frac{D}{d}}{\ell}, M\_m \cdot \left(\frac{D}{d} \cdot \left(h \cdot -0.125\right)\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \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 (<=
                                  (*
                                   (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                                   (-
                                    1.0
                                    (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
                                  5e+270)
                               (*
                                (*
                                 (fma (/ (* M_m (/ D d)) l) (* M_m (* (/ D d) (* h -0.125))) 1.0)
                                 (sqrt (/ d h)))
                                (sqrt (/ 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 (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+270) {
                            		tmp = (fma(((M_m * (D / d)) / l), (M_m * ((D / d) * (h * -0.125))), 1.0) * sqrt((d / h))) * sqrt((d / l));
                            	} else {
                            		tmp = fabs((d / 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((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+270)
                            		tmp = Float64(Float64(fma(Float64(Float64(M_m * Float64(D / d)) / l), Float64(M_m * Float64(Float64(D / d) * Float64(h * -0.125))), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l)));
                            	else
                            		tmp = abs(Float64(d / sqrt(Float64(l * h))));
                            	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[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+270], N[(N[(N[(N[(N[(M$95$m * N[(D / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(M$95$m * N[(N[(D / d), $MachinePrecision] * N[(h * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(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({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\
                            \;\;\;\;\left(\mathsf{fma}\left(\frac{M\_m \cdot \frac{D}{d}}{\ell}, M\_m \cdot \left(\frac{D}{d} \cdot \left(h \cdot -0.125\right)\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
                            
                            \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)))) < 4.99999999999999976e270

                              1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              if 4.99999999999999976e270 < (*.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 22.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-*.f6426.5

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

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

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

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

                              Alternative 12: 74.1% 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} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\ \;\;\;\;\left(\mathsf{fma}\left(M\_m, \frac{\frac{D}{d}}{\ell} \cdot \left(h \cdot \left(-0.125 \cdot \left(\frac{D}{d} \cdot M\_m\right)\right)\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\ \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 (<=
                                    (*
                                     (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                                     (-
                                      1.0
                                      (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
                                    5e+270)
                                 (*
                                  (*
                                   (fma M_m (* (/ (/ D d) l) (* h (* -0.125 (* (/ D d) M_m)))) 1.0)
                                   (sqrt (/ d h)))
                                  (sqrt (/ 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 (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+270) {
                              		tmp = (fma(M_m, (((D / d) / l) * (h * (-0.125 * ((D / d) * M_m)))), 1.0) * sqrt((d / h))) * sqrt((d / l));
                              	} else {
                              		tmp = fabs((d / 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((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+270)
                              		tmp = Float64(Float64(fma(M_m, Float64(Float64(Float64(D / d) / l) * Float64(h * Float64(-0.125 * Float64(Float64(D / d) * M_m)))), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l)));
                              	else
                              		tmp = abs(Float64(d / sqrt(Float64(l * h))));
                              	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[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+270], N[(N[(N[(M$95$m * N[(N[(N[(D / d), $MachinePrecision] / l), $MachinePrecision] * N[(h * N[(-0.125 * N[(N[(D / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(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({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+270}:\\
                              \;\;\;\;\left(\mathsf{fma}\left(M\_m, \frac{\frac{D}{d}}{\ell} \cdot \left(h \cdot \left(-0.125 \cdot \left(\frac{D}{d} \cdot M\_m\right)\right)\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
                              
                              \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)))) < 4.99999999999999976e270

                                1. Initial program 86.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                if 4.99999999999999976e270 < (*.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 22.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-*.f6426.5

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

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

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

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

                                Alternative 13: 45.9% accurate, 0.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{d}{\sqrt{\ell \cdot h}}\\ \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-220}:\\ \;\;\;\;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 (<=
                                        (*
                                         (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                                         (-
                                          1.0
                                          (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
                                        -4e-220)
                                     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 (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-220) {
                                		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 (((((d / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m_m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-4d-220)) 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 (((Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-220) {
                                		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 ((math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-220:
                                		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((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -4e-220)
                                		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 (((((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M_m * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -4e-220)
                                		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[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -4e-220], 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({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-220}:\\
                                \;\;\;\;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)))) < -3.99999999999999997e-220

                                  1. Initial program 83.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.3

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

                                    \[\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 -3.99999999999999997e-220 < (*.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 59.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-*.f6435.8

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

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

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

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

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

                                      1. Initial program 69.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          \[\leadsto \left(\frac{h \cdot \left(\frac{-1}{8} \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}\right)}{\ell} \cdot \sqrt{\frac{d}{h}} + \sqrt{\frac{d}{h}}\right) \cdot \frac{\sqrt{-d}}{\color{blue}{\sqrt{\mathsf{neg}\left(\ell\right)}}} \]
                                        13. lower-neg.f6479.0

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

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

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

                                      1. Initial program 52.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 rewrites82.2%

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

                                      if -3.999999999999988e-310 < h

                                      1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      1. Initial program 66.4%

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

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

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

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

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

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

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

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

                                      if -3.999999999999988e-310 < h

                                      1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    Alternative 16: 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 68.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-*.f6427.4

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

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

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

                                      Reproduce

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