Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.4% → 80.1%
Time: 15.1s
Alternatives: 24
Speedup: 3.0×

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

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

Initial Program: 66.4% accurate, 1.0× speedup?

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

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

Alternative 1: 80.1% accurate, 1.2× speedup?

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

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

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


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

    1. Initial program 69.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l < 4.19999999999999983e-137

    1. Initial program 66.7%

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

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

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

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

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

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

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

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

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

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

    if 4.19999999999999983e-137 < l

    1. Initial program 65.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 70.3% accurate, 0.3× speedup?

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

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

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

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


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

    1. Initial program 79.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.00000000000000004e64 < (*.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.99999999999999996e-71

    1. Initial program 98.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.99999999999999996e-71 < (*.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.00000000000000027e235

    1. Initial program 92.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-*.f6437.4

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

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

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

      if 5.00000000000000027e235 < (*.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 26.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-*.f6434.6

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

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

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

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

      Alternative 3: 50.1% accurate, 0.3× speedup?

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

        1. Initial program 81.5%

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

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

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

        if -1e-31 < (*.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.00000000000000002e-169 or 9.99999999999999962e134 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

        1. Initial program 39.7%

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

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

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

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

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

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

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

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

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

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

          if 1.00000000000000002e-169 < (*.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.99999999999999962e134

          1. Initial program 99.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-*.f6426.6

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

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

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

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

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

            Alternative 4: 49.3% accurate, 0.3× speedup?

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

              1. Initial program 81.5%

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

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

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

              if -1e-31 < (*.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.00000000000000002e-169 or 9.99999999999999962e134 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

              1. Initial program 39.7%

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

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

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

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

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

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

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

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

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

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

                if 1.00000000000000002e-169 < (*.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.99999999999999962e134

                1. Initial program 99.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-*.f6426.6

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

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

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

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

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

                  Alternative 5: 74.1% accurate, 0.5× speedup?

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

                    1. Initial program 78.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    if 4.99999999999999965e-273 < (*.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.00000000000000027e235

                    1. Initial program 99.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-*.f6430.7

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

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

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

                      if 5.00000000000000027e235 < (*.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 26.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-*.f6434.6

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

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

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

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

                      Alternative 6: 67.5% accurate, 0.5× speedup?

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

                        1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        if -1e-31 < (*.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.00000000000000027e235

                        1. Initial program 92.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-*.f6436.9

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

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

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

                          if 5.00000000000000027e235 < (*.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 26.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-*.f6434.6

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

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

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

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

                          Alternative 7: 66.3% accurate, 0.5× speedup?

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

                            1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            if -1e-31 < (*.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.00000000000000027e235

                            1. Initial program 92.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-*.f6436.9

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

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

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

                              if 5.00000000000000027e235 < (*.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 26.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-*.f6434.6

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

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

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

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

                              Alternative 8: 64.5% accurate, 0.5× speedup?

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

                                1. Initial program 80.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                if -20 < (*.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.00000000000000027e235

                                1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

                                  if 5.00000000000000027e235 < (*.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 26.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-*.f6434.6

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

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

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

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

                                  Alternative 9: 61.5% accurate, 0.5× speedup?

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

                                    1. Initial program 79.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    1. Initial program 98.3%

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

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

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

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

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

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

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

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

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

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

                                      if 5.00000000000000027e235 < (*.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 26.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-*.f6434.6

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

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

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

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

                                      Alternative 10: 60.9% accurate, 0.5× speedup?

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

                                        1. Initial program 79.2%

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

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

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

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

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

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

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

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

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

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

                                        1. Initial program 98.3%

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

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

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

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

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

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

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

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

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

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

                                          if 5.00000000000000027e235 < (*.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 26.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-*.f6434.6

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

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

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

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

                                          Alternative 11: 59.2% accurate, 0.5× speedup?

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

                                            1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                            if -9.99999999999999996e-71 < (*.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.00000000000000027e235

                                            1. Initial program 92.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-*.f6437.4

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

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

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

                                              if 5.00000000000000027e235 < (*.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 26.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-*.f6434.6

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

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

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

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

                                              Alternative 12: 57.3% accurate, 0.5× speedup?

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

                                                1. Initial program 81.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 rewrites55.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                if -5.00000000000000031e-10 < (*.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.00000000000000027e235

                                                1. Initial program 92.7%

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

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

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

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

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

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

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

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

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

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

                                                  if 5.00000000000000027e235 < (*.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 26.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-*.f6434.6

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

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

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

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

                                                  Alternative 13: 51.8% accurate, 0.5× speedup?

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

                                                    1. Initial program 81.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                    if -9.99999999999999996e-71 < (*.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.00000000000000027e235

                                                    1. Initial program 92.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-*.f6437.4

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

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

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

                                                      if 5.00000000000000027e235 < (*.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 26.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-*.f6434.6

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

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

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

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

                                                      Alternative 14: 50.9% accurate, 0.5× speedup?

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

                                                        1. Initial program 79.2%

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

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

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

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

                                                        1. Initial program 98.3%

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

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

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

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

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

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

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

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

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

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

                                                          if 5.00000000000000027e235 < (*.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 26.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-*.f6434.6

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

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

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

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

                                                          Alternative 15: 75.9% accurate, 0.8× speedup?

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

                                                            1. Initial program 86.5%

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

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

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

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

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

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

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

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

                                                            if 5.00000000000000027e235 < (*.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 26.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-*.f6434.6

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

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

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

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

                                                            Alternative 16: 75.6% accurate, 0.8× speedup?

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

                                                              1. Initial program 86.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                              1. Initial program 30.6%

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

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

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

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

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

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

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

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

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

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

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

                                                              Alternative 17: 75.6% accurate, 0.8× speedup?

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

                                                                1. Initial program 86.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                1. Initial program 30.6%

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

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

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

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

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

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

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

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

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

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

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

                                                                Alternative 18: 74.3% accurate, 0.8× speedup?

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

                                                                  1. Initial program 86.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                  if 5.00000000000000027e235 < (*.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 26.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-*.f6434.6

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

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

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

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

                                                                  Alternative 19: 45.8% accurate, 0.9× speedup?

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

                                                                    1. Initial program 81.5%

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

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

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

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

                                                                    1. Initial program 59.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-*.f6435.8

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

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

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

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

                                                                    Alternative 20: 45.7% accurate, 0.9× speedup?

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

                                                                      1. Initial program 81.0%

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

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

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

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

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

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

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

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

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

                                                                      if -5.00000000000000031e-10 < (*.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 60.0%

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

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

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

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

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

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

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

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

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

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

                                                                      Alternative 21: 45.5% accurate, 0.9× speedup?

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

                                                                        1. Initial program 81.0%

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

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

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

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

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

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

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

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

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

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

                                                                          if -5.00000000000000031e-10 < (*.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 60.0%

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

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

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

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

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

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

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

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

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

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

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

                                                                          Alternative 22: 80.1% accurate, 2.2× speedup?

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

                                                                            1. Initial program 69.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                            if -4.999999999999985e-310 < l < 7.59999999999999997e-137

                                                                            1. Initial program 66.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                            if 7.59999999999999997e-137 < l

                                                                            1. Initial program 65.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                          Alternative 23: 79.3% accurate, 3.0× speedup?

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

                                                                            1. Initial program 69.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                            if -3.999999999999988e-310 < d

                                                                            1. Initial program 65.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                          Alternative 24: 26.1% accurate, 15.3× speedup?

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

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

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

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

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

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

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

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

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

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

                                                                              \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                                                                            2. Final simplification25.5%

                                                                              \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
                                                                            3. Add Preprocessing

                                                                            Reproduce

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