Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 80.5% → 90.1%
Time: 13.5s
Alternatives: 10
Speedup: 0.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 80.5% 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: 90.1% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+41}:\\
\;\;\;\;\left(\left|M \cdot D\right| \cdot \sqrt{\frac{h}{\ell} \cdot -0.25}\right) \cdot \left(\frac{1}{d\_m} \cdot w0\right)\\

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


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

    1. Initial program 68.1%

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

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

      \[\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. 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}} \]
      5. lower-*.f64N/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}} \]
    7. Applied egg-rr47.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 88.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. Simplified96.6%

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

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

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

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

    Alternative 2: 89.6% accurate, 0.8× speedup?

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

      1. Initial program 68.1%

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

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

        \[\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. 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}} \]
        5. lower-*.f64N/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}} \]
      7. Applied egg-rr47.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 88.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. Simplified96.6%

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

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

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

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

      Alternative 3: 89.7% accurate, 0.8× speedup?

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

        1. Initial program 68.1%

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

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

          \[\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. 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}} \]
          5. lower-*.f64N/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}} \]
        7. Applied egg-rr47.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        1. Initial program 88.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. Simplified96.6%

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

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

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

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

        Alternative 4: 89.4% accurate, 0.8× speedup?

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

          1. Initial program 68.1%

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

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

            \[\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. 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}} \]
            5. lower-*.f64N/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}} \]
          7. Applied egg-rr47.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          1. Initial program 88.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. Simplified96.6%

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

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

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

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

          Alternative 5: 84.3% accurate, 0.8× speedup?

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

            1. Initial program 67.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 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-*.f6435.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. Simplified35.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. 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}} \]
              5. lower-*.f64N/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}} \]
            7. Applied egg-rr47.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            1. Initial program 89.0%

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

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

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

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

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

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

            Alternative 6: 78.1% accurate, 0.8× speedup?

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

              1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 88.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. Simplified96.8%

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

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

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

              Alternative 7: 77.0% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

                    \[\leadsto w0 \cdot \mathsf{fma}\left(D \cdot D, \frac{\frac{-1}{8} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}}{{d}^{2} \cdot \ell}, 1\right) \]
                  13. unpow2N/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}^{2} \cdot \ell}, 1\right) \]
                  14. lower-*.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}^{2} \cdot \ell}, 1\right) \]
                  15. lower-*.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)}{\color{blue}{{d}^{2} \cdot \ell}}, 1\right) \]
                  16. unpow2N/A

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

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

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

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

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

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

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

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

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

                Alternative 8: 76.9% accurate, 0.8× speedup?

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

                  1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 9: 70.2% accurate, 2.5× speedup?

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

                    1. Initial program 85.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. Simplified76.4%

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

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

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

                      if 3.99999999999999973e-102 < (*.f64 M D)

                      1. Initial program 76.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 10: 68.1% accurate, 157.0× speedup?

                    \[\begin{array}{l} d_m = \left|d\right| \\ w0 \end{array} \]
                    d_m = (fabs.f64 d)
                    (FPCore (w0 M D h l d_m) :precision binary64 w0)
                    d_m = fabs(d);
                    double code(double w0, double M, double D, double h, double l, double d_m) {
                    	return w0;
                    }
                    
                    d_m = abs(d)
                    real(8) function code(w0, m, d, h, l, d_m)
                        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_m
                        code = w0
                    end function
                    
                    d_m = Math.abs(d);
                    public static double code(double w0, double M, double D, double h, double l, double d_m) {
                    	return w0;
                    }
                    
                    d_m = math.fabs(d)
                    def code(w0, M, D, h, l, d_m):
                    	return w0
                    
                    d_m = abs(d)
                    function code(w0, M, D, h, l, d_m)
                    	return w0
                    end
                    
                    d_m = abs(d);
                    function tmp = code(w0, M, D, h, l, d_m)
                    	tmp = w0;
                    end
                    
                    d_m = N[Abs[d], $MachinePrecision]
                    code[w0_, M_, D_, h_, l_, d$95$m_] := w0
                    
                    \begin{array}{l}
                    d_m = \left|d\right|
                    
                    \\
                    w0
                    \end{array}
                    
                    Derivation
                    1. Initial program 82.8%

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

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

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

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

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

                      Reproduce

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