Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 80.0% → 88.4%
Time: 8.8s
Alternatives: 15
Speedup: 2.0×

Specification

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

\\
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\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 15 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: 80.0% accurate, 1.0× speedup?

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

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

Alternative 1: 88.4% accurate, 0.7× speedup?

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

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


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

    1. Initial program 88.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 4.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\left(h \cdot \left(\frac{M}{d} \cdot M\right)\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot D\right)}}{\ell} \cdot \left(\frac{D}{d} \cdot \frac{1}{2}\right)} \]
      12. lower-*.f6473.7

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

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

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

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

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

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

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

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

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

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

Alternative 2: 82.8% accurate, 0.7× speedup?

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

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


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

    1. Initial program 98.8%

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

      \[\leadsto w0 \cdot \color{blue}{1} \]
    4. Step-by-step derivation
      1. Applied rewrites98.7%

        \[\leadsto w0 \cdot \color{blue}{1} \]

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

      1. Initial program 47.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto w0 \cdot \sqrt{1 - \frac{0.5 \cdot \left(\left(\left(D \cdot M\right) \cdot M\right) \cdot h\right)}{\ell \cdot d} \cdot \left(\frac{D}{d} \cdot 0.5\right)} \]
      9. Recombined 2 regimes into one program.
      10. Final simplification84.1%

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

      Alternative 3: 72.3% accurate, 0.7× speedup?

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

        1. Initial program 59.7%

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

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

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

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

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

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

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

            \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \color{blue}{\frac{\frac{M \cdot D}{2 \cdot d}}{\frac{2 \cdot d}{M \cdot D}}}} \]
          8. lift-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \frac{\color{blue}{\frac{M \cdot D}{2 \cdot d}}}{\frac{2 \cdot d}{M \cdot D}}} \]
          9. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        1. Initial program 87.0%

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

          \[\leadsto w0 \cdot \color{blue}{1} \]
        4. Step-by-step derivation
          1. Applied rewrites92.6%

            \[\leadsto w0 \cdot \color{blue}{1} \]
        5. Recombined 2 regimes into one program.
        6. Final simplification74.2%

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

        Alternative 4: 82.9% accurate, 0.8× speedup?

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

          1. Initial program 87.9%

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

            \[\leadsto w0 \cdot \color{blue}{1} \]
          4. Step-by-step derivation
            1. Applied rewrites94.8%

              \[\leadsto w0 \cdot \color{blue}{1} \]

            if 4.9999999999999998e-24 < (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))

            1. Initial program 68.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto w0 \cdot \sqrt{1 - \frac{\left(h \cdot \left(\frac{M}{d} \cdot M\right)\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot D\right)}}{\ell} \cdot \left(\frac{D}{d} \cdot \frac{1}{2}\right)} \]
              12. lower-*.f6465.4

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\left(D \cdot 0.5\right) \cdot h\right) \cdot \frac{\left(\left(\frac{M}{d} \cdot M\right) \cdot 0.5\right) \cdot D}{\ell \cdot d}}} \]
          5. Recombined 2 regimes into one program.
          6. Final simplification82.8%

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

          Alternative 5: 78.6% accurate, 0.8× speedup?

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

            1. Initial program 63.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 86.5%

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

                \[\leadsto w0 \cdot \color{blue}{1} \]
              4. Step-by-step derivation
                1. Applied rewrites95.1%

                  \[\leadsto w0 \cdot \color{blue}{1} \]
              5. Recombined 2 regimes into one program.
              6. Final simplification81.4%

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

              Alternative 6: 78.8% accurate, 0.8× speedup?

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

                1. Initial program 57.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  1. Initial program 87.2%

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

                    \[\leadsto w0 \cdot \color{blue}{1} \]
                  4. Step-by-step derivation
                    1. Applied rewrites91.2%

                      \[\leadsto w0 \cdot \color{blue}{1} \]
                  5. Recombined 2 regimes into one program.
                  6. Final simplification80.2%

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

                  Alternative 7: 78.3% accurate, 0.8× speedup?

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

                    1. Initial program 57.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      1. Initial program 87.2%

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

                        \[\leadsto w0 \cdot \color{blue}{1} \]
                      4. Step-by-step derivation
                        1. Applied rewrites91.2%

                          \[\leadsto w0 \cdot \color{blue}{1} \]
                      5. Recombined 2 regimes into one program.
                      6. Final simplification80.9%

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

                      Alternative 8: 77.6% accurate, 0.8× speedup?

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

                        1. Initial program 54.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          1. Initial program 87.5%

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

                            \[\leadsto w0 \cdot \color{blue}{1} \]
                          4. Step-by-step derivation
                            1. Applied rewrites89.1%

                              \[\leadsto w0 \cdot \color{blue}{1} \]
                          5. Recombined 2 regimes into one program.
                          6. Final simplification79.0%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(-0.125, \frac{\left(\left(h \cdot M\right) \cdot \left(D \cdot D\right)\right) \cdot M}{\left(d \cdot d\right) \cdot \ell}, 1\right) \cdot w0\\ \mathbf{else}:\\ \;\;\;\;1 \cdot w0\\ \end{array} \]
                          7. Add Preprocessing

                          Alternative 9: 77.9% accurate, 0.8× speedup?

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

                            1. Initial program 54.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              1. Initial program 87.5%

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

                                \[\leadsto w0 \cdot \color{blue}{1} \]
                              4. Step-by-step derivation
                                1. Applied rewrites89.1%

                                  \[\leadsto w0 \cdot \color{blue}{1} \]
                              5. Recombined 2 regimes into one program.
                              6. Final simplification80.2%

                                \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(-0.125, \frac{\left(\left(\left(h \cdot D\right) \cdot D\right) \cdot M\right) \cdot M}{\left(d \cdot d\right) \cdot \ell}, 1\right) \cdot w0\\ \mathbf{else}:\\ \;\;\;\;1 \cdot w0\\ \end{array} \]
                              7. Add Preprocessing

                              Alternative 10: 76.1% accurate, 0.8× speedup?

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

                                1. Initial program 54.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  1. Initial program 87.5%

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

                                    \[\leadsto w0 \cdot \color{blue}{1} \]
                                  4. Step-by-step derivation
                                    1. Applied rewrites89.1%

                                      \[\leadsto w0 \cdot \color{blue}{1} \]
                                  5. Recombined 2 regimes into one program.
                                  6. Final simplification80.2%

                                    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(-0.125, \frac{D}{\left(d \cdot d\right) \cdot \ell} \cdot \left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right), 1\right) \cdot w0\\ \mathbf{else}:\\ \;\;\;\;1 \cdot w0\\ \end{array} \]
                                  7. Add Preprocessing

                                  Alternative 11: 76.0% accurate, 0.8× speedup?

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

                                    1. Initial program 54.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    1. Initial program 87.5%

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

                                      \[\leadsto w0 \cdot \color{blue}{1} \]
                                    4. Step-by-step derivation
                                      1. Applied rewrites89.1%

                                        \[\leadsto w0 \cdot \color{blue}{1} \]
                                    5. Recombined 2 regimes into one program.
                                    6. Final simplification78.5%

                                      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot w0\right) \cdot \left(D \cdot D\right)}{\left(d \cdot d\right) \cdot \ell}, -0.125, w0\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot w0\\ \end{array} \]
                                    7. Add Preprocessing

                                    Alternative 12: 87.1% accurate, 1.4× speedup?

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

                                      1. Initial program 82.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      if 1.00000000000000007e-37 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d))

                                      1. Initial program 73.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          \[\leadsto w0 \cdot \sqrt{1 - \frac{\left(h \cdot \left(\frac{M}{d} \cdot M\right)\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot D\right)}}{\ell} \cdot \left(\frac{D}{d} \cdot \frac{1}{2}\right)} \]
                                        12. lower-*.f6473.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    Alternative 13: 68.4% accurate, 1.8× speedup?

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

                                      1. Initial program 77.9%

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

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

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

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

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

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

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

                                          \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \color{blue}{\frac{\frac{M \cdot D}{2 \cdot d}}{\frac{2 \cdot d}{M \cdot D}}}} \]
                                        8. lift-/.f64N/A

                                          \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \frac{\color{blue}{\frac{M \cdot D}{2 \cdot d}}}{\frac{2 \cdot d}{M \cdot D}}} \]
                                        9. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          \[\leadsto w0 \cdot \sqrt{1 - \frac{\left(\left(D \cdot h\right) \cdot M\right) \cdot \frac{\color{blue}{\left(D \cdot M\right)} \cdot 0.5}{d}}{\ell}} \]
                                      8. Applied rewrites62.3%

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

                                      if 5.0000000000000003e-123 < (*.f64 #s(literal 2 binary64) d)

                                      1. Initial program 84.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    Alternative 14: 86.5% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\left(\frac{D}{d} \cdot M\right) \cdot \left(\left(\frac{D}{d} \cdot M\right) \cdot \left(0.25 \cdot h\right)\right)}}{\ell}} \]
                                    11. Final simplification88.8%

                                      \[\leadsto \sqrt{1 - \frac{\left(\left(0.25 \cdot h\right) \cdot \left(\frac{D}{d} \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot M\right)}{\ell}} \cdot w0 \]
                                    12. Add Preprocessing

                                    Alternative 15: 67.2% accurate, 26.2× speedup?

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

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

                                      \[\leadsto w0 \cdot \color{blue}{1} \]
                                    4. Step-by-step derivation
                                      1. Applied rewrites70.5%

                                        \[\leadsto w0 \cdot \color{blue}{1} \]
                                      2. Final simplification70.5%

                                        \[\leadsto 1 \cdot w0 \]
                                      3. Add Preprocessing

                                      Reproduce

                                      ?
                                      herbie shell --seed 2024312 
                                      (FPCore (w0 M D h l d)
                                        :name "Henrywood and Agarwal, Equation (9a)"
                                        :precision binary64
                                        (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))