Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.0% → 88.6%
Time: 14.1s
Alternatives: 15
Speedup: 0.7×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 81.0% accurate, 1.0× speedup?

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

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

Alternative 1: 88.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{M \cdot D}{2 \cdot d}\\
\mathbf{if}\;1 - {t\_0}^{2} \cdot \frac{h}{\ell} \leq 5 \cdot 10^{+245}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d \cdot 4}\right)}\\

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


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

    1. Initial program 99.4%

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

        \[\leadsto w0 \cdot \sqrt{1 - {\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-eval82.9

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 47.9%

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

        \[\leadsto w0 \cdot \sqrt{1 - {\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}} \]
    4. Applied egg-rr71.0%

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

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

Alternative 2: 87.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{M \cdot D}{2 \cdot d}\\
\mathbf{if}\;1 - {t\_0}^{2} \cdot \frac{h}{\ell} \leq 5 \cdot 10^{+245}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d \cdot 4}\right)}\\

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


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

    1. Initial program 99.4%

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

        \[\leadsto w0 \cdot \sqrt{1 - {\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-eval82.9

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 47.9%

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

        \[\leadsto w0 \cdot \sqrt{1 - {\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}} \]
    4. Applied egg-rr71.0%

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

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

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

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

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

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

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

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

Alternative 3: 86.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{M \cdot D}{2 \cdot d}\\
\mathbf{if}\;1 - {t\_0}^{2} \cdot \frac{h}{\ell} \leq 5 \cdot 10^{+245}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M}{d} \cdot \left(\left(D \cdot \frac{M}{d}\right) \cdot \frac{h \cdot -0.25}{\ell}\right), D, 1\right)}\\

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 47.9%

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

        \[\leadsto w0 \cdot \sqrt{1 - {\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}} \]
    4. Applied egg-rr71.0%

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

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

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

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

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

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

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

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

Alternative 4: 86.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{M \cdot D}{2 \cdot d}\\
\mathbf{if}\;1 - {t\_0}^{2} \cdot \frac{h}{\ell} \leq 1:\\
\;\;\;\;w0\\

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


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

    1. Initial program 99.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. Simplified99.8%

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

          \[\leadsto \color{blue}{w0} \]
      3. Applied egg-rr99.8%

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

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

      1. Initial program 56.4%

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

          \[\leadsto w0 \cdot \sqrt{1 - {\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}} \]
      4. Applied egg-rr69.9%

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

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

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

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

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

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

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

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

    Alternative 5: 84.7% accurate, 0.7× speedup?

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

      1. Initial program 99.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. Simplified99.8%

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

            \[\leadsto \color{blue}{w0} \]
        3. Applied egg-rr99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 6: 82.5% accurate, 0.7× speedup?

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

        1. Initial program 99.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. Simplified99.8%

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

              \[\leadsto \color{blue}{w0} \]
          3. Applied egg-rr99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 7: 82.1% accurate, 0.7× speedup?

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

          1. Initial program 99.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. Simplified99.8%

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

                \[\leadsto \color{blue}{w0} \]
            3. Applied egg-rr99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 8: 80.7% accurate, 0.7× speedup?

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

            1. Initial program 99.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. Simplified99.8%

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

                  \[\leadsto \color{blue}{w0} \]
              3. Applied egg-rr99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 9: 79.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^{+283}:\\ \;\;\;\;\left(D \cdot \frac{M \cdot \left(w0 \cdot \left(M \cdot h\right)\right)}{d \cdot \left(d \cdot \ell\right)}\right) \cdot \left(D \cdot -0.125\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+283)
               (* (* D (/ (* M (* w0 (* M h))) (* d (* d l)))) (* D -0.125))
               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+283) {
            		tmp = (D * ((M * (w0 * (M * h))) / (d * (d * l)))) * (D * -0.125);
            	} 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+283)) then
                    tmp = (d * ((m * (w0 * (m * h))) / (d_1 * (d_1 * l)))) * (d * (-0.125d0))
                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+283) {
            		tmp = (D * ((M * (w0 * (M * h))) / (d * (d * l)))) * (D * -0.125);
            	} 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+283:
            		tmp = (D * ((M * (w0 * (M * h))) / (d * (d * l)))) * (D * -0.125)
            	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+283)
            		tmp = Float64(Float64(D * Float64(Float64(M * Float64(w0 * Float64(M * h))) / Float64(d * Float64(d * l)))) * Float64(D * -0.125));
            	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+283)
            		tmp = (D * ((M * (w0 * (M * h))) / (d * (d * l)))) * (D * -0.125);
            	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+283], N[(N[(D * N[(N[(M * N[(w0 * N[(M * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D * -0.125), $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^{+283}:\\
            \;\;\;\;\left(D \cdot \frac{M \cdot \left(w0 \cdot \left(M \cdot h\right)\right)}{d \cdot \left(d \cdot \ell\right)}\right) \cdot \left(D \cdot -0.125\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.0000000000000004e283

              1. Initial program 57.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 \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. Simplified45.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. Step-by-step derivation
                1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\mathsf{fma}\left(\left(D \cdot D\right) \cdot -0.125, \frac{h \cdot \left(M \cdot \left(M \cdot w0\right)\right)}{d \cdot \left(d \cdot \ell\right)}, w0\right)} \]
              8. 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}} \]
              9. Step-by-step derivation
                1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 92.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. Simplified90.3%

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

                    \[\leadsto \color{blue}{w0} \]
                3. Applied egg-rr90.3%

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

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

              Alternative 10: 72.7% accurate, 1.8× speedup?

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

                1. Initial program 84.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. Simplified74.7%

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

                      \[\leadsto \color{blue}{w0} \]
                  3. Applied egg-rr74.7%

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

                  if 1.99999999999999991e171 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d))

                  1. Initial program 73.5%

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

                    \[\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. Step-by-step derivation
                    1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 11: 72.6% accurate, 1.8× speedup?

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

                  1. Initial program 84.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. Simplified74.7%

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

                        \[\leadsto \color{blue}{w0} \]
                    3. Applied egg-rr74.7%

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

                    if 1.99999999999999991e171 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d))

                    1. Initial program 73.5%

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

                      \[\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. Step-by-step derivation
                      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(D \cdot D, \color{blue}{\frac{h \cdot -0.125}{d} \cdot \frac{M \cdot \left(M \cdot w0\right)}{d \cdot \ell}}, w0\right) \]
                  5. Recombined 2 regimes into one program.
                  6. Final simplification74.2%

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

                  Alternative 12: 72.4% accurate, 2.0× speedup?

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

                    1. Initial program 83.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. Simplified74.4%

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

                          \[\leadsto \color{blue}{w0} \]
                      3. Applied egg-rr74.4%

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

                      if 1e173 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d))

                      1. Initial program 76.3%

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

                        \[\leadsto \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. Simplified63.5%

                        \[\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. Step-by-step derivation
                        1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 13: 72.0% accurate, 2.0× speedup?

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

                      1. Initial program 83.5%

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

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

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

                            \[\leadsto \color{blue}{w0} \]
                        3. Applied egg-rr73.8%

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

                        if 5.00000000000000036e190 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d))

                        1. Initial program 78.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. Simplified69.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      Alternative 14: 74.6% accurate, 2.1× speedup?

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

                        1. Initial program 85.5%

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

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

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

                              \[\leadsto \color{blue}{w0} \]
                          3. Applied egg-rr74.2%

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

                          if 4.90000000000000021e-54 < D

                          1. Initial program 76.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        Alternative 15: 67.8% 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 83.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. Simplified67.8%

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

                              \[\leadsto \color{blue}{w0} \]
                          3. Applied egg-rr67.8%

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

                          Reproduce

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