Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.1% → 87.2%
Time: 15.8s
Alternatives: 13
Speedup: 2.1×

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 13 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: 81.1% 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: 87.2% accurate, 1.7× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 #s(literal 2 binary64) d) < 9.99999999999999979e-121

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

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999979e-121 < (*.f64 #s(literal 2 binary64) d)

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{D}{d}, \color{blue}{\frac{D}{d} \cdot \frac{-0.25 \cdot \left(M \cdot \left(M \cdot h\right)\right)}{\ell}}, 1\right)} \]
        2. Step-by-step derivation
          1. Applied rewrites86.7%

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

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

        Alternative 2: 84.0% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          1. Initial program 88.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 rewrites96.2%

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

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

          Alternative 3: 82.3% accurate, 0.8× speedup?

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

            1. Initial program 59.4%

              \[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 \sqrt{\color{blue}{1 + \frac{-1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}} \]
            4. Step-by-step derivation
              1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                1. Initial program 88.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 rewrites96.2%

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

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

                Alternative 4: 79.3% accurate, 0.8× speedup?

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

                  1. Initial program 59.4%

                    \[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 \sqrt{\color{blue}{1 + \frac{-1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}} \]
                  4. Step-by-step derivation
                    1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

                    1. Initial program 88.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 rewrites96.2%

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

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

                    Alternative 5: 79.7% accurate, 0.8× speedup?

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

                      1. Initial program 52.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 \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. associate-/l*N/A

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

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

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

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

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

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

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

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

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

                          1. Initial program 88.7%

                            \[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.6%

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

                          Alternative 6: 79.4% accurate, 0.8× speedup?

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

                            1. Initial program 52.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 \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. associate-/l*N/A

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

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

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

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

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

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

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

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

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

                                1. Initial program 88.7%

                                  \[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.6%

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

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

                                Alternative 7: 78.7% accurate, 0.8× speedup?

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

                                  1. Initial program 51.4%

                                    \[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. associate-/l*N/A

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

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

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

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

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

                                    \[\leadsto \frac{-1}{8} \cdot \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w0\right)\right)}{{d}^{2} \cdot \ell}} \]
                                  7. Step-by-step derivation
                                    1. Applied rewrites42.2%

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

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

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

                                      1. Initial program 88.7%

                                        \[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 simplification79.9%

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

                                      Alternative 8: 78.7% accurate, 0.8× speedup?

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

                                        1. Initial program 51.4%

                                          \[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. associate-/l*N/A

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

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

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

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

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

                                          \[\leadsto \frac{-1}{8} \cdot \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w0\right)\right)}{{d}^{2} \cdot \ell}} \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites42.2%

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

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

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

                                          1. Initial program 88.7%

                                            \[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.4%

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

                                          Alternative 9: 86.3% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                            if 9.99999999999999979e-121 < (*.f64 #s(literal 2 binary64) d)

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

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

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

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

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

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

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

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

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

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

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

                                                  \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{D}{d}, \color{blue}{\frac{D}{d} \cdot \frac{-0.25 \cdot \left(M \cdot \left(M \cdot h\right)\right)}{\ell}}, 1\right)} \]
                                                2. Step-by-step derivation
                                                  1. Applied rewrites86.7%

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

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

                                                Alternative 10: 89.0% accurate, 2.0× speedup?

                                                \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\ \\ w0 \cdot \sqrt{\mathsf{fma}\left(\frac{\frac{M\_m \cdot D\_m}{d\_m \cdot -2}}{\ell}, \frac{M\_m \cdot D\_m}{d\_m \cdot 2} \cdot h, 1\right)} \end{array} \]
                                                d_m = (fabs.f64 d)
                                                D_m = (fabs.f64 D)
                                                M_m = (fabs.f64 M)
                                                NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
                                                (FPCore (w0 M_m D_m h l d_m)
                                                 :precision binary64
                                                 (*
                                                  w0
                                                  (sqrt
                                                   (fma
                                                    (/ (/ (* M_m D_m) (* d_m -2.0)) l)
                                                    (* (/ (* M_m D_m) (* d_m 2.0)) h)
                                                    1.0))))
                                                d_m = fabs(d);
                                                D_m = fabs(D);
                                                M_m = fabs(M);
                                                assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
                                                double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
                                                	return w0 * sqrt(fma((((M_m * D_m) / (d_m * -2.0)) / l), (((M_m * D_m) / (d_m * 2.0)) * h), 1.0));
                                                }
                                                
                                                d_m = abs(d)
                                                D_m = abs(D)
                                                M_m = abs(M)
                                                w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m])
                                                function code(w0, M_m, D_m, h, l, d_m)
                                                	return Float64(w0 * sqrt(fma(Float64(Float64(Float64(M_m * D_m) / Float64(d_m * -2.0)) / l), Float64(Float64(Float64(M_m * D_m) / Float64(d_m * 2.0)) * h), 1.0)))
                                                end
                                                
                                                d_m = N[Abs[d], $MachinePrecision]
                                                D_m = N[Abs[D], $MachinePrecision]
                                                M_m = N[Abs[M], $MachinePrecision]
                                                NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
                                                code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d$95$m * -2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d$95$m * 2.0), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
                                                
                                                \begin{array}{l}
                                                d_m = \left|d\right|
                                                \\
                                                D_m = \left|D\right|
                                                \\
                                                M_m = \left|M\right|
                                                \\
                                                [w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
                                                \\
                                                w0 \cdot \sqrt{\mathsf{fma}\left(\frac{\frac{M\_m \cdot D\_m}{d\_m \cdot -2}}{\ell}, \frac{M\_m \cdot D\_m}{d\_m \cdot 2} \cdot h, 1\right)}
                                                \end{array}
                                                
                                                Derivation
                                                1. Initial program 79.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{\color{blue}{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
                                                  2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                  \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{\frac{M \cdot D}{d \cdot -2}}{\ell}, \frac{M \cdot D}{d \cdot 2} \cdot h, 1\right)} \]
                                                8. Add Preprocessing

                                                Alternative 11: 83.3% accurate, 2.1× speedup?

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

                                                  1. Initial program 79.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}{1} \]
                                                  4. Step-by-step derivation
                                                    1. Applied rewrites76.6%

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

                                                    if 2.7999999999999998e-184 < M

                                                    1. Initial program 80.3%

                                                      \[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 \sqrt{\color{blue}{1 + \frac{-1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}} \]
                                                    4. Step-by-step derivation
                                                      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                                                        Alternative 12: 86.1% accurate, 2.1× speedup?

                                                        \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\ \\ w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M\_m \cdot D\_m}{d\_m \cdot 2}, h \cdot \frac{M\_m \cdot D\_m}{-2 \cdot \left(d\_m \cdot \ell\right)}, 1\right)} \end{array} \]
                                                        d_m = (fabs.f64 d)
                                                        D_m = (fabs.f64 D)
                                                        M_m = (fabs.f64 M)
                                                        NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
                                                        (FPCore (w0 M_m D_m h l d_m)
                                                         :precision binary64
                                                         (*
                                                          w0
                                                          (sqrt
                                                           (fma
                                                            (/ (* M_m D_m) (* d_m 2.0))
                                                            (* h (/ (* M_m D_m) (* -2.0 (* d_m l))))
                                                            1.0))))
                                                        d_m = fabs(d);
                                                        D_m = fabs(D);
                                                        M_m = fabs(M);
                                                        assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d_m);
                                                        double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
                                                        	return w0 * sqrt(fma(((M_m * D_m) / (d_m * 2.0)), (h * ((M_m * D_m) / (-2.0 * (d_m * l)))), 1.0));
                                                        }
                                                        
                                                        d_m = abs(d)
                                                        D_m = abs(D)
                                                        M_m = abs(M)
                                                        w0, M_m, D_m, h, l, d_m = sort([w0, M_m, D_m, h, l, d_m])
                                                        function code(w0, M_m, D_m, h, l, d_m)
                                                        	return Float64(w0 * sqrt(fma(Float64(Float64(M_m * D_m) / Float64(d_m * 2.0)), Float64(h * Float64(Float64(M_m * D_m) / Float64(-2.0 * Float64(d_m * l)))), 1.0)))
                                                        end
                                                        
                                                        d_m = N[Abs[d], $MachinePrecision]
                                                        D_m = N[Abs[D], $MachinePrecision]
                                                        M_m = N[Abs[M], $MachinePrecision]
                                                        NOTE: w0, M_m, D_m, h, l, and d_m should be sorted in increasing order before calling this function.
                                                        code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d$95$m * 2.0), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(-2.0 * N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
                                                        
                                                        \begin{array}{l}
                                                        d_m = \left|d\right|
                                                        \\
                                                        D_m = \left|D\right|
                                                        \\
                                                        M_m = \left|M\right|
                                                        \\
                                                        [w0, M_m, D_m, h, l, d_m] = \mathsf{sort}([w0, M_m, D_m, h, l, d_m])\\
                                                        \\
                                                        w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M\_m \cdot D\_m}{d\_m \cdot 2}, h \cdot \frac{M\_m \cdot D\_m}{-2 \cdot \left(d\_m \cdot \ell\right)}, 1\right)}
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Initial program 79.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-pow.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                          \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{d \cdot 2}, h \cdot \frac{M \cdot D}{-2 \cdot \left(d \cdot \ell\right)}, 1\right)} \]
                                                        7. Add Preprocessing

                                                        Alternative 13: 68.2% accurate, 26.2× speedup?

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

                                                            \[\leadsto w0 \cdot \color{blue}{1} \]
                                                          2. Add Preprocessing

                                                          Reproduce

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