Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.2% → 87.0%
Time: 15.2s
Alternatives: 12
Speedup: 0.8×

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 12 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.2% 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.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-16}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{d \cdot -2}, \left(M \cdot D\right) \cdot \left(\frac{h}{\ell} \cdot \frac{0.5}{d}\right), 1\right)}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e-16)
   (*
    w0
    (sqrt (fma (/ (* M D) (* d -2.0)) (* (* M D) (* (/ h l) (/ 0.5 d))) 1.0)))
   w0))
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-16) {
		tmp = w0 * sqrt(fma(((M * D) / (d * -2.0)), ((M * D) * ((h / l) * (0.5 / d))), 1.0));
	} else {
		tmp = w0;
	}
	return tmp;
}
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e-16)
		tmp = Float64(w0 * sqrt(fma(Float64(Float64(M * D) / Float64(d * -2.0)), Float64(Float64(M * D) * Float64(Float64(h / l) * Float64(0.5 / d))), 1.0)));
	else
		tmp = w0;
	end
	return tmp
end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e-16], N[(w0 * N[Sqrt[N[(N[(N[(M * D), $MachinePrecision] / N[(d * -2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-16}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{d \cdot -2}, \left(M \cdot D\right) \cdot \left(\frac{h}{\ell} \cdot \frac{0.5}{d}\right), 1\right)}\\

\mathbf{else}:\\
\;\;\;\;w0\\


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

    1. Initial program 66.1%

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

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

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
      7. 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)}} \]
      8. +-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}} \]
      9. 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} \]
      10. lift-pow.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} \]
      11. unpow2N/A

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

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

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

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

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

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

    1. Initial program 89.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 rewrites99.4%

        \[\leadsto w0 \cdot \color{blue}{1} \]
      2. Step-by-step derivation
        1. *-rgt-identity99.4

          \[\leadsto \color{blue}{w0} \]
      3. Applied rewrites99.4%

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

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

    Alternative 2: 84.9% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-16}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M}{d}, \left(D \cdot -0.5\right) \cdot \left(\left(M \cdot D\right) \cdot \frac{h \cdot 0.5}{d \cdot \ell}\right), 1\right)}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
    (FPCore (w0 M D h l d)
     :precision binary64
     (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e-16)
       (*
        w0
        (sqrt (fma (/ M d) (* (* D -0.5) (* (* M D) (/ (* h 0.5) (* d l)))) 1.0)))
       w0))
    double code(double w0, double M, double D, double h, double l, double d) {
    	double tmp;
    	if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e-16) {
    		tmp = w0 * sqrt(fma((M / d), ((D * -0.5) * ((M * D) * ((h * 0.5) / (d * l)))), 1.0));
    	} else {
    		tmp = w0;
    	}
    	return tmp;
    }
    
    function code(w0, M, D, h, l, d)
    	tmp = 0.0
    	if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e-16)
    		tmp = Float64(w0 * sqrt(fma(Float64(M / d), Float64(Float64(D * -0.5) * Float64(Float64(M * D) * Float64(Float64(h * 0.5) / Float64(d * l)))), 1.0)));
    	else
    		tmp = w0;
    	end
    	return tmp
    end
    
    code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e-16], N[(w0 * N[Sqrt[N[(N[(M / d), $MachinePrecision] * N[(N[(D * -0.5), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(N[(h * 0.5), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-16}:\\
    \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M}{d}, \left(D \cdot -0.5\right) \cdot \left(\left(M \cdot D\right) \cdot \frac{h \cdot 0.5}{d \cdot \ell}\right), 1\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;w0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2e-16

      1. Initial program 66.1%

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

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

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

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

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

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

          \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
        7. 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)}} \]
        8. +-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}} \]
        9. 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} \]
        10. lift-pow.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} \]
        11. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 89.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 rewrites99.4%

          \[\leadsto w0 \cdot \color{blue}{1} \]
        2. Step-by-step derivation
          1. *-rgt-identity99.4

            \[\leadsto \color{blue}{w0} \]
        3. Applied rewrites99.4%

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

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

      Alternative 3: 82.3% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.05:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M}{d}, \frac{-0.25 \cdot \left(h \cdot \left(M \cdot \left(D \cdot D\right)\right)\right)}{d \cdot \ell}, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
      (FPCore (w0 M D h l d)
       :precision binary64
       (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -0.05)
         (* w0 (sqrt (fma (/ M d) (/ (* -0.25 (* h (* M (* D D)))) (* d l)) 1.0)))
         w0))
      double code(double w0, double M, double D, double h, double l, double d) {
      	double tmp;
      	if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -0.05) {
      		tmp = w0 * sqrt(fma((M / d), ((-0.25 * (h * (M * (D * D)))) / (d * l)), 1.0));
      	} else {
      		tmp = w0;
      	}
      	return tmp;
      }
      
      function code(w0, M, D, h, l, d)
      	tmp = 0.0
      	if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -0.05)
      		tmp = Float64(w0 * sqrt(fma(Float64(M / d), Float64(Float64(-0.25 * Float64(h * Float64(M * Float64(D * D)))) / Float64(d * l)), 1.0)));
      	else
      		tmp = w0;
      	end
      	return tmp
      end
      
      code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -0.05], N[(w0 * N[Sqrt[N[(N[(M / d), $MachinePrecision] * N[(N[(-0.25 * N[(h * N[(M * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.05:\\
      \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M}{d}, \frac{-0.25 \cdot \left(h \cdot \left(M \cdot \left(D \cdot D\right)\right)\right)}{d \cdot \ell}, 1\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;w0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -0.050000000000000003

        1. Initial program 65.2%

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

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

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

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

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

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

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
          7. 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)}} \]
          8. +-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}} \]
          9. 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} \]
          10. lift-pow.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} \]
          11. unpow2N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        1. Initial program 89.1%

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

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

            \[\leadsto w0 \cdot \color{blue}{1} \]
          2. Step-by-step derivation
            1. *-rgt-identity99.1

              \[\leadsto \color{blue}{w0} \]
          3. Applied rewrites99.1%

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

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

        Alternative 4: 84.4% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.0005:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(-M \cdot D, \frac{\left(M \cdot D\right) \cdot h}{\left(d \cdot \ell\right) \cdot \left(d \cdot 4\right)}, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
        (FPCore (w0 M D h l d)
         :precision binary64
         (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -0.0005)
           (* w0 (sqrt (fma (- (* M D)) (/ (* (* M D) h) (* (* d l) (* d 4.0))) 1.0)))
           w0))
        double code(double w0, double M, double D, double h, double l, double d) {
        	double tmp;
        	if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -0.0005) {
        		tmp = w0 * sqrt(fma(-(M * D), (((M * D) * h) / ((d * l) * (d * 4.0))), 1.0));
        	} else {
        		tmp = w0;
        	}
        	return tmp;
        }
        
        function code(w0, M, D, h, l, d)
        	tmp = 0.0
        	if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -0.0005)
        		tmp = Float64(w0 * sqrt(fma(Float64(-Float64(M * D)), Float64(Float64(Float64(M * D) * h) / Float64(Float64(d * l) * Float64(d * 4.0))), 1.0)));
        	else
        		tmp = w0;
        	end
        	return tmp
        end
        
        code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -0.0005], N[(w0 * N[Sqrt[N[((-N[(M * D), $MachinePrecision]) * N[(N[(N[(M * D), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d * l), $MachinePrecision] * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.0005:\\
        \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(-M \cdot D, \frac{\left(M \cdot D\right) \cdot h}{\left(d \cdot \ell\right) \cdot \left(d \cdot 4\right)}, 1\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;w0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.0000000000000001e-4

          1. Initial program 65.7%

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

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

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

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

              \[\leadsto w0 \cdot \sqrt{1 - \left(\color{blue}{\frac{M \cdot D}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{h}{\ell}} \]
            6. 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}} \]
            7. frac-timesN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \sqrt{\mathsf{fma}\left(M \cdot \left(\mathsf{neg}\left(D\right)\right), \frac{\left(M \cdot D\right) \cdot h}{\color{blue}{\left(d \cdot \ell\right) \cdot \left(d \cdot 4\right)}}, 1\right)} \cdot w0 \]
            11. lower-*.f6455.6

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

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

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

          1. Initial program 89.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 rewrites99.4%

              \[\leadsto w0 \cdot \color{blue}{1} \]
            2. Step-by-step derivation
              1. *-rgt-identity99.4

                \[\leadsto \color{blue}{w0} \]
            3. Applied rewrites99.4%

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

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

          Alternative 5: 83.5% accurate, 0.8× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.05:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(-M \cdot D, \frac{M \cdot \left(D \cdot h\right)}{4 \cdot \left(d \cdot \left(d \cdot \ell\right)\right)}, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
          (FPCore (w0 M D h l d)
           :precision binary64
           (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -0.05)
             (* w0 (sqrt (fma (- (* M D)) (/ (* M (* D h)) (* 4.0 (* d (* d l)))) 1.0)))
             w0))
          double code(double w0, double M, double D, double h, double l, double d) {
          	double tmp;
          	if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -0.05) {
          		tmp = w0 * sqrt(fma(-(M * D), ((M * (D * h)) / (4.0 * (d * (d * l)))), 1.0));
          	} else {
          		tmp = w0;
          	}
          	return tmp;
          }
          
          function code(w0, M, D, h, l, d)
          	tmp = 0.0
          	if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -0.05)
          		tmp = Float64(w0 * sqrt(fma(Float64(-Float64(M * D)), Float64(Float64(M * Float64(D * h)) / Float64(4.0 * Float64(d * Float64(d * l)))), 1.0)));
          	else
          		tmp = w0;
          	end
          	return tmp
          end
          
          code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -0.05], N[(w0 * N[Sqrt[N[((-N[(M * D), $MachinePrecision]) * N[(N[(M * N[(D * h), $MachinePrecision]), $MachinePrecision] / N[(4.0 * N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.05:\\
          \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(-M \cdot D, \frac{M \cdot \left(D \cdot h\right)}{4 \cdot \left(d \cdot \left(d \cdot \ell\right)\right)}, 1\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;w0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -0.050000000000000003

            1. Initial program 65.2%

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

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

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

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

                \[\leadsto w0 \cdot \sqrt{1 - \left(\color{blue}{\frac{M \cdot D}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{h}{\ell}} \]
              6. 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}} \]
              7. frac-timesN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            1. Initial program 89.1%

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

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

                \[\leadsto w0 \cdot \color{blue}{1} \]
              2. Step-by-step derivation
                1. *-rgt-identity99.1

                  \[\leadsto \color{blue}{w0} \]
              3. Applied rewrites99.1%

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

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

            Alternative 6: 82.5% accurate, 0.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.0005:\\ \;\;\;\;w0 \cdot \sqrt{1 - M \cdot \left(D \cdot \frac{\left(M \cdot D\right) \cdot h}{\ell \cdot \left(4 \cdot \left(d \cdot d\right)\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
            (FPCore (w0 M D h l d)
             :precision binary64
             (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -0.0005)
               (* w0 (sqrt (- 1.0 (* M (* D (/ (* (* M D) h) (* l (* 4.0 (* d d)))))))))
               w0))
            double code(double w0, double M, double D, double h, double l, double d) {
            	double tmp;
            	if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -0.0005) {
            		tmp = w0 * sqrt((1.0 - (M * (D * (((M * D) * h) / (l * (4.0 * (d * d))))))));
            	} else {
            		tmp = w0;
            	}
            	return tmp;
            }
            
            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
                real(8) :: tmp
                if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-0.0005d0)) then
                    tmp = w0 * sqrt((1.0d0 - (m * (d * (((m * d) * h) / (l * (4.0d0 * (d_1 * d_1))))))))
                else
                    tmp = w0
                end if
                code = tmp
            end function
            
            public static double code(double w0, double M, double D, double h, double l, double d) {
            	double tmp;
            	if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -0.0005) {
            		tmp = w0 * Math.sqrt((1.0 - (M * (D * (((M * D) * h) / (l * (4.0 * (d * d))))))));
            	} else {
            		tmp = w0;
            	}
            	return tmp;
            }
            
            def code(w0, M, D, h, l, d):
            	tmp = 0
            	if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -0.0005:
            		tmp = w0 * math.sqrt((1.0 - (M * (D * (((M * D) * h) / (l * (4.0 * (d * d))))))))
            	else:
            		tmp = w0
            	return tmp
            
            function code(w0, M, D, h, l, d)
            	tmp = 0.0
            	if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -0.0005)
            		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(M * Float64(D * Float64(Float64(Float64(M * D) * h) / Float64(l * Float64(4.0 * Float64(d * d)))))))));
            	else
            		tmp = w0;
            	end
            	return tmp
            end
            
            function tmp_2 = code(w0, M, D, h, l, d)
            	tmp = 0.0;
            	if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -0.0005)
            		tmp = w0 * sqrt((1.0 - (M * (D * (((M * D) * h) / (l * (4.0 * (d * d))))))));
            	else
            		tmp = w0;
            	end
            	tmp_2 = tmp;
            end
            
            code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -0.0005], N[(w0 * N[Sqrt[N[(1.0 - N[(M * N[(D * N[(N[(N[(M * D), $MachinePrecision] * h), $MachinePrecision] / N[(l * N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -0.0005:\\
            \;\;\;\;w0 \cdot \sqrt{1 - M \cdot \left(D \cdot \frac{\left(M \cdot D\right) \cdot h}{\ell \cdot \left(4 \cdot \left(d \cdot d\right)\right)}\right)}\\
            
            \mathbf{else}:\\
            \;\;\;\;w0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.0000000000000001e-4

              1. Initial program 65.7%

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

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

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

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

                  \[\leadsto w0 \cdot \sqrt{1 - \left(\color{blue}{\frac{M \cdot D}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{h}{\ell}} \]
                6. 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}} \]
                7. frac-timesN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 89.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 rewrites99.4%

                  \[\leadsto w0 \cdot \color{blue}{1} \]
                2. Step-by-step derivation
                  1. *-rgt-identity99.4

                    \[\leadsto \color{blue}{w0} \]
                3. Applied rewrites99.4%

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

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

              Alternative 7: 80.1% accurate, 0.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+114}:\\ \;\;\;\;\mathsf{fma}\left(w0 \cdot -0.125, \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{d} \cdot \frac{h}{d \cdot \ell}, w0\right)\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
              (FPCore (w0 M D h l d)
               :precision binary64
               (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+114)
                 (fma (* w0 -0.125) (* (/ (* (* M D) (* M D)) d) (/ h (* d l))) w0)
                 w0))
              double code(double w0, double M, double D, double h, double l, double d) {
              	double tmp;
              	if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+114) {
              		tmp = fma((w0 * -0.125), ((((M * D) * (M * D)) / d) * (h / (d * l))), w0);
              	} else {
              		tmp = w0;
              	}
              	return tmp;
              }
              
              function code(w0, M, D, h, l, d)
              	tmp = 0.0
              	if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+114)
              		tmp = fma(Float64(w0 * -0.125), Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) / d) * Float64(h / Float64(d * l))), w0);
              	else
              		tmp = w0;
              	end
              	return tmp
              end
              
              code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+114], N[(N[(w0 * -0.125), $MachinePrecision] * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(h / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision], w0]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+114}:\\
              \;\;\;\;\mathsf{fma}\left(w0 \cdot -0.125, \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{d} \cdot \frac{h}{d \cdot \ell}, w0\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;w0\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.0000000000000001e114

                1. Initial program 58.8%

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

                  \[\leadsto \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 rewrites41.8%

                  \[\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 w0 around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                1. Initial program 89.8%

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

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

                    \[\leadsto w0 \cdot \color{blue}{1} \]
                  2. Step-by-step derivation
                    1. *-rgt-identity92.9

                      \[\leadsto \color{blue}{w0} \]
                  3. Applied rewrites92.9%

                    \[\leadsto \color{blue}{w0} \]
                5. Recombined 2 regimes into one program.
                6. Add Preprocessing

                Alternative 8: 79.5% accurate, 0.8× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+178}:\\ \;\;\;\;\mathsf{fma}\left(w0 \cdot -0.125, \left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{h}{d \cdot \left(d \cdot \ell\right)}, w0\right)\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
                (FPCore (w0 M D h l d)
                 :precision binary64
                 (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -2e+178)
                   (fma (* w0 -0.125) (* (* (* M D) (* M D)) (/ h (* d (* d l)))) w0)
                   w0))
                double code(double w0, double M, double D, double h, double l, double d) {
                	double tmp;
                	if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -2e+178) {
                		tmp = fma((w0 * -0.125), (((M * D) * (M * D)) * (h / (d * (d * l)))), w0);
                	} else {
                		tmp = w0;
                	}
                	return tmp;
                }
                
                function code(w0, M, D, h, l, d)
                	tmp = 0.0
                	if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e+178)
                		tmp = fma(Float64(w0 * -0.125), Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(h / Float64(d * Float64(d * l)))), w0);
                	else
                		tmp = w0;
                	end
                	return tmp
                end
                
                code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e+178], N[(N[(w0 * -0.125), $MachinePrecision] * N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(h / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision], w0]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+178}:\\
                \;\;\;\;\mathsf{fma}\left(w0 \cdot -0.125, \left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{h}{d \cdot \left(d \cdot \ell\right)}, w0\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;w0\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2.0000000000000001e178

                  1. Initial program 58.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 rewrites42.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 w0 around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  1. Initial program 89.8%

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

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

                      \[\leadsto w0 \cdot \color{blue}{1} \]
                    2. Step-by-step derivation
                      1. *-rgt-identity92.5

                        \[\leadsto \color{blue}{w0} \]
                    3. Applied rewrites92.5%

                      \[\leadsto \color{blue}{w0} \]
                  5. Recombined 2 regimes into one program.
                  6. Add Preprocessing

                  Alternative 9: 79.8% accurate, 0.8× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+114}:\\ \;\;\;\;\mathsf{fma}\left(D, \left(w0 \cdot -0.125\right) \cdot \frac{M \cdot \left(D \cdot \left(M \cdot h\right)\right)}{d \cdot \left(d \cdot \ell\right)}, w0\right)\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
                  (FPCore (w0 M D h l d)
                   :precision binary64
                   (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+114)
                     (fma D (* (* w0 -0.125) (/ (* M (* D (* M h))) (* d (* d l)))) w0)
                     w0))
                  double code(double w0, double M, double D, double h, double l, double d) {
                  	double tmp;
                  	if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+114) {
                  		tmp = fma(D, ((w0 * -0.125) * ((M * (D * (M * h))) / (d * (d * l)))), w0);
                  	} else {
                  		tmp = w0;
                  	}
                  	return tmp;
                  }
                  
                  function code(w0, M, D, h, l, d)
                  	tmp = 0.0
                  	if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+114)
                  		tmp = fma(D, Float64(Float64(w0 * -0.125) * Float64(Float64(M * Float64(D * Float64(M * h))) / Float64(d * Float64(d * l)))), w0);
                  	else
                  		tmp = w0;
                  	end
                  	return tmp
                  end
                  
                  code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+114], N[(D * N[(N[(w0 * -0.125), $MachinePrecision] * N[(N[(M * N[(D * N[(M * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision], w0]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+114}:\\
                  \;\;\;\;\mathsf{fma}\left(D, \left(w0 \cdot -0.125\right) \cdot \frac{M \cdot \left(D \cdot \left(M \cdot h\right)\right)}{d \cdot \left(d \cdot \ell\right)}, w0\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;w0\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.0000000000000001e114

                    1. Initial program 58.8%

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

                      \[\leadsto \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 rewrites41.8%

                      \[\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 w0 around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    1. Initial program 89.8%

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

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

                        \[\leadsto w0 \cdot \color{blue}{1} \]
                      2. Step-by-step derivation
                        1. *-rgt-identity92.9

                          \[\leadsto \color{blue}{w0} \]
                      3. Applied rewrites92.9%

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

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

                    Alternative 10: 78.5% accurate, 0.8× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+219}:\\ \;\;\;\;\left(\left(D \cdot D\right) \cdot \left(M \cdot \left(-0.125 \cdot \left(M \cdot h\right)\right)\right)\right) \cdot \frac{w0}{d \cdot \left(d \cdot \ell\right)}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
                    (FPCore (w0 M D h l d)
                     :precision binary64
                     (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) -5e+219)
                       (* (* (* D D) (* M (* -0.125 (* M h)))) (/ w0 (* d (* d l))))
                       w0))
                    double code(double w0, double M, double D, double h, double l, double d) {
                    	double tmp;
                    	if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+219) {
                    		tmp = ((D * D) * (M * (-0.125 * (M * h)))) * (w0 / (d * (d * l)));
                    	} else {
                    		tmp = w0;
                    	}
                    	return tmp;
                    }
                    
                    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
                        real(8) :: tmp
                        if (((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l)) <= (-5d+219)) then
                            tmp = ((d * d) * (m * ((-0.125d0) * (m * h)))) * (w0 / (d_1 * (d_1 * l)))
                        else
                            tmp = w0
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double w0, double M, double D, double h, double l, double d) {
                    	double tmp;
                    	if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+219) {
                    		tmp = ((D * D) * (M * (-0.125 * (M * h)))) * (w0 / (d * (d * l)));
                    	} else {
                    		tmp = w0;
                    	}
                    	return tmp;
                    }
                    
                    def code(w0, M, D, h, l, d):
                    	tmp = 0
                    	if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -5e+219:
                    		tmp = ((D * D) * (M * (-0.125 * (M * h)))) * (w0 / (d * (d * l)))
                    	else:
                    		tmp = w0
                    	return tmp
                    
                    function code(w0, M, D, h, l, d)
                    	tmp = 0.0
                    	if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -5e+219)
                    		tmp = Float64(Float64(Float64(D * D) * Float64(M * Float64(-0.125 * Float64(M * h)))) * Float64(w0 / Float64(d * Float64(d * l))));
                    	else
                    		tmp = w0;
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(w0, M, D, h, l, d)
                    	tmp = 0.0;
                    	if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -5e+219)
                    		tmp = ((D * D) * (M * (-0.125 * (M * h)))) * (w0 / (d * (d * l)));
                    	else
                    		tmp = w0;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+219], N[(N[(N[(D * D), $MachinePrecision] * N[(M * N[(-0.125 * N[(M * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w0 / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+219}:\\
                    \;\;\;\;\left(\left(D \cdot D\right) \cdot \left(M \cdot \left(-0.125 \cdot \left(M \cdot h\right)\right)\right)\right) \cdot \frac{w0}{d \cdot \left(d \cdot \ell\right)}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;w0\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5e219

                      1. Initial program 57.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 \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 rewrites42.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 w0 around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\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}} \]
                      10. Step-by-step derivation
                        1. *-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}} \]
                        2. 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} \]
                        3. 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)} \]
                        4. *-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)} \]
                        5. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \left(D \cdot D\right) \cdot \frac{\left(\frac{-1}{8} \cdot \left(\left(M \cdot M\right) \cdot h\right)\right) \cdot w0}{\color{blue}{\left(d \cdot d\right)} \cdot \ell} \]
                        19. lower-*.f6438.5

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      1. Initial program 89.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 rewrites92.0%

                          \[\leadsto w0 \cdot \color{blue}{1} \]
                        2. Step-by-step derivation
                          1. *-rgt-identity92.0

                            \[\leadsto \color{blue}{w0} \]
                        3. Applied rewrites92.0%

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

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

                      Alternative 11: 78.3% accurate, 0.8× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -\infty:\\ \;\;\;\;\left(D \cdot D\right) \cdot \left(w0 \cdot \frac{M \cdot \left(-0.125 \cdot \left(M \cdot h\right)\right)}{d \cdot \left(d \cdot \ell\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
                      (FPCore (w0 M D h l d)
                       :precision binary64
                       (if (<= (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)) (- INFINITY))
                         (* (* D D) (* w0 (/ (* M (* -0.125 (* M h))) (* d (* d l)))))
                         w0))
                      double code(double w0, double M, double D, double h, double l, double d) {
                      	double tmp;
                      	if ((pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -((double) INFINITY)) {
                      		tmp = (D * D) * (w0 * ((M * (-0.125 * (M * h))) / (d * (d * l))));
                      	} else {
                      		tmp = w0;
                      	}
                      	return tmp;
                      }
                      
                      public static double code(double w0, double M, double D, double h, double l, double d) {
                      	double tmp;
                      	if ((Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -Double.POSITIVE_INFINITY) {
                      		tmp = (D * D) * (w0 * ((M * (-0.125 * (M * h))) / (d * (d * l))));
                      	} else {
                      		tmp = w0;
                      	}
                      	return tmp;
                      }
                      
                      def code(w0, M, D, h, l, d):
                      	tmp = 0
                      	if (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l)) <= -math.inf:
                      		tmp = (D * D) * (w0 * ((M * (-0.125 * (M * h))) / (d * (d * l))))
                      	else:
                      		tmp = w0
                      	return tmp
                      
                      function code(w0, M, D, h, l, d)
                      	tmp = 0.0
                      	if (Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= Float64(-Inf))
                      		tmp = Float64(Float64(D * D) * Float64(w0 * Float64(Float64(M * Float64(-0.125 * Float64(M * h))) / Float64(d * Float64(d * l)))));
                      	else
                      		tmp = w0;
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(w0, M, D, h, l, d)
                      	tmp = 0.0;
                      	if (((((M * D) / (2.0 * d)) ^ 2.0) * (h / l)) <= -Inf)
                      		tmp = (D * D) * (w0 * ((M * (-0.125 * (M * h))) / (d * (d * l))));
                      	else
                      		tmp = w0;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(N[(D * D), $MachinePrecision] * N[(w0 * N[(N[(M * N[(-0.125 * N[(M * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -\infty:\\
                      \;\;\;\;\left(D \cdot D\right) \cdot \left(w0 \cdot \frac{M \cdot \left(-0.125 \cdot \left(M \cdot h\right)\right)}{d \cdot \left(d \cdot \ell\right)}\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;w0\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -inf.0

                        1. Initial program 55.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 \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 rewrites44.8%

                          \[\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 w0 around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\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}} \]
                        10. Step-by-step derivation
                          1. *-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}} \]
                          2. 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} \]
                          3. 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)} \]
                          4. *-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)} \]
                          5. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \left(D \cdot D\right) \cdot \left(w0 \cdot \frac{\color{blue}{M \cdot \left(\left(M \cdot h\right) \cdot \frac{-1}{8}\right)}}{d \cdot \left(d \cdot \ell\right)}\right) \]
                          19. lower-*.f6442.0

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

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

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

                        1. Initial program 90.1%

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

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

                            \[\leadsto w0 \cdot \color{blue}{1} \]
                          2. Step-by-step derivation
                            1. *-rgt-identity90.7

                              \[\leadsto \color{blue}{w0} \]
                          3. Applied rewrites90.7%

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

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

                        Alternative 12: 67.9% accurate, 157.0× speedup?

                        \[\begin{array}{l} \\ w0 \end{array} \]
                        (FPCore (w0 M D h l d) :precision binary64 w0)
                        double code(double w0, double M, double D, double h, double l, double d) {
                        	return w0;
                        }
                        
                        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
                        end function
                        
                        public static double code(double w0, double M, double D, double h, double l, double d) {
                        	return w0;
                        }
                        
                        def code(w0, M, D, h, l, d):
                        	return w0
                        
                        function code(w0, M, D, h, l, d)
                        	return w0
                        end
                        
                        function tmp = code(w0, M, D, h, l, d)
                        	tmp = w0;
                        end
                        
                        code[w0_, M_, D_, h_, l_, d_] := w0
                        
                        \begin{array}{l}
                        
                        \\
                        w0
                        \end{array}
                        
                        Derivation
                        1. Initial program 81.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 \color{blue}{1} \]
                        4. Step-by-step derivation
                          1. Applied rewrites69.1%

                            \[\leadsto w0 \cdot \color{blue}{1} \]
                          2. Step-by-step derivation
                            1. *-rgt-identity69.1

                              \[\leadsto \color{blue}{w0} \]
                          3. Applied rewrites69.1%

                            \[\leadsto \color{blue}{w0} \]
                          4. Add Preprocessing

                          Reproduce

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