Henrywood and Agarwal, Equation (12)

Percentage Accurate: 65.6% → 79.8%
Time: 15.8s
Alternatives: 19
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 19 alternatives:

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

Initial Program: 65.6% accurate, 1.0× speedup?

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

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

Alternative 1: 79.8% accurate, 0.3× speedup?

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

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\

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


\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.9999999999999997e250

    1. Initial program 88.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 47.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-*.f6450.3

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

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

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

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

      1. Initial program 0.0%

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

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

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

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

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

            \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, \frac{-0.125 \cdot {\left(M \cdot D\right)}^{2}}{d}, d\right)}{h} \]
          2. Step-by-step derivation
            1. Applied rewrites67.0%

              \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{{\left(D \cdot M\right)}^{2} \cdot -0.125}{d}, \frac{h}{\ell}, d\right)}{h} \cdot \sqrt{\frac{h}{\ell}}} \]
          3. Recombined 3 regimes into one program.
          4. Final simplification88.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 4 \cdot 10^{+250}:\\ \;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{d} \cdot M\right) \cdot 0.5}{\ell} \cdot \left(\left(\frac{M}{d} \cdot \left(0.25 \cdot D\right)\right) \cdot h\right)\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{{\left(D \cdot M\right)}^{2} \cdot -0.125}{d}, \frac{h}{\ell}, d\right)}{h} \cdot \sqrt{\frac{h}{\ell}}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 2: 73.6% accurate, 0.1× speedup?

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

            1. Initial program 86.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\color{blue}{\frac{d}{h}}}\right) \cdot \left(\left(\left(h \cdot \left(M \cdot \frac{M}{\ell}\right)\right) \cdot \frac{-1}{8}\right) \cdot \frac{\frac{D \cdot D}{d}}{d}\right) \]
              17. lower-sqrt.f6483.4

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

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

            if -9.9999999999999992e249 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -9.9999999999999991e130

            1. Initial program 98.8%

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

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

                \[\leadsto \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{\frac{d}{\ell}}{h} \cdot d} \]
              2. lift-pow.f64N/A

                \[\leadsto \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{\frac{d}{\ell}}{h} \cdot d} \]
              3. metadata-evalN/A

                \[\leadsto \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{\frac{d}{\ell}}{h} \cdot d} \]
              4. pow-powN/A

                \[\leadsto \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{\frac{d}{\ell}}{h} \cdot d} \]
              5. inv-powN/A

                \[\leadsto \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{\frac{d}{\ell}}{h} \cdot d} \]
              6. lift-*.f64N/A

                \[\leadsto \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{\frac{d}{\ell}}{h} \cdot d} \]
              7. lift-/.f64N/A

                \[\leadsto \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{\frac{d}{\ell}}{h} \cdot d} \]
              8. lift-/.f64N/A

                \[\leadsto \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{\frac{d}{\ell}}{h} \cdot d} \]
              9. frac-timesN/A

                \[\leadsto \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{\frac{d}{\ell}}{h} \cdot d} \]
              10. *-commutativeN/A

                \[\leadsto \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{\frac{d}{\ell}}{h} \cdot d} \]
              11. clear-numN/A

                \[\leadsto \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{\frac{d}{\ell}}{h} \cdot d} \]
              12. unpow2N/A

                \[\leadsto \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{\frac{d}{\ell}}{h} \cdot d} \]
              13. associate-*r*N/A

                \[\leadsto \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{\frac{d}{\ell}}{h} \cdot d} \]
              14. lower-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

            if -9.9999999999999991e130 < (*.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.50000000000000022e-112

            1. Initial program 67.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 h around 0

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

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

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

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

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

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

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

                  if 2.50000000000000022e-112 < (*.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.9999999999999997e250

                  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-*.f6436.8

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

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

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

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

                    1. Initial program 47.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-*.f6450.3

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

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

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

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

                      1. Initial program 0.0%

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

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

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

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

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

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

                            \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d} + d \cdot \ell}{\ell}}{h} \]
                          3. Step-by-step derivation
                            1. Applied rewrites39.5%

                              \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot \frac{\mathsf{fma}\left(-0.125 \cdot \left(D \cdot D\right), h \cdot \frac{M \cdot M}{d}, \ell \cdot d\right)}{\ell}}{h} \]
                          4. Recombined 6 regimes into one program.
                          5. Final simplification81.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 -1 \cdot 10^{+250}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(\left(\left(h \cdot \left(M \cdot \frac{M}{\ell}\right)\right) \cdot -0.125\right) \cdot \frac{\frac{D \cdot D}{d}}{d}\right)\\ \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 -1 \cdot 10^{+131}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(\left(\frac{h}{\ell} \cdot -0.25\right) \cdot M\right) \cdot \frac{D}{d}\right) \cdot \left(M \cdot 0.5\right), \frac{D}{d}, 1\right) \cdot \sqrt{\frac{\frac{d}{\ell}}{h} \cdot d}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 2.5 \cdot 10^{-112}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, \left(-0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d}, d\right)}{h}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 4 \cdot 10^{+250}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \frac{\mathsf{fma}\left(-0.125 \cdot \left(D \cdot D\right), h \cdot \frac{M \cdot M}{d}, \ell \cdot d\right)}{\ell}}{h}\\ \end{array} \]
                          6. Add Preprocessing

                          Alternative 3: 73.1% accurate, 0.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            1. Initial program 73.8%

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

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

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

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

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

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

                                if 2.50000000000000022e-112 < (*.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.9999999999999997e250

                                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-*.f6436.8

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

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

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

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

                                  1. Initial program 47.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-*.f6450.3

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

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

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

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

                                    1. Initial program 0.0%

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

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

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

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

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

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

                                          \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d} + d \cdot \ell}{\ell}}{h} \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites39.5%

                                            \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot \frac{\mathsf{fma}\left(-0.125 \cdot \left(D \cdot D\right), h \cdot \frac{M \cdot M}{d}, \ell \cdot d\right)}{\ell}}{h} \]
                                        4. Recombined 5 regimes into one program.
                                        5. Final simplification80.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 -\infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(\left(\left(h \cdot \left(M \cdot \frac{M}{\ell}\right)\right) \cdot -0.125\right) \cdot \frac{\frac{D \cdot D}{d}}{d}\right)\\ \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.5 \cdot 10^{-112}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(\left(-0.125 \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot \frac{D}{d}, \frac{h}{\ell} \cdot \sqrt{\frac{h}{\ell}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 4 \cdot 10^{+250}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \frac{\mathsf{fma}\left(-0.125 \cdot \left(D \cdot D\right), h \cdot \frac{M \cdot M}{d}, \ell \cdot d\right)}{\ell}}{h}\\ \end{array} \]
                                        6. Add Preprocessing

                                        Alternative 4: 81.1% accurate, 0.2× speedup?

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

                                          1. Initial program 61.5%

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

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

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

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

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

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

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

                                                if 2.50000000000000022e-112 < (*.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.9999999999999997e250

                                                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-*.f6436.8

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

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

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

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

                                                  1. Initial program 47.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-*.f6450.3

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

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

                                                      \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                  7. Recombined 3 regimes into one program.
                                                  8. Final simplification87.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 2.5 \cdot 10^{-112}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{{\left(D \cdot M\right)}^{2} \cdot -0.125}{d}, \frac{h}{\ell}, d\right)}{h} \cdot \sqrt{\frac{h}{\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 4 \cdot 10^{+250}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{{\left(D \cdot M\right)}^{2} \cdot -0.125}{d}, \frac{h}{\ell}, d\right)}{h} \cdot \sqrt{\frac{h}{\ell}}\\ \end{array} \]
                                                  9. Add Preprocessing

                                                  Alternative 5: 72.4% accurate, 0.2× speedup?

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

                                                    1. Initial program 82.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 h around 0

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

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

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

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

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

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

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

                                                          if 2.50000000000000022e-112 < (*.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.9999999999999997e250

                                                          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-*.f6436.8

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

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

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

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

                                                            1. Initial program 47.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-*.f6450.3

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

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

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

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

                                                              1. Initial program 0.0%

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

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

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

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

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

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

                                                                    \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d} + d \cdot \ell}{\ell}}{h} \]
                                                                  3. Step-by-step derivation
                                                                    1. Applied rewrites39.5%

                                                                      \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot \frac{\mathsf{fma}\left(-0.125 \cdot \left(D \cdot D\right), h \cdot \frac{M \cdot M}{d}, \ell \cdot d\right)}{\ell}}{h} \]
                                                                  4. Recombined 4 regimes into one program.
                                                                  5. Final simplification79.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 2.5 \cdot 10^{-112}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, \left(-0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d}, d\right)}{h}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 4 \cdot 10^{+250}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \frac{\mathsf{fma}\left(-0.125 \cdot \left(D \cdot D\right), h \cdot \frac{M \cdot M}{d}, \ell \cdot d\right)}{\ell}}{h}\\ \end{array} \]
                                                                  6. Add Preprocessing

                                                                  Alternative 6: 72.2% accurate, 0.2× speedup?

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

                                                                    1. Initial program 61.5%

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

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

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

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

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

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

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

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

                                                                          if 2.50000000000000022e-112 < (*.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.9999999999999997e250

                                                                          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-*.f6436.8

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

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

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

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

                                                                            1. Initial program 47.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-*.f6450.3

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

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

                                                                                \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                            7. Recombined 3 regimes into one program.
                                                                            8. Final simplification79.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 2.5 \cdot 10^{-112}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, \left(-0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d}, d\right)}{h}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 4 \cdot 10^{+250}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, \left(-0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d}, d\right)}{h}\\ \end{array} \]
                                                                            9. Add Preprocessing

                                                                            Alternative 7: 70.7% accurate, 0.2× speedup?

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

                                                                              1. Initial program 62.1%

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

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

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

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

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

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

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

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

                                                                                    if -4.99999999999999989e-138 < (*.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.9999999999999997e250

                                                                                    1. Initial program 88.9%

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

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

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

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

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

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

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

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

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

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

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

                                                                                      1. Initial program 47.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-*.f6450.3

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

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

                                                                                          \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                                      7. Recombined 3 regimes into one program.
                                                                                      8. Final simplification76.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^{-138}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \left(\left(\left(D \cdot D\right) \cdot -0.125\right) \cdot \left(\frac{M \cdot M}{\ell} \cdot \frac{h}{d}\right)\right)}{h}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 4 \cdot 10^{+250}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \left(\left(\left(D \cdot D\right) \cdot -0.125\right) \cdot \left(\frac{M \cdot M}{\ell} \cdot \frac{h}{d}\right)\right)}{h}\\ \end{array} \]
                                                                                      9. Add Preprocessing

                                                                                      Alternative 8: 79.4% accurate, 0.3× speedup?

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

                                                                                        1. Initial program 88.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 rewrites61.4%

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

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

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

                                                                                        1. Initial program 47.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-*.f6450.3

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

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

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

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

                                                                                          1. Initial program 0.0%

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

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

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

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

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

                                                                                                \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, \frac{-0.125 \cdot {\left(M \cdot D\right)}^{2}}{d}, d\right)}{h} \]
                                                                                              2. Step-by-step derivation
                                                                                                1. Applied rewrites67.0%

                                                                                                  \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{{\left(D \cdot M\right)}^{2} \cdot -0.125}{d}, \frac{h}{\ell}, d\right)}{h} \cdot \sqrt{\frac{h}{\ell}}} \]
                                                                                              3. Recombined 3 regimes into one program.
                                                                                              4. Final simplification86.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^{+250}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{D}{d} \cdot M\right)}^{2} \cdot 0.25, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{{\left(D \cdot M\right)}^{2} \cdot -0.125}{d}, \frac{h}{\ell}, d\right)}{h} \cdot \sqrt{\frac{h}{\ell}}\\ \end{array} \]
                                                                                              5. Add Preprocessing

                                                                                              Alternative 9: 52.3% accurate, 0.3× speedup?

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

                                                                                                1. Initial program 87.9%

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

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

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

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

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

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

                                                                                                  if -4.99999999999999989e-138 < (*.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.9999999999999997e250

                                                                                                  1. Initial program 88.9%

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

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

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

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

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

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

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

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

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

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

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

                                                                                                    1. Initial program 25.2%

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

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

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

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

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

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

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

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

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

                                                                                                        \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                                                    7. Recombined 3 regimes into one program.
                                                                                                    8. Final simplification52.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^{-138}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 4 \cdot 10^{+250}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                                                                                                    9. Add Preprocessing

                                                                                                    Alternative 10: 52.3% accurate, 0.3× speedup?

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

                                                                                                      1. Initial program 87.9%

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

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

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

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

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

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

                                                                                                        if -4.99999999999999989e-138 < (*.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.9999999999999997e250

                                                                                                        1. Initial program 88.9%

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

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

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

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

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

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

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

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

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

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

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

                                                                                                          1. Initial program 25.2%

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

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

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

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

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

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

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

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

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

                                                                                                              \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                                                          7. Recombined 3 regimes into one program.
                                                                                                          8. Final simplification52.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^{-138}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 4 \cdot 10^{+250}:\\ \;\;\;\;\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 11: 49.2% accurate, 0.3× speedup?

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

                                                                                                            1. Initial program 87.9%

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

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

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

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

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

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

                                                                                                              if -4.99999999999999989e-138 < (*.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.9999999999999997e250

                                                                                                              1. Initial program 88.9%

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

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

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

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

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

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

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

                                                                                                                1. Initial program 25.2%

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

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

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

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

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

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

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

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

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

                                                                                                                    \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                                                                7. Recombined 3 regimes into one program.
                                                                                                                8. Final simplification50.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^{-138}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 4 \cdot 10^{+250}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                                                                                                                9. Add Preprocessing

                                                                                                                Alternative 12: 45.8% accurate, 0.3× speedup?

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

                                                                                                                  1. Initial program 87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                                  if -4.0000000000000002e-135 < (*.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.9999999999999997e250

                                                                                                                  1. Initial program 89.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 h around 0

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

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

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

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

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

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

                                                                                                                    1. Initial program 25.2%

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

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

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

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

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

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

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

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

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

                                                                                                                        \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                                                                    7. Recombined 3 regimes into one program.
                                                                                                                    8. Final simplification48.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^{-135}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \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 4 \cdot 10^{+250}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                                                                                                                    9. Add Preprocessing

                                                                                                                    Alternative 13: 46.3% accurate, 0.3× speedup?

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

                                                                                                                      1. Initial program 82.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-*.f6416.3

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

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

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

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

                                                                                                                          if 5.0000000000000001e-170 < (*.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)))) < 2e104

                                                                                                                          1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

                                                                                                                            if 2e104 < (*.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 36.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-*.f6428.6

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

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

                                                                                                                                \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                                                                            7. Recombined 3 regimes into one program.
                                                                                                                            8. Final simplification47.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^{-170}:\\ \;\;\;\;{\left(\frac{\sqrt{\ell \cdot h}}{d}\right)}^{-1}\\ \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^{+104}:\\ \;\;\;\;\sqrt{\frac{\frac{d}{\ell}}{h} \cdot d}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                                                                                                                            9. Add Preprocessing

                                                                                                                            Alternative 14: 46.4% accurate, 0.3× speedup?

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

                                                                                                                              1. Initial program 82.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-*.f6416.3

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

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

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

                                                                                                                                if 5.0000000000000001e-170 < (*.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)))) < 2e104

                                                                                                                                1. Initial program 99.5%

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

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

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

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

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

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

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

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

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

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

                                                                                                                                  if 2e104 < (*.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 36.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-*.f6428.6

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

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

                                                                                                                                      \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                                                                                  7. Recombined 3 regimes into one program.
                                                                                                                                  8. Final simplification47.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^{-170}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 2 \cdot 10^{+104}:\\ \;\;\;\;\sqrt{\frac{\frac{d}{\ell}}{h} \cdot d}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                                                                                                                                  9. Add Preprocessing

                                                                                                                                  Alternative 15: 45.0% accurate, 0.5× speedup?

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

                                                                                                                                    1. Initial program 87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                                                    1. Initial program 56.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-*.f6433.4

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

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

                                                                                                                                        \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                                                                                    7. Recombined 2 regimes into one program.
                                                                                                                                    8. Final simplification43.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 -4 \cdot 10^{-135}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                                                                                                                                    9. Add Preprocessing

                                                                                                                                    Alternative 16: 44.7% accurate, 0.6× speedup?

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

                                                                                                                                      1. Initial program 87.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-*.f6410.3

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

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

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

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

                                                                                                                                        1. Initial program 56.2%

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

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

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

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

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

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

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

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

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

                                                                                                                                            \[\leadsto \left|\frac{d}{\sqrt{\ell \cdot h}}\right| \]
                                                                                                                                        7. Recombined 2 regimes into one program.
                                                                                                                                        8. Final simplification43.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^{-138}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\ \end{array} \]
                                                                                                                                        9. Add Preprocessing

                                                                                                                                        Alternative 17: 76.9% accurate, 1.8× speedup?

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

                                                                                                                                          1. Initial program 76.0%

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

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

                                                                                                                                          if -8.99999999999999945e-57 < d < 5.9999999999999999e205

                                                                                                                                          1. Initial program 64.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 h around 0

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

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

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

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

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

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

                                                                                                                                                if 5.9999999999999999e205 < d

                                                                                                                                                1. Initial program 60.9%

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

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

                                                                                                                                              Alternative 18: 44.4% accurate, 3.2× speedup?

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

                                                                                                                                                1. Initial program 66.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                                                                if 1.07999999999999995e-173 < d

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

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

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

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

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

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

                                                                                                                                                  Alternative 19: 26.2% accurate, 15.3× speedup?

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

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

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

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

                                                                                                                                                    Reproduce

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