Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.1% → 89.2%
Time: 14.5s
Alternatives: 15
Speedup: 1.4×

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.1% accurate, 1.0× speedup?

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

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

Alternative 1: 89.2% accurate, 1.2× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ \begin{array}{l} t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d\_m}\\ \mathbf{if}\;t\_0 \leq 10^{-151}:\\ \;\;\;\;w0\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+257}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0, \frac{M\_m \cdot D\_m}{d\_m \cdot -2} \cdot \frac{h}{\ell}, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\left|M\_m\right| \cdot \left(D\_m \cdot \left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}}\right)\right)\\ \end{array} \end{array} \]
d_m = (fabs.f64 d)
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
(FPCore (w0 M_m D_m h l d_m)
 :precision binary64
 (let* ((t_0 (/ (* M_m D_m) (* 2.0 d_m))))
   (if (<= t_0 1e-151)
     w0
     (if (<= t_0 5e+257)
       (* w0 (sqrt (fma t_0 (* (/ (* M_m D_m) (* d_m -2.0)) (/ h l)) 1.0)))
       (*
        (fabs M_m)
        (* D_m (* w0 (sqrt (/ (* h -0.25) (* d_m (* d_m l)))))))))))
d_m = fabs(d);
D_m = fabs(D);
M_m = fabs(M);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
	double t_0 = (M_m * D_m) / (2.0 * d_m);
	double tmp;
	if (t_0 <= 1e-151) {
		tmp = w0;
	} else if (t_0 <= 5e+257) {
		tmp = w0 * sqrt(fma(t_0, (((M_m * D_m) / (d_m * -2.0)) * (h / l)), 1.0));
	} else {
		tmp = fabs(M_m) * (D_m * (w0 * sqrt(((h * -0.25) / (d_m * (d_m * l))))));
	}
	return tmp;
}
d_m = abs(d)
D_m = abs(D)
M_m = abs(M)
function code(w0, M_m, D_m, h, l, d_m)
	t_0 = Float64(Float64(M_m * D_m) / Float64(2.0 * d_m))
	tmp = 0.0
	if (t_0 <= 1e-151)
		tmp = w0;
	elseif (t_0 <= 5e+257)
		tmp = Float64(w0 * sqrt(fma(t_0, Float64(Float64(Float64(M_m * D_m) / Float64(d_m * -2.0)) * Float64(h / l)), 1.0)));
	else
		tmp = Float64(abs(M_m) * Float64(D_m * Float64(w0 * sqrt(Float64(Float64(h * -0.25) / Float64(d_m * Float64(d_m * l)))))));
	end
	return tmp
end
d_m = N[Abs[d], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e-151], w0, If[LessEqual[t$95$0, 5e+257], N[(w0 * N[Sqrt[N[(t$95$0 * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d$95$m * -2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[M$95$m], $MachinePrecision] * N[(D$95$m * N[(w0 * N[Sqrt[N[(N[(h * -0.25), $MachinePrecision] / N[(d$95$m * N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|
\\
D_m = \left|D\right|
\\
M_m = \left|M\right|

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

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

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


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

    1. Initial program 85.4%

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

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

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

          \[\leadsto \color{blue}{w0} \]
      3. Applied rewrites80.6%

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

      if 9.9999999999999994e-152 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 5.00000000000000028e257

      1. Initial program 92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 58.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 inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 71.1% accurate, 0.7× speedup?

    \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}} \leq 4 \cdot 10^{+270}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \mathsf{fma}\left(D\_m \cdot D\_m, \left(M\_m \cdot \left(M\_m \cdot h\right)\right) \cdot \frac{-0.125}{d\_m \cdot \left(d\_m \cdot \ell\right)}, 1\right)\\ \end{array} \end{array} \]
    d_m = (fabs.f64 d)
    D_m = (fabs.f64 D)
    M_m = (fabs.f64 M)
    (FPCore (w0 M_m D_m h l d_m)
     :precision binary64
     (if (<=
          (* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0)))))
          4e+270)
       w0
       (*
        w0
        (fma (* D_m D_m) (* (* M_m (* M_m h)) (/ -0.125 (* d_m (* d_m l)))) 1.0))))
    d_m = fabs(d);
    D_m = fabs(D);
    M_m = fabs(M);
    double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
    	double tmp;
    	if ((w0 * sqrt((1.0 - ((h / l) * pow(((M_m * D_m) / (2.0 * d_m)), 2.0))))) <= 4e+270) {
    		tmp = w0;
    	} else {
    		tmp = w0 * fma((D_m * D_m), ((M_m * (M_m * h)) * (-0.125 / (d_m * (d_m * l)))), 1.0);
    	}
    	return tmp;
    }
    
    d_m = abs(d)
    D_m = abs(D)
    M_m = abs(M)
    function code(w0, M_m, D_m, h, l, d_m)
    	tmp = 0.0
    	if (Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0))))) <= 4e+270)
    		tmp = w0;
    	else
    		tmp = Float64(w0 * fma(Float64(D_m * D_m), Float64(Float64(M_m * Float64(M_m * h)) * Float64(-0.125 / Float64(d_m * Float64(d_m * l)))), 1.0));
    	end
    	return tmp
    end
    
    d_m = N[Abs[d], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    M_m = N[Abs[M], $MachinePrecision]
    code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 4e+270], w0, N[(w0 * N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(M$95$m * N[(M$95$m * h), $MachinePrecision]), $MachinePrecision] * N[(-0.125 / N[(d$95$m * N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    d_m = \left|d\right|
    \\
    D_m = \left|D\right|
    \\
    M_m = \left|M\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}} \leq 4 \cdot 10^{+270}:\\
    \;\;\;\;w0\\
    
    \mathbf{else}:\\
    \;\;\;\;w0 \cdot \mathsf{fma}\left(D\_m \cdot D\_m, \left(M\_m \cdot \left(M\_m \cdot h\right)\right) \cdot \frac{-0.125}{d\_m \cdot \left(d\_m \cdot \ell\right)}, 1\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 w0 (sqrt.f64 (-.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))))) < 4.0000000000000002e270

      1. Initial program 96.1%

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

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

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

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

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

        if 4.0000000000000002e270 < (*.f64 w0 (sqrt.f64 (-.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 40.6%

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

          \[\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-*.f6470.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. Applied rewrites70.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)} \]
        8. Taylor expanded in M around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 86.4% accurate, 0.8× speedup?

      \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \leq -40000:\\ \;\;\;\;w0 \cdot \left(\left|M\_m \cdot D\_m\right| \cdot \sqrt{-0.25 \cdot \frac{\frac{h}{d\_m \cdot \ell}}{d\_m}}\right)\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
      d_m = (fabs.f64 d)
      D_m = (fabs.f64 D)
      M_m = (fabs.f64 M)
      (FPCore (w0 M_m D_m h l d_m)
       :precision binary64
       (if (<= (* (/ h l) (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0)) -40000.0)
         (* w0 (* (fabs (* M_m D_m)) (sqrt (* -0.25 (/ (/ h (* d_m l)) d_m)))))
         w0))
      d_m = fabs(d);
      D_m = fabs(D);
      M_m = fabs(M);
      double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
      	double tmp;
      	if (((h / l) * pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) <= -40000.0) {
      		tmp = w0 * (fabs((M_m * D_m)) * sqrt((-0.25 * ((h / (d_m * l)) / d_m))));
      	} else {
      		tmp = w0;
      	}
      	return tmp;
      }
      
      d_m = abs(d)
      D_m = abs(d)
      M_m = abs(m)
      real(8) function code(w0, m_m, d_m, h, l, d_m_1)
          real(8), intent (in) :: w0
          real(8), intent (in) :: m_m
          real(8), intent (in) :: d_m
          real(8), intent (in) :: h
          real(8), intent (in) :: l
          real(8), intent (in) :: d_m_1
          real(8) :: tmp
          if (((h / l) * (((m_m * d_m) / (2.0d0 * d_m_1)) ** 2.0d0)) <= (-40000.0d0)) then
              tmp = w0 * (abs((m_m * d_m)) * sqrt(((-0.25d0) * ((h / (d_m_1 * l)) / d_m_1))))
          else
              tmp = w0
          end if
          code = tmp
      end function
      
      d_m = Math.abs(d);
      D_m = Math.abs(D);
      M_m = Math.abs(M);
      public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
      	double tmp;
      	if (((h / l) * Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) <= -40000.0) {
      		tmp = w0 * (Math.abs((M_m * D_m)) * Math.sqrt((-0.25 * ((h / (d_m * l)) / d_m))));
      	} else {
      		tmp = w0;
      	}
      	return tmp;
      }
      
      d_m = math.fabs(d)
      D_m = math.fabs(D)
      M_m = math.fabs(M)
      def code(w0, M_m, D_m, h, l, d_m):
      	tmp = 0
      	if ((h / l) * math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) <= -40000.0:
      		tmp = w0 * (math.fabs((M_m * D_m)) * math.sqrt((-0.25 * ((h / (d_m * l)) / d_m))))
      	else:
      		tmp = w0
      	return tmp
      
      d_m = abs(d)
      D_m = abs(D)
      M_m = abs(M)
      function code(w0, M_m, D_m, h, l, d_m)
      	tmp = 0.0
      	if (Float64(Float64(h / l) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0)) <= -40000.0)
      		tmp = Float64(w0 * Float64(abs(Float64(M_m * D_m)) * sqrt(Float64(-0.25 * Float64(Float64(h / Float64(d_m * l)) / d_m)))));
      	else
      		tmp = w0;
      	end
      	return tmp
      end
      
      d_m = abs(d);
      D_m = abs(D);
      M_m = abs(M);
      function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
      	tmp = 0.0;
      	if (((h / l) * (((M_m * D_m) / (2.0 * d_m)) ^ 2.0)) <= -40000.0)
      		tmp = w0 * (abs((M_m * D_m)) * sqrt((-0.25 * ((h / (d_m * l)) / d_m))));
      	else
      		tmp = w0;
      	end
      	tmp_2 = tmp;
      end
      
      d_m = N[Abs[d], $MachinePrecision]
      D_m = N[Abs[D], $MachinePrecision]
      M_m = N[Abs[M], $MachinePrecision]
      code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], -40000.0], N[(w0 * N[(N[Abs[N[(M$95$m * D$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(-0.25 * N[(N[(h / N[(d$95$m * l), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
      
      \begin{array}{l}
      d_m = \left|d\right|
      \\
      D_m = \left|D\right|
      \\
      M_m = \left|M\right|
      
      \\
      \begin{array}{l}
      \mathbf{if}\;\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \leq -40000:\\
      \;\;\;\;w0 \cdot \left(\left|M\_m \cdot D\_m\right| \cdot \sqrt{-0.25 \cdot \frac{\frac{h}{d\_m \cdot \ell}}{d\_m}}\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)) < -4e4

        1. Initial program 77.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(\left|M \cdot D\right| \cdot \sqrt{-0.25 \cdot \frac{\color{blue}{\frac{h}{d \cdot \ell}}}{d}}\right) \cdot w0 \]
        11. Applied rewrites75.3%

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

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

        1. Initial program 86.1%

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

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

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

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

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

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

        Alternative 4: 81.4% accurate, 0.8× speedup?

        \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;1 - \frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \leq 2:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;\left|M\_m\right| \cdot \left(D\_m \cdot \left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}}\right)\right)\\ \end{array} \end{array} \]
        d_m = (fabs.f64 d)
        D_m = (fabs.f64 D)
        M_m = (fabs.f64 M)
        (FPCore (w0 M_m D_m h l d_m)
         :precision binary64
         (if (<= (- 1.0 (* (/ h l) (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0))) 2.0)
           w0
           (* (fabs M_m) (* D_m (* w0 (sqrt (/ (* h -0.25) (* d_m (* d_m l)))))))))
        d_m = fabs(d);
        D_m = fabs(D);
        M_m = fabs(M);
        double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
        	double tmp;
        	if ((1.0 - ((h / l) * pow(((M_m * D_m) / (2.0 * d_m)), 2.0))) <= 2.0) {
        		tmp = w0;
        	} else {
        		tmp = fabs(M_m) * (D_m * (w0 * sqrt(((h * -0.25) / (d_m * (d_m * l))))));
        	}
        	return tmp;
        }
        
        d_m = abs(d)
        D_m = abs(d)
        M_m = abs(m)
        real(8) function code(w0, m_m, d_m, h, l, d_m_1)
            real(8), intent (in) :: w0
            real(8), intent (in) :: m_m
            real(8), intent (in) :: d_m
            real(8), intent (in) :: h
            real(8), intent (in) :: l
            real(8), intent (in) :: d_m_1
            real(8) :: tmp
            if ((1.0d0 - ((h / l) * (((m_m * d_m) / (2.0d0 * d_m_1)) ** 2.0d0))) <= 2.0d0) then
                tmp = w0
            else
                tmp = abs(m_m) * (d_m * (w0 * sqrt(((h * (-0.25d0)) / (d_m_1 * (d_m_1 * l))))))
            end if
            code = tmp
        end function
        
        d_m = Math.abs(d);
        D_m = Math.abs(D);
        M_m = Math.abs(M);
        public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
        	double tmp;
        	if ((1.0 - ((h / l) * Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0))) <= 2.0) {
        		tmp = w0;
        	} else {
        		tmp = Math.abs(M_m) * (D_m * (w0 * Math.sqrt(((h * -0.25) / (d_m * (d_m * l))))));
        	}
        	return tmp;
        }
        
        d_m = math.fabs(d)
        D_m = math.fabs(D)
        M_m = math.fabs(M)
        def code(w0, M_m, D_m, h, l, d_m):
        	tmp = 0
        	if (1.0 - ((h / l) * math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0))) <= 2.0:
        		tmp = w0
        	else:
        		tmp = math.fabs(M_m) * (D_m * (w0 * math.sqrt(((h * -0.25) / (d_m * (d_m * l))))))
        	return tmp
        
        d_m = abs(d)
        D_m = abs(D)
        M_m = abs(M)
        function code(w0, M_m, D_m, h, l, d_m)
        	tmp = 0.0
        	if (Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0))) <= 2.0)
        		tmp = w0;
        	else
        		tmp = Float64(abs(M_m) * Float64(D_m * Float64(w0 * sqrt(Float64(Float64(h * -0.25) / Float64(d_m * Float64(d_m * l)))))));
        	end
        	return tmp
        end
        
        d_m = abs(d);
        D_m = abs(D);
        M_m = abs(M);
        function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
        	tmp = 0.0;
        	if ((1.0 - ((h / l) * (((M_m * D_m) / (2.0 * d_m)) ^ 2.0))) <= 2.0)
        		tmp = w0;
        	else
        		tmp = abs(M_m) * (D_m * (w0 * sqrt(((h * -0.25) / (d_m * (d_m * l))))));
        	end
        	tmp_2 = tmp;
        end
        
        d_m = N[Abs[d], $MachinePrecision]
        D_m = N[Abs[D], $MachinePrecision]
        M_m = N[Abs[M], $MachinePrecision]
        code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], w0, N[(N[Abs[M$95$m], $MachinePrecision] * N[(D$95$m * N[(w0 * N[Sqrt[N[(N[(h * -0.25), $MachinePrecision] / N[(d$95$m * N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        d_m = \left|d\right|
        \\
        D_m = \left|D\right|
        \\
        M_m = \left|M\right|
        
        \\
        \begin{array}{l}
        \mathbf{if}\;1 - \frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \leq 2:\\
        \;\;\;\;w0\\
        
        \mathbf{else}:\\
        \;\;\;\;\left|M\_m\right| \cdot \left(D\_m \cdot \left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}}\right)\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))) < 2

          1. Initial program 100.0%

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

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

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

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

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

            if 2 < (-.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 54.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 inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 5: 85.2% accurate, 0.8× speedup?

          \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \leq -40000:\\ \;\;\;\;\left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}}\right) \cdot \left|M\_m \cdot D\_m\right|\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
          d_m = (fabs.f64 d)
          D_m = (fabs.f64 D)
          M_m = (fabs.f64 M)
          (FPCore (w0 M_m D_m h l d_m)
           :precision binary64
           (if (<= (* (/ h l) (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0)) -40000.0)
             (* (* w0 (sqrt (/ (* h -0.25) (* d_m (* d_m l))))) (fabs (* M_m D_m)))
             w0))
          d_m = fabs(d);
          D_m = fabs(D);
          M_m = fabs(M);
          double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
          	double tmp;
          	if (((h / l) * pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) <= -40000.0) {
          		tmp = (w0 * sqrt(((h * -0.25) / (d_m * (d_m * l))))) * fabs((M_m * D_m));
          	} else {
          		tmp = w0;
          	}
          	return tmp;
          }
          
          d_m = abs(d)
          D_m = abs(d)
          M_m = abs(m)
          real(8) function code(w0, m_m, d_m, h, l, d_m_1)
              real(8), intent (in) :: w0
              real(8), intent (in) :: m_m
              real(8), intent (in) :: d_m
              real(8), intent (in) :: h
              real(8), intent (in) :: l
              real(8), intent (in) :: d_m_1
              real(8) :: tmp
              if (((h / l) * (((m_m * d_m) / (2.0d0 * d_m_1)) ** 2.0d0)) <= (-40000.0d0)) then
                  tmp = (w0 * sqrt(((h * (-0.25d0)) / (d_m_1 * (d_m_1 * l))))) * abs((m_m * d_m))
              else
                  tmp = w0
              end if
              code = tmp
          end function
          
          d_m = Math.abs(d);
          D_m = Math.abs(D);
          M_m = Math.abs(M);
          public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
          	double tmp;
          	if (((h / l) * Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) <= -40000.0) {
          		tmp = (w0 * Math.sqrt(((h * -0.25) / (d_m * (d_m * l))))) * Math.abs((M_m * D_m));
          	} else {
          		tmp = w0;
          	}
          	return tmp;
          }
          
          d_m = math.fabs(d)
          D_m = math.fabs(D)
          M_m = math.fabs(M)
          def code(w0, M_m, D_m, h, l, d_m):
          	tmp = 0
          	if ((h / l) * math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) <= -40000.0:
          		tmp = (w0 * math.sqrt(((h * -0.25) / (d_m * (d_m * l))))) * math.fabs((M_m * D_m))
          	else:
          		tmp = w0
          	return tmp
          
          d_m = abs(d)
          D_m = abs(D)
          M_m = abs(M)
          function code(w0, M_m, D_m, h, l, d_m)
          	tmp = 0.0
          	if (Float64(Float64(h / l) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0)) <= -40000.0)
          		tmp = Float64(Float64(w0 * sqrt(Float64(Float64(h * -0.25) / Float64(d_m * Float64(d_m * l))))) * abs(Float64(M_m * D_m)));
          	else
          		tmp = w0;
          	end
          	return tmp
          end
          
          d_m = abs(d);
          D_m = abs(D);
          M_m = abs(M);
          function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
          	tmp = 0.0;
          	if (((h / l) * (((M_m * D_m) / (2.0 * d_m)) ^ 2.0)) <= -40000.0)
          		tmp = (w0 * sqrt(((h * -0.25) / (d_m * (d_m * l))))) * abs((M_m * D_m));
          	else
          		tmp = w0;
          	end
          	tmp_2 = tmp;
          end
          
          d_m = N[Abs[d], $MachinePrecision]
          D_m = N[Abs[D], $MachinePrecision]
          M_m = N[Abs[M], $MachinePrecision]
          code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], -40000.0], N[(N[(w0 * N[Sqrt[N[(N[(h * -0.25), $MachinePrecision] / N[(d$95$m * N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[N[(M$95$m * D$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
          
          \begin{array}{l}
          d_m = \left|d\right|
          \\
          D_m = \left|D\right|
          \\
          M_m = \left|M\right|
          
          \\
          \begin{array}{l}
          \mathbf{if}\;\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \leq -40000:\\
          \;\;\;\;\left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}}\right) \cdot \left|M\_m \cdot D\_m\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)) < -4e4

            1. Initial program 77.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            1. Initial program 86.1%

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

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

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

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

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

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

            Alternative 6: 85.2% accurate, 0.8× speedup?

            \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \leq -40000:\\ \;\;\;\;\sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}} \cdot \left(w0 \cdot \left|M\_m \cdot D\_m\right|\right)\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
            d_m = (fabs.f64 d)
            D_m = (fabs.f64 D)
            M_m = (fabs.f64 M)
            (FPCore (w0 M_m D_m h l d_m)
             :precision binary64
             (if (<= (* (/ h l) (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0)) -40000.0)
               (* (sqrt (/ (* h -0.25) (* d_m (* d_m l)))) (* w0 (fabs (* M_m D_m))))
               w0))
            d_m = fabs(d);
            D_m = fabs(D);
            M_m = fabs(M);
            double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
            	double tmp;
            	if (((h / l) * pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) <= -40000.0) {
            		tmp = sqrt(((h * -0.25) / (d_m * (d_m * l)))) * (w0 * fabs((M_m * D_m)));
            	} else {
            		tmp = w0;
            	}
            	return tmp;
            }
            
            d_m = abs(d)
            D_m = abs(d)
            M_m = abs(m)
            real(8) function code(w0, m_m, d_m, h, l, d_m_1)
                real(8), intent (in) :: w0
                real(8), intent (in) :: m_m
                real(8), intent (in) :: d_m
                real(8), intent (in) :: h
                real(8), intent (in) :: l
                real(8), intent (in) :: d_m_1
                real(8) :: tmp
                if (((h / l) * (((m_m * d_m) / (2.0d0 * d_m_1)) ** 2.0d0)) <= (-40000.0d0)) then
                    tmp = sqrt(((h * (-0.25d0)) / (d_m_1 * (d_m_1 * l)))) * (w0 * abs((m_m * d_m)))
                else
                    tmp = w0
                end if
                code = tmp
            end function
            
            d_m = Math.abs(d);
            D_m = Math.abs(D);
            M_m = Math.abs(M);
            public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
            	double tmp;
            	if (((h / l) * Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) <= -40000.0) {
            		tmp = Math.sqrt(((h * -0.25) / (d_m * (d_m * l)))) * (w0 * Math.abs((M_m * D_m)));
            	} else {
            		tmp = w0;
            	}
            	return tmp;
            }
            
            d_m = math.fabs(d)
            D_m = math.fabs(D)
            M_m = math.fabs(M)
            def code(w0, M_m, D_m, h, l, d_m):
            	tmp = 0
            	if ((h / l) * math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) <= -40000.0:
            		tmp = math.sqrt(((h * -0.25) / (d_m * (d_m * l)))) * (w0 * math.fabs((M_m * D_m)))
            	else:
            		tmp = w0
            	return tmp
            
            d_m = abs(d)
            D_m = abs(D)
            M_m = abs(M)
            function code(w0, M_m, D_m, h, l, d_m)
            	tmp = 0.0
            	if (Float64(Float64(h / l) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0)) <= -40000.0)
            		tmp = Float64(sqrt(Float64(Float64(h * -0.25) / Float64(d_m * Float64(d_m * l)))) * Float64(w0 * abs(Float64(M_m * D_m))));
            	else
            		tmp = w0;
            	end
            	return tmp
            end
            
            d_m = abs(d);
            D_m = abs(D);
            M_m = abs(M);
            function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
            	tmp = 0.0;
            	if (((h / l) * (((M_m * D_m) / (2.0 * d_m)) ^ 2.0)) <= -40000.0)
            		tmp = sqrt(((h * -0.25) / (d_m * (d_m * l)))) * (w0 * abs((M_m * D_m)));
            	else
            		tmp = w0;
            	end
            	tmp_2 = tmp;
            end
            
            d_m = N[Abs[d], $MachinePrecision]
            D_m = N[Abs[D], $MachinePrecision]
            M_m = N[Abs[M], $MachinePrecision]
            code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], -40000.0], N[(N[Sqrt[N[(N[(h * -0.25), $MachinePrecision] / N[(d$95$m * N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(w0 * N[Abs[N[(M$95$m * D$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
            
            \begin{array}{l}
            d_m = \left|d\right|
            \\
            D_m = \left|D\right|
            \\
            M_m = \left|M\right|
            
            \\
            \begin{array}{l}
            \mathbf{if}\;\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \leq -40000:\\
            \;\;\;\;\sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}} \cdot \left(w0 \cdot \left|M\_m \cdot D\_m\right|\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;w0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4e4

              1. Initial program 77.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 86.1%

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

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

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

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

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

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

              Alternative 7: 87.1% accurate, 1.2× speedup?

              \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ \begin{array}{l} t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d\_m}\\ \mathbf{if}\;t\_0 \leq 10^{-117}:\\ \;\;\;\;w0\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+257}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0, \frac{-0.5 \cdot \left(\left(M\_m \cdot D\_m\right) \cdot h\right)}{d\_m \cdot \ell}, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\left|M\_m\right| \cdot \left(D\_m \cdot \left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}}\right)\right)\\ \end{array} \end{array} \]
              d_m = (fabs.f64 d)
              D_m = (fabs.f64 D)
              M_m = (fabs.f64 M)
              (FPCore (w0 M_m D_m h l d_m)
               :precision binary64
               (let* ((t_0 (/ (* M_m D_m) (* 2.0 d_m))))
                 (if (<= t_0 1e-117)
                   w0
                   (if (<= t_0 5e+257)
                     (* w0 (sqrt (fma t_0 (/ (* -0.5 (* (* M_m D_m) h)) (* d_m l)) 1.0)))
                     (*
                      (fabs M_m)
                      (* D_m (* w0 (sqrt (/ (* h -0.25) (* d_m (* d_m l)))))))))))
              d_m = fabs(d);
              D_m = fabs(D);
              M_m = fabs(M);
              double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
              	double t_0 = (M_m * D_m) / (2.0 * d_m);
              	double tmp;
              	if (t_0 <= 1e-117) {
              		tmp = w0;
              	} else if (t_0 <= 5e+257) {
              		tmp = w0 * sqrt(fma(t_0, ((-0.5 * ((M_m * D_m) * h)) / (d_m * l)), 1.0));
              	} else {
              		tmp = fabs(M_m) * (D_m * (w0 * sqrt(((h * -0.25) / (d_m * (d_m * l))))));
              	}
              	return tmp;
              }
              
              d_m = abs(d)
              D_m = abs(D)
              M_m = abs(M)
              function code(w0, M_m, D_m, h, l, d_m)
              	t_0 = Float64(Float64(M_m * D_m) / Float64(2.0 * d_m))
              	tmp = 0.0
              	if (t_0 <= 1e-117)
              		tmp = w0;
              	elseif (t_0 <= 5e+257)
              		tmp = Float64(w0 * sqrt(fma(t_0, Float64(Float64(-0.5 * Float64(Float64(M_m * D_m) * h)) / Float64(d_m * l)), 1.0)));
              	else
              		tmp = Float64(abs(M_m) * Float64(D_m * Float64(w0 * sqrt(Float64(Float64(h * -0.25) / Float64(d_m * Float64(d_m * l)))))));
              	end
              	return tmp
              end
              
              d_m = N[Abs[d], $MachinePrecision]
              D_m = N[Abs[D], $MachinePrecision]
              M_m = N[Abs[M], $MachinePrecision]
              code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e-117], w0, If[LessEqual[t$95$0, 5e+257], N[(w0 * N[Sqrt[N[(t$95$0 * N[(N[(-0.5 * N[(N[(M$95$m * D$95$m), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / N[(d$95$m * l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[M$95$m], $MachinePrecision] * N[(D$95$m * N[(w0 * N[Sqrt[N[(N[(h * -0.25), $MachinePrecision] / N[(d$95$m * N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
              
              \begin{array}{l}
              d_m = \left|d\right|
              \\
              D_m = \left|D\right|
              \\
              M_m = \left|M\right|
              
              \\
              \begin{array}{l}
              t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d\_m}\\
              \mathbf{if}\;t\_0 \leq 10^{-117}:\\
              \;\;\;\;w0\\
              
              \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+257}:\\
              \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0, \frac{-0.5 \cdot \left(\left(M\_m \cdot D\_m\right) \cdot h\right)}{d\_m \cdot \ell}, 1\right)}\\
              
              \mathbf{else}:\\
              \;\;\;\;\left|M\_m\right| \cdot \left(D\_m \cdot \left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}}\right)\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 1.00000000000000003e-117

                1. Initial program 85.7%

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

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

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

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

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

                  if 1.00000000000000003e-117 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 5.00000000000000028e257

                  1. Initial program 91.0%

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

                      \[\leadsto w0 \cdot \sqrt{1 - {\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 rewrites96.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-*.f6494.2

                      \[\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. Applied rewrites94.2%

                    \[\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)} \]

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

                  1. Initial program 58.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 inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\left|M\right| \cdot \left(D \cdot \left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d \cdot \left(d \cdot \ell\right)}}\right)\right)} \]
                5. Recombined 3 regimes into one program.
                6. Final simplification80.0%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{M \cdot D}{2 \cdot d} \leq 10^{-117}:\\ \;\;\;\;w0\\ \mathbf{elif}\;\frac{M \cdot D}{2 \cdot d} \leq 5 \cdot 10^{+257}:\\ \;\;\;\;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)}\\ \mathbf{else}:\\ \;\;\;\;\left|M\right| \cdot \left(D \cdot \left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d \cdot \left(d \cdot \ell\right)}}\right)\right)\\ \end{array} \]
                7. Add Preprocessing

                Alternative 8: 81.6% accurate, 1.3× speedup?

                \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ \begin{array}{l} t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d\_m}\\ \mathbf{if}\;t\_0 \leq 5 \cdot 10^{-74}:\\ \;\;\;\;w0\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+257}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{\left(M\_m \cdot D\_m\right) \cdot \left(M\_m \cdot 0.25\right)}{d\_m}, \frac{D\_m \cdot h}{-d\_m \cdot \ell}, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\left|M\_m\right| \cdot \left(D\_m \cdot \left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}}\right)\right)\\ \end{array} \end{array} \]
                d_m = (fabs.f64 d)
                D_m = (fabs.f64 D)
                M_m = (fabs.f64 M)
                (FPCore (w0 M_m D_m h l d_m)
                 :precision binary64
                 (let* ((t_0 (/ (* M_m D_m) (* 2.0 d_m))))
                   (if (<= t_0 5e-74)
                     w0
                     (if (<= t_0 5e+257)
                       (*
                        w0
                        (sqrt
                         (fma
                          (/ (* (* M_m D_m) (* M_m 0.25)) d_m)
                          (/ (* D_m h) (- (* d_m l)))
                          1.0)))
                       (*
                        (fabs M_m)
                        (* D_m (* w0 (sqrt (/ (* h -0.25) (* d_m (* d_m l)))))))))))
                d_m = fabs(d);
                D_m = fabs(D);
                M_m = fabs(M);
                double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
                	double t_0 = (M_m * D_m) / (2.0 * d_m);
                	double tmp;
                	if (t_0 <= 5e-74) {
                		tmp = w0;
                	} else if (t_0 <= 5e+257) {
                		tmp = w0 * sqrt(fma((((M_m * D_m) * (M_m * 0.25)) / d_m), ((D_m * h) / -(d_m * l)), 1.0));
                	} else {
                		tmp = fabs(M_m) * (D_m * (w0 * sqrt(((h * -0.25) / (d_m * (d_m * l))))));
                	}
                	return tmp;
                }
                
                d_m = abs(d)
                D_m = abs(D)
                M_m = abs(M)
                function code(w0, M_m, D_m, h, l, d_m)
                	t_0 = Float64(Float64(M_m * D_m) / Float64(2.0 * d_m))
                	tmp = 0.0
                	if (t_0 <= 5e-74)
                		tmp = w0;
                	elseif (t_0 <= 5e+257)
                		tmp = Float64(w0 * sqrt(fma(Float64(Float64(Float64(M_m * D_m) * Float64(M_m * 0.25)) / d_m), Float64(Float64(D_m * h) / Float64(-Float64(d_m * l))), 1.0)));
                	else
                		tmp = Float64(abs(M_m) * Float64(D_m * Float64(w0 * sqrt(Float64(Float64(h * -0.25) / Float64(d_m * Float64(d_m * l)))))));
                	end
                	return tmp
                end
                
                d_m = N[Abs[d], $MachinePrecision]
                D_m = N[Abs[D], $MachinePrecision]
                M_m = N[Abs[M], $MachinePrecision]
                code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e-74], w0, If[LessEqual[t$95$0, 5e+257], N[(w0 * N[Sqrt[N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(M$95$m * 0.25), $MachinePrecision]), $MachinePrecision] / d$95$m), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] / (-N[(d$95$m * l), $MachinePrecision])), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[M$95$m], $MachinePrecision] * N[(D$95$m * N[(w0 * N[Sqrt[N[(N[(h * -0.25), $MachinePrecision] / N[(d$95$m * N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
                
                \begin{array}{l}
                d_m = \left|d\right|
                \\
                D_m = \left|D\right|
                \\
                M_m = \left|M\right|
                
                \\
                \begin{array}{l}
                t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d\_m}\\
                \mathbf{if}\;t\_0 \leq 5 \cdot 10^{-74}:\\
                \;\;\;\;w0\\
                
                \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+257}:\\
                \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{\left(M\_m \cdot D\_m\right) \cdot \left(M\_m \cdot 0.25\right)}{d\_m}, \frac{D\_m \cdot h}{-d\_m \cdot \ell}, 1\right)}\\
                
                \mathbf{else}:\\
                \;\;\;\;\left|M\_m\right| \cdot \left(D\_m \cdot \left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}}\right)\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 4.99999999999999998e-74

                  1. Initial program 85.9%

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

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

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

                        \[\leadsto \color{blue}{w0} \]
                    3. Applied rewrites80.8%

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

                    if 4.99999999999999998e-74 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 5.00000000000000028e257

                    1. Initial program 90.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    1. Initial program 58.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 inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 9: 79.8% accurate, 1.3× speedup?

                  \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ \begin{array}{l} t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d\_m}\\ \mathbf{if}\;t\_0 \leq 10^{-104}:\\ \;\;\;\;w0\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+217}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{D\_m}{d\_m} \cdot \left(0.25 \cdot \left(M\_m \cdot M\_m\right)\right), -D\_m \cdot \frac{h}{d\_m \cdot \ell}, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\left|M\_m\right| \cdot \left(D\_m \cdot \left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}}\right)\right)\\ \end{array} \end{array} \]
                  d_m = (fabs.f64 d)
                  D_m = (fabs.f64 D)
                  M_m = (fabs.f64 M)
                  (FPCore (w0 M_m D_m h l d_m)
                   :precision binary64
                   (let* ((t_0 (/ (* M_m D_m) (* 2.0 d_m))))
                     (if (<= t_0 1e-104)
                       w0
                       (if (<= t_0 5e+217)
                         (*
                          w0
                          (sqrt
                           (fma
                            (* (/ D_m d_m) (* 0.25 (* M_m M_m)))
                            (- (* D_m (/ h (* d_m l))))
                            1.0)))
                         (*
                          (fabs M_m)
                          (* D_m (* w0 (sqrt (/ (* h -0.25) (* d_m (* d_m l)))))))))))
                  d_m = fabs(d);
                  D_m = fabs(D);
                  M_m = fabs(M);
                  double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
                  	double t_0 = (M_m * D_m) / (2.0 * d_m);
                  	double tmp;
                  	if (t_0 <= 1e-104) {
                  		tmp = w0;
                  	} else if (t_0 <= 5e+217) {
                  		tmp = w0 * sqrt(fma(((D_m / d_m) * (0.25 * (M_m * M_m))), -(D_m * (h / (d_m * l))), 1.0));
                  	} else {
                  		tmp = fabs(M_m) * (D_m * (w0 * sqrt(((h * -0.25) / (d_m * (d_m * l))))));
                  	}
                  	return tmp;
                  }
                  
                  d_m = abs(d)
                  D_m = abs(D)
                  M_m = abs(M)
                  function code(w0, M_m, D_m, h, l, d_m)
                  	t_0 = Float64(Float64(M_m * D_m) / Float64(2.0 * d_m))
                  	tmp = 0.0
                  	if (t_0 <= 1e-104)
                  		tmp = w0;
                  	elseif (t_0 <= 5e+217)
                  		tmp = Float64(w0 * sqrt(fma(Float64(Float64(D_m / d_m) * Float64(0.25 * Float64(M_m * M_m))), Float64(-Float64(D_m * Float64(h / Float64(d_m * l)))), 1.0)));
                  	else
                  		tmp = Float64(abs(M_m) * Float64(D_m * Float64(w0 * sqrt(Float64(Float64(h * -0.25) / Float64(d_m * Float64(d_m * l)))))));
                  	end
                  	return tmp
                  end
                  
                  d_m = N[Abs[d], $MachinePrecision]
                  D_m = N[Abs[D], $MachinePrecision]
                  M_m = N[Abs[M], $MachinePrecision]
                  code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e-104], w0, If[LessEqual[t$95$0, 5e+217], N[(w0 * N[Sqrt[N[(N[(N[(D$95$m / d$95$m), $MachinePrecision] * N[(0.25 * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-N[(D$95$m * N[(h / N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[M$95$m], $MachinePrecision] * N[(D$95$m * N[(w0 * N[Sqrt[N[(N[(h * -0.25), $MachinePrecision] / N[(d$95$m * N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
                  
                  \begin{array}{l}
                  d_m = \left|d\right|
                  \\
                  D_m = \left|D\right|
                  \\
                  M_m = \left|M\right|
                  
                  \\
                  \begin{array}{l}
                  t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d\_m}\\
                  \mathbf{if}\;t\_0 \leq 10^{-104}:\\
                  \;\;\;\;w0\\
                  
                  \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+217}:\\
                  \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{D\_m}{d\_m} \cdot \left(0.25 \cdot \left(M\_m \cdot M\_m\right)\right), -D\_m \cdot \frac{h}{d\_m \cdot \ell}, 1\right)}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\left|M\_m\right| \cdot \left(D\_m \cdot \left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}}\right)\right)\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 3 regimes
                  2. if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 9.99999999999999927e-105

                    1. Initial program 85.7%

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

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

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

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

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

                      if 9.99999999999999927e-105 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 5.00000000000000041e217

                      1. Initial program 93.8%

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

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

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

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

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

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

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

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

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

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

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

                      1. Initial program 55.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\left|M\right| \cdot \left(D \cdot \left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d \cdot \left(d \cdot \ell\right)}}\right)\right)} \]
                    5. Recombined 3 regimes into one program.
                    6. Final simplification77.7%

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

                    Alternative 10: 88.4% accurate, 1.4× speedup?

                    \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ \begin{array}{l} t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d\_m}\\ \mathbf{if}\;t\_0 \leq 5 \cdot 10^{+257}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0, \frac{\frac{\left(M\_m \cdot D\_m\right) \cdot h}{2 \cdot d\_m}}{-\ell}, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\left|M\_m\right| \cdot \left(D\_m \cdot \left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}}\right)\right)\\ \end{array} \end{array} \]
                    d_m = (fabs.f64 d)
                    D_m = (fabs.f64 D)
                    M_m = (fabs.f64 M)
                    (FPCore (w0 M_m D_m h l d_m)
                     :precision binary64
                     (let* ((t_0 (/ (* M_m D_m) (* 2.0 d_m))))
                       (if (<= t_0 5e+257)
                         (* w0 (sqrt (fma t_0 (/ (/ (* (* M_m D_m) h) (* 2.0 d_m)) (- l)) 1.0)))
                         (* (fabs M_m) (* D_m (* w0 (sqrt (/ (* h -0.25) (* d_m (* d_m l))))))))))
                    d_m = fabs(d);
                    D_m = fabs(D);
                    M_m = fabs(M);
                    double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
                    	double t_0 = (M_m * D_m) / (2.0 * d_m);
                    	double tmp;
                    	if (t_0 <= 5e+257) {
                    		tmp = w0 * sqrt(fma(t_0, ((((M_m * D_m) * h) / (2.0 * d_m)) / -l), 1.0));
                    	} else {
                    		tmp = fabs(M_m) * (D_m * (w0 * sqrt(((h * -0.25) / (d_m * (d_m * l))))));
                    	}
                    	return tmp;
                    }
                    
                    d_m = abs(d)
                    D_m = abs(D)
                    M_m = abs(M)
                    function code(w0, M_m, D_m, h, l, d_m)
                    	t_0 = Float64(Float64(M_m * D_m) / Float64(2.0 * d_m))
                    	tmp = 0.0
                    	if (t_0 <= 5e+257)
                    		tmp = Float64(w0 * sqrt(fma(t_0, Float64(Float64(Float64(Float64(M_m * D_m) * h) / Float64(2.0 * d_m)) / Float64(-l)), 1.0)));
                    	else
                    		tmp = Float64(abs(M_m) * Float64(D_m * Float64(w0 * sqrt(Float64(Float64(h * -0.25) / Float64(d_m * Float64(d_m * l)))))));
                    	end
                    	return tmp
                    end
                    
                    d_m = N[Abs[d], $MachinePrecision]
                    D_m = N[Abs[D], $MachinePrecision]
                    M_m = N[Abs[M], $MachinePrecision]
                    code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+257], N[(w0 * N[Sqrt[N[(t$95$0 * N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * h), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision] / (-l)), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[M$95$m], $MachinePrecision] * N[(D$95$m * N[(w0 * N[Sqrt[N[(N[(h * -0.25), $MachinePrecision] / N[(d$95$m * N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                    
                    \begin{array}{l}
                    d_m = \left|d\right|
                    \\
                    D_m = \left|D\right|
                    \\
                    M_m = \left|M\right|
                    
                    \\
                    \begin{array}{l}
                    t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d\_m}\\
                    \mathbf{if}\;t\_0 \leq 5 \cdot 10^{+257}:\\
                    \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0, \frac{\frac{\left(M\_m \cdot D\_m\right) \cdot h}{2 \cdot d\_m}}{-\ell}, 1\right)}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\left|M\_m\right| \cdot \left(D\_m \cdot \left(w0 \cdot \sqrt{\frac{h \cdot -0.25}{d\_m \cdot \left(d\_m \cdot \ell\right)}}\right)\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.00000000000000028e257

                      1. Initial program 86.5%

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

                        \[\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)}} \]

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

                      1. Initial program 58.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 inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 11: 76.5% accurate, 2.0× speedup?

                    \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 2 \cdot 10^{+176}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(D\_m \cdot D\_m, \frac{-0.125 \cdot \left(h \cdot \left(w0 \cdot \left(M\_m \cdot M\_m\right)\right)\right)}{d\_m \cdot \left(d\_m \cdot \ell\right)}, w0\right)\\ \end{array} \end{array} \]
                    d_m = (fabs.f64 d)
                    D_m = (fabs.f64 D)
                    M_m = (fabs.f64 M)
                    (FPCore (w0 M_m D_m h l d_m)
                     :precision binary64
                     (if (<= (/ (* M_m D_m) (* 2.0 d_m)) 2e+176)
                       w0
                       (fma
                        (* D_m D_m)
                        (/ (* -0.125 (* h (* w0 (* M_m M_m)))) (* d_m (* d_m l)))
                        w0)))
                    d_m = fabs(d);
                    D_m = fabs(D);
                    M_m = fabs(M);
                    double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
                    	double tmp;
                    	if (((M_m * D_m) / (2.0 * d_m)) <= 2e+176) {
                    		tmp = w0;
                    	} else {
                    		tmp = fma((D_m * D_m), ((-0.125 * (h * (w0 * (M_m * M_m)))) / (d_m * (d_m * l))), w0);
                    	}
                    	return tmp;
                    }
                    
                    d_m = abs(d)
                    D_m = abs(D)
                    M_m = abs(M)
                    function code(w0, M_m, D_m, h, l, d_m)
                    	tmp = 0.0
                    	if (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) <= 2e+176)
                    		tmp = w0;
                    	else
                    		tmp = fma(Float64(D_m * D_m), Float64(Float64(-0.125 * Float64(h * Float64(w0 * Float64(M_m * M_m)))) / Float64(d_m * Float64(d_m * l))), w0);
                    	end
                    	return tmp
                    end
                    
                    d_m = N[Abs[d], $MachinePrecision]
                    D_m = N[Abs[D], $MachinePrecision]
                    M_m = N[Abs[M], $MachinePrecision]
                    code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2e+176], w0, N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(-0.125 * N[(h * N[(w0 * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d$95$m * N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision]]
                    
                    \begin{array}{l}
                    d_m = \left|d\right|
                    \\
                    D_m = \left|D\right|
                    \\
                    M_m = \left|M\right|
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 2 \cdot 10^{+176}:\\
                    \;\;\;\;w0\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\mathsf{fma}\left(D\_m \cdot D\_m, \frac{-0.125 \cdot \left(h \cdot \left(w0 \cdot \left(M\_m \cdot M\_m\right)\right)\right)}{d\_m \cdot \left(d\_m \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)) < 2e176

                      1. Initial program 87.2%

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

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

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

                            \[\leadsto \color{blue}{w0} \]
                        3. Applied rewrites77.8%

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

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

                        1. Initial program 55.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 rewrites64.5%

                          \[\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-*.f6460.1

                            \[\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. Applied rewrites60.1%

                          \[\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)} \]
                        8. 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}} \]
                        9. 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)} \]
                        10. Applied rewrites51.4%

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

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

                      Alternative 12: 74.6% accurate, 2.0× speedup?

                      \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 5 \cdot 10^{+297}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(-0.125 \cdot \frac{\left(D\_m \cdot D\_m\right) \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)}{\ell \cdot \left(d\_m \cdot d\_m\right)}\right)\\ \end{array} \end{array} \]
                      d_m = (fabs.f64 d)
                      D_m = (fabs.f64 D)
                      M_m = (fabs.f64 M)
                      (FPCore (w0 M_m D_m h l d_m)
                       :precision binary64
                       (if (<= (/ (* M_m D_m) (* 2.0 d_m)) 5e+297)
                         w0
                         (* w0 (* -0.125 (/ (* (* D_m D_m) (* h (* M_m M_m))) (* l (* d_m d_m)))))))
                      d_m = fabs(d);
                      D_m = fabs(D);
                      M_m = fabs(M);
                      double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
                      	double tmp;
                      	if (((M_m * D_m) / (2.0 * d_m)) <= 5e+297) {
                      		tmp = w0;
                      	} else {
                      		tmp = w0 * (-0.125 * (((D_m * D_m) * (h * (M_m * M_m))) / (l * (d_m * d_m))));
                      	}
                      	return tmp;
                      }
                      
                      d_m = abs(d)
                      D_m = abs(d)
                      M_m = abs(m)
                      real(8) function code(w0, m_m, d_m, h, l, d_m_1)
                          real(8), intent (in) :: w0
                          real(8), intent (in) :: m_m
                          real(8), intent (in) :: d_m
                          real(8), intent (in) :: h
                          real(8), intent (in) :: l
                          real(8), intent (in) :: d_m_1
                          real(8) :: tmp
                          if (((m_m * d_m) / (2.0d0 * d_m_1)) <= 5d+297) then
                              tmp = w0
                          else
                              tmp = w0 * ((-0.125d0) * (((d_m * d_m) * (h * (m_m * m_m))) / (l * (d_m_1 * d_m_1))))
                          end if
                          code = tmp
                      end function
                      
                      d_m = Math.abs(d);
                      D_m = Math.abs(D);
                      M_m = Math.abs(M);
                      public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
                      	double tmp;
                      	if (((M_m * D_m) / (2.0 * d_m)) <= 5e+297) {
                      		tmp = w0;
                      	} else {
                      		tmp = w0 * (-0.125 * (((D_m * D_m) * (h * (M_m * M_m))) / (l * (d_m * d_m))));
                      	}
                      	return tmp;
                      }
                      
                      d_m = math.fabs(d)
                      D_m = math.fabs(D)
                      M_m = math.fabs(M)
                      def code(w0, M_m, D_m, h, l, d_m):
                      	tmp = 0
                      	if ((M_m * D_m) / (2.0 * d_m)) <= 5e+297:
                      		tmp = w0
                      	else:
                      		tmp = w0 * (-0.125 * (((D_m * D_m) * (h * (M_m * M_m))) / (l * (d_m * d_m))))
                      	return tmp
                      
                      d_m = abs(d)
                      D_m = abs(D)
                      M_m = abs(M)
                      function code(w0, M_m, D_m, h, l, d_m)
                      	tmp = 0.0
                      	if (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) <= 5e+297)
                      		tmp = w0;
                      	else
                      		tmp = Float64(w0 * Float64(-0.125 * Float64(Float64(Float64(D_m * D_m) * Float64(h * Float64(M_m * M_m))) / Float64(l * Float64(d_m * d_m)))));
                      	end
                      	return tmp
                      end
                      
                      d_m = abs(d);
                      D_m = abs(D);
                      M_m = abs(M);
                      function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
                      	tmp = 0.0;
                      	if (((M_m * D_m) / (2.0 * d_m)) <= 5e+297)
                      		tmp = w0;
                      	else
                      		tmp = w0 * (-0.125 * (((D_m * D_m) * (h * (M_m * M_m))) / (l * (d_m * d_m))));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      d_m = N[Abs[d], $MachinePrecision]
                      D_m = N[Abs[D], $MachinePrecision]
                      M_m = N[Abs[M], $MachinePrecision]
                      code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 5e+297], w0, N[(w0 * N[(-0.125 * N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d$95$m * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                      
                      \begin{array}{l}
                      d_m = \left|d\right|
                      \\
                      D_m = \left|D\right|
                      \\
                      M_m = \left|M\right|
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 5 \cdot 10^{+297}:\\
                      \;\;\;\;w0\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;w0 \cdot \left(-0.125 \cdot \frac{\left(D\_m \cdot D\_m\right) \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)}{\ell \cdot \left(d\_m \cdot d\_m\right)}\right)\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 4.9999999999999998e297

                        1. Initial program 86.2%

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

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

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

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

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

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

                          1. Initial program 58.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 rewrites65.2%

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

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

                            \[\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)} \]
                          8. Taylor expanded in M around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        Alternative 13: 74.6% accurate, 2.0× speedup?

                        \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 5 \cdot 10^{+297}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot \frac{\left(D\_m \cdot D\_m\right) \cdot \left(w0 \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)}{\ell \cdot \left(d\_m \cdot d\_m\right)}\\ \end{array} \end{array} \]
                        d_m = (fabs.f64 d)
                        D_m = (fabs.f64 D)
                        M_m = (fabs.f64 M)
                        (FPCore (w0 M_m D_m h l d_m)
                         :precision binary64
                         (if (<= (/ (* M_m D_m) (* 2.0 d_m)) 5e+297)
                           w0
                           (* -0.125 (/ (* (* D_m D_m) (* w0 (* h (* M_m M_m)))) (* l (* d_m d_m))))))
                        d_m = fabs(d);
                        D_m = fabs(D);
                        M_m = fabs(M);
                        double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
                        	double tmp;
                        	if (((M_m * D_m) / (2.0 * d_m)) <= 5e+297) {
                        		tmp = w0;
                        	} else {
                        		tmp = -0.125 * (((D_m * D_m) * (w0 * (h * (M_m * M_m)))) / (l * (d_m * d_m)));
                        	}
                        	return tmp;
                        }
                        
                        d_m = abs(d)
                        D_m = abs(d)
                        M_m = abs(m)
                        real(8) function code(w0, m_m, d_m, h, l, d_m_1)
                            real(8), intent (in) :: w0
                            real(8), intent (in) :: m_m
                            real(8), intent (in) :: d_m
                            real(8), intent (in) :: h
                            real(8), intent (in) :: l
                            real(8), intent (in) :: d_m_1
                            real(8) :: tmp
                            if (((m_m * d_m) / (2.0d0 * d_m_1)) <= 5d+297) then
                                tmp = w0
                            else
                                tmp = (-0.125d0) * (((d_m * d_m) * (w0 * (h * (m_m * m_m)))) / (l * (d_m_1 * d_m_1)))
                            end if
                            code = tmp
                        end function
                        
                        d_m = Math.abs(d);
                        D_m = Math.abs(D);
                        M_m = Math.abs(M);
                        public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
                        	double tmp;
                        	if (((M_m * D_m) / (2.0 * d_m)) <= 5e+297) {
                        		tmp = w0;
                        	} else {
                        		tmp = -0.125 * (((D_m * D_m) * (w0 * (h * (M_m * M_m)))) / (l * (d_m * d_m)));
                        	}
                        	return tmp;
                        }
                        
                        d_m = math.fabs(d)
                        D_m = math.fabs(D)
                        M_m = math.fabs(M)
                        def code(w0, M_m, D_m, h, l, d_m):
                        	tmp = 0
                        	if ((M_m * D_m) / (2.0 * d_m)) <= 5e+297:
                        		tmp = w0
                        	else:
                        		tmp = -0.125 * (((D_m * D_m) * (w0 * (h * (M_m * M_m)))) / (l * (d_m * d_m)))
                        	return tmp
                        
                        d_m = abs(d)
                        D_m = abs(D)
                        M_m = abs(M)
                        function code(w0, M_m, D_m, h, l, d_m)
                        	tmp = 0.0
                        	if (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) <= 5e+297)
                        		tmp = w0;
                        	else
                        		tmp = Float64(-0.125 * Float64(Float64(Float64(D_m * D_m) * Float64(w0 * Float64(h * Float64(M_m * M_m)))) / Float64(l * Float64(d_m * d_m))));
                        	end
                        	return tmp
                        end
                        
                        d_m = abs(d);
                        D_m = abs(D);
                        M_m = abs(M);
                        function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
                        	tmp = 0.0;
                        	if (((M_m * D_m) / (2.0 * d_m)) <= 5e+297)
                        		tmp = w0;
                        	else
                        		tmp = -0.125 * (((D_m * D_m) * (w0 * (h * (M_m * M_m)))) / (l * (d_m * d_m)));
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        d_m = N[Abs[d], $MachinePrecision]
                        D_m = N[Abs[D], $MachinePrecision]
                        M_m = N[Abs[M], $MachinePrecision]
                        code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 5e+297], w0, N[(-0.125 * N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(w0 * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d$95$m * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                        
                        \begin{array}{l}
                        d_m = \left|d\right|
                        \\
                        D_m = \left|D\right|
                        \\
                        M_m = \left|M\right|
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 5 \cdot 10^{+297}:\\
                        \;\;\;\;w0\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;-0.125 \cdot \frac{\left(D\_m \cdot D\_m\right) \cdot \left(w0 \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)}{\ell \cdot \left(d\_m \cdot d\_m\right)}\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 4.9999999999999998e297

                          1. Initial program 86.2%

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

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

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

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

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

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

                            1. Initial program 58.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 rewrites65.2%

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

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

                              \[\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)} \]
                            8. Taylor expanded in M around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          Alternative 14: 68.4% accurate, 2.7× speedup?

                          \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;M\_m \leq 6.3 \cdot 10^{-118}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(D\_m, w0 \cdot \left(D\_m \cdot \frac{h \cdot \left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right)}{d\_m \cdot \left(d\_m \cdot \ell\right)}\right), w0\right)\\ \end{array} \end{array} \]
                          d_m = (fabs.f64 d)
                          D_m = (fabs.f64 D)
                          M_m = (fabs.f64 M)
                          (FPCore (w0 M_m D_m h l d_m)
                           :precision binary64
                           (if (<= M_m 6.3e-118)
                             w0
                             (fma
                              D_m
                              (* w0 (* D_m (/ (* h (* (* M_m M_m) -0.125)) (* d_m (* d_m l)))))
                              w0)))
                          d_m = fabs(d);
                          D_m = fabs(D);
                          M_m = fabs(M);
                          double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
                          	double tmp;
                          	if (M_m <= 6.3e-118) {
                          		tmp = w0;
                          	} else {
                          		tmp = fma(D_m, (w0 * (D_m * ((h * ((M_m * M_m) * -0.125)) / (d_m * (d_m * l))))), w0);
                          	}
                          	return tmp;
                          }
                          
                          d_m = abs(d)
                          D_m = abs(D)
                          M_m = abs(M)
                          function code(w0, M_m, D_m, h, l, d_m)
                          	tmp = 0.0
                          	if (M_m <= 6.3e-118)
                          		tmp = w0;
                          	else
                          		tmp = fma(D_m, Float64(w0 * Float64(D_m * Float64(Float64(h * Float64(Float64(M_m * M_m) * -0.125)) / Float64(d_m * Float64(d_m * l))))), w0);
                          	end
                          	return tmp
                          end
                          
                          d_m = N[Abs[d], $MachinePrecision]
                          D_m = N[Abs[D], $MachinePrecision]
                          M_m = N[Abs[M], $MachinePrecision]
                          code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[M$95$m, 6.3e-118], w0, N[(D$95$m * N[(w0 * N[(D$95$m * N[(N[(h * N[(N[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / N[(d$95$m * N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision]]
                          
                          \begin{array}{l}
                          d_m = \left|d\right|
                          \\
                          D_m = \left|D\right|
                          \\
                          M_m = \left|M\right|
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;M\_m \leq 6.3 \cdot 10^{-118}:\\
                          \;\;\;\;w0\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\mathsf{fma}\left(D\_m, w0 \cdot \left(D\_m \cdot \frac{h \cdot \left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right)}{d\_m \cdot \left(d\_m \cdot \ell\right)}\right), w0\right)\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if M < 6.2999999999999997e-118

                            1. Initial program 84.4%

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

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

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

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

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

                              if 6.2999999999999997e-118 < M

                              1. Initial program 83.7%

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

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

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

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

                                \[\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-*.f6490.2

                                  \[\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. Applied rewrites90.2%

                                \[\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)} \]
                              8. Taylor expanded in M around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            Alternative 15: 67.9% accurate, 157.0× speedup?

                            \[\begin{array}{l} d_m = \left|d\right| \\ D_m = \left|D\right| \\ M_m = \left|M\right| \\ w0 \end{array} \]
                            d_m = (fabs.f64 d)
                            D_m = (fabs.f64 D)
                            M_m = (fabs.f64 M)
                            (FPCore (w0 M_m D_m h l d_m) :precision binary64 w0)
                            d_m = fabs(d);
                            D_m = fabs(D);
                            M_m = fabs(M);
                            double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
                            	return w0;
                            }
                            
                            d_m = abs(d)
                            D_m = abs(d)
                            M_m = abs(m)
                            real(8) function code(w0, m_m, d_m, h, l, d_m_1)
                                real(8), intent (in) :: w0
                                real(8), intent (in) :: m_m
                                real(8), intent (in) :: d_m
                                real(8), intent (in) :: h
                                real(8), intent (in) :: l
                                real(8), intent (in) :: d_m_1
                                code = w0
                            end function
                            
                            d_m = Math.abs(d);
                            D_m = Math.abs(D);
                            M_m = Math.abs(M);
                            public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
                            	return w0;
                            }
                            
                            d_m = math.fabs(d)
                            D_m = math.fabs(D)
                            M_m = math.fabs(M)
                            def code(w0, M_m, D_m, h, l, d_m):
                            	return w0
                            
                            d_m = abs(d)
                            D_m = abs(D)
                            M_m = abs(M)
                            function code(w0, M_m, D_m, h, l, d_m)
                            	return w0
                            end
                            
                            d_m = abs(d);
                            D_m = abs(D);
                            M_m = abs(M);
                            function tmp = code(w0, M_m, D_m, h, l, d_m)
                            	tmp = w0;
                            end
                            
                            d_m = N[Abs[d], $MachinePrecision]
                            D_m = N[Abs[D], $MachinePrecision]
                            M_m = N[Abs[M], $MachinePrecision]
                            code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := w0
                            
                            \begin{array}{l}
                            d_m = \left|d\right|
                            \\
                            D_m = \left|D\right|
                            \\
                            M_m = \left|M\right|
                            
                            \\
                            w0
                            \end{array}
                            
                            Derivation
                            1. Initial program 84.2%

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

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

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

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

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

                              Reproduce

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