Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 80.7% → 85.4%
Time: 17.4s
Alternatives: 16
Speedup: 1.0×

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

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;M \cdot D \leq -4 \cdot 10^{+195}:\\ \;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left({\left(\frac{D}{d}\right)}^{2} \cdot \frac{M}{\frac{\ell}{M \cdot h}}\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= (* M D) -4e+195)
   (* w0 (sqrt (- 1.0 (* 0.25 (* (pow (/ D d) 2.0) (/ M (/ l (* M h))))))))
   (* w0 (sqrt (- 1.0 (/ (* h (pow (* (/ M d) (* D 0.5)) 2.0)) l))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((M * D) <= -4e+195) {
		tmp = w0 * sqrt((1.0 - (0.25 * (pow((D / d), 2.0) * (M / (l / (M * h)))))));
	} else {
		tmp = w0 * sqrt((1.0 - ((h * pow(((M / d) * (D * 0.5)), 2.0)) / l)));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if ((m * d) <= (-4d+195)) then
        tmp = w0 * sqrt((1.0d0 - (0.25d0 * (((d / d_1) ** 2.0d0) * (m / (l / (m * h)))))))
    else
        tmp = w0 * sqrt((1.0d0 - ((h * (((m / d_1) * (d * 0.5d0)) ** 2.0d0)) / l)))
    end if
    code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((M * D) <= -4e+195) {
		tmp = w0 * Math.sqrt((1.0 - (0.25 * (Math.pow((D / d), 2.0) * (M / (l / (M * h)))))));
	} else {
		tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow(((M / d) * (D * 0.5)), 2.0)) / l)));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	tmp = 0
	if (M * D) <= -4e+195:
		tmp = w0 * math.sqrt((1.0 - (0.25 * (math.pow((D / d), 2.0) * (M / (l / (M * h)))))))
	else:
		tmp = w0 * math.sqrt((1.0 - ((h * math.pow(((M / d) * (D * 0.5)), 2.0)) / l)))
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (Float64(M * D) <= -4e+195)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64((Float64(D / d) ^ 2.0) * Float64(M / Float64(l / Float64(M * h))))))));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(Float64(M / d) * Float64(D * 0.5)) ^ 2.0)) / l))));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if ((M * D) <= -4e+195)
		tmp = w0 * sqrt((1.0 - (0.25 * (((D / d) ^ 2.0) * (M / (l / (M * h)))))));
	else
		tmp = w0 * sqrt((1.0 - ((h * (((M / d) * (D * 0.5)) ^ 2.0)) / l)));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(M * D), $MachinePrecision], -4e+195], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(N[Power[N[(D / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(M / N[(l / N[(M * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \cdot D \leq -4 \cdot 10^{+195}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left({\left(\frac{D}{d}\right)}^{2} \cdot \frac{M}{\frac{\ell}{M \cdot h}}\right)}\\

\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}{\ell}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 M D) < -3.99999999999999991e195

    1. Initial program 42.4%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative42.4%

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

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 28.7%

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

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}} \]
      2. *-commutative28.7%

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25}{\ell} \cdot \frac{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {M}^{2}}{{d}^{2}}} \]
      6. associate-*l*33.8%

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{0.25}{\ell} \cdot \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \left(M \cdot M\right)}{d \cdot d}}} \]
    7. Step-by-step derivation
      1. associate-*r/33.8%

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{0.25}{\ell} \cdot \color{blue}{\left(D \cdot \left(\left(D \cdot h\right) \cdot \left(M \cdot M\right)\right)\right)}}{d \cdot d}} \]
      3. *-commutative33.8%

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{0.25}{\ell} \cdot \left(D \cdot \left(\left(h \cdot D\right) \cdot \left(M \cdot M\right)\right)\right)}{d \cdot d}}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity33.8%

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

        \[\leadsto w0 \cdot \sqrt{1 - 1 \cdot \color{blue}{\left(\frac{\frac{0.25}{\ell}}{d} \cdot \frac{D \cdot \left(\left(h \cdot D\right) \cdot \left(M \cdot M\right)\right)}{d}\right)}} \]
      3. *-commutative38.2%

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{1 \cdot \left(\frac{\frac{0.25}{\ell}}{d} \cdot \frac{D \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot D\right)\right)}{d}\right)}} \]
    11. Step-by-step derivation
      1. *-lft-identity38.2%

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

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{0.25}{\ell \cdot d}} \cdot \frac{D \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot D\right)\right)}{d}} \]
      3. associate-/l*42.3%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25}{\ell \cdot d} \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(\left(h \cdot D\right) \cdot \left(M \cdot M\right)\right)}\right)} \]
      6. *-commutative42.3%

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{0.25}{\ell \cdot d} \cdot \left(\frac{D}{d} \cdot \left(D \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\right)}} \]
    13. Taylor expanded in l around 0 28.7%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}} \]
    14. Step-by-step derivation
      1. times-frac29.5%

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - 0.25 \cdot \left(\color{blue}{{\left(\frac{D}{d}\right)}^{2}} \cdot \frac{{M}^{2} \cdot h}{\ell}\right)} \]
      6. unpow238.3%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - 0.25 \cdot \left({\left(\frac{D}{d}\right)}^{2} \cdot \color{blue}{\frac{M}{\frac{\ell}{M \cdot h}}}\right)} \]
      9. *-commutative46.6%

        \[\leadsto w0 \cdot \sqrt{1 - 0.25 \cdot \left({\left(\frac{D}{d}\right)}^{2} \cdot \frac{M}{\frac{\ell}{\color{blue}{h \cdot M}}}\right)} \]
    15. Simplified46.6%

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

    if -3.99999999999999991e195 < (*.f64 M D)

    1. Initial program 82.8%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative82.8%

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

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

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

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2}}{\ell}} \]
      6. frac-times89.7%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h \cdot {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2}}{\ell}} \]
      7. div-inv89.7%

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

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

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

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

Alternative 2: 85.9% accurate, 0.7× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq 0.02:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{D \cdot 0.5}{\frac{d}{M}}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= (* (pow (/ (* M D) (* d 2.0)) 2.0) (/ h l)) 0.02)
   (* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ (* D 0.5) (/ d M)) 2.0)))))
   w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= 0.02) {
		tmp = w0 * sqrt((1.0 - ((h / l) * pow(((D * 0.5) / (d / M)), 2.0))));
	} else {
		tmp = w0;
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (((((m * d) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l)) <= 0.02d0) then
        tmp = w0 * sqrt((1.0d0 - ((h / l) * (((d * 0.5d0) / (d_1 / m)) ** 2.0d0))))
    else
        tmp = w0
    end if
    code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((Math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= 0.02) {
		tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((D * 0.5) / (d / M)), 2.0))));
	} else {
		tmp = w0;
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	tmp = 0
	if (math.pow(((M * D) / (d * 2.0)), 2.0) * (h / l)) <= 0.02:
		tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((D * 0.5) / (d / M)), 2.0))))
	else:
		tmp = w0
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (Float64((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l)) <= 0.02)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(D * 0.5) / Float64(d / M)) ^ 2.0)))));
	else
		tmp = w0;
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if (((((M * D) / (d * 2.0)) ^ 2.0) * (h / l)) <= 0.02)
		tmp = w0 * sqrt((1.0 - ((h / l) * (((D * 0.5) / (d / M)) ^ 2.0))));
	else
		tmp = w0;
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], 0.02], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D * 0.5), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell} \leq 0.02:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{D \cdot 0.5}{\frac{d}{M}}\right)}^{2}}\\

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


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

    1. Initial program 86.2%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative86.2%

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{D}{2} \cdot \color{blue}{\frac{1}{\frac{d}{M}}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      3. un-div-inv86.7%

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

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

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

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

    if 0.0200000000000000004 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))

    1. Initial program 0.0%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative0.0%

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

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 73.4%

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

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

Alternative 3: 84.3% accurate, 1.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \frac{0.25}{\ell}}{\frac{d}{M} \cdot \frac{d}{M}}}\\ \mathbf{elif}\;\frac{h}{\ell} \leq -1 \cdot 10^{-166}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= (/ h l) (- INFINITY))
   (* w0 (sqrt (- 1.0 (/ (* (* D (* D h)) (/ 0.25 l)) (* (/ d M) (/ d M))))))
   (if (<= (/ h l) -1e-166)
     (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (* M D) (/ 0.5 d)) 2.0)))))
     w0)))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((h / l) <= -((double) INFINITY)) {
		tmp = w0 * sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))));
	} else if ((h / l) <= -1e-166) {
		tmp = w0 * sqrt((1.0 - ((h / l) * pow(((M * D) * (0.5 / d)), 2.0))));
	} else {
		tmp = w0;
	}
	return tmp;
}
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((h / l) <= -Double.POSITIVE_INFINITY) {
		tmp = w0 * Math.sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))));
	} else if ((h / l) <= -1e-166) {
		tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M * D) * (0.5 / d)), 2.0))));
	} else {
		tmp = w0;
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	tmp = 0
	if (h / l) <= -math.inf:
		tmp = w0 * math.sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))))
	elif (h / l) <= -1e-166:
		tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M * D) * (0.5 / d)), 2.0))))
	else:
		tmp = w0
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (Float64(h / l) <= Float64(-Inf))
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(D * Float64(D * h)) * Float64(0.25 / l)) / Float64(Float64(d / M) * Float64(d / M))))));
	elseif (Float64(h / l) <= -1e-166)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M * D) * Float64(0.5 / d)) ^ 2.0)))));
	else
		tmp = w0;
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if ((h / l) <= -Inf)
		tmp = w0 * sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))));
	elseif ((h / l) <= -1e-166)
		tmp = w0 * sqrt((1.0 - ((h / l) * (((M * D) * (0.5 / d)) ^ 2.0))));
	else
		tmp = w0;
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], (-Infinity)], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(D * N[(D * h), $MachinePrecision]), $MachinePrecision] * N[(0.25 / l), $MachinePrecision]), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -1e-166], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \frac{0.25}{\ell}}{\frac{d}{M} \cdot \frac{d}{M}}}\\

\mathbf{elif}\;\frac{h}{\ell} \leq -1 \cdot 10^{-166}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right)}^{2}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 h l) < -inf.0

    1. Initial program 43.2%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative43.2%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac43.3%

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 50.9%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25 \cdot \left({D}^{2} \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}\right)}{\ell \cdot {d}^{2}}} \]
      3. times-frac55.6%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25}{\ell} \cdot \frac{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {M}^{2}}{{d}^{2}}} \]
      6. associate-*l*55.2%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25}{\ell} \cdot \frac{\color{blue}{\left(D \cdot \left(D \cdot h\right)\right)} \cdot {M}^{2}}{{d}^{2}}} \]
      7. unpow255.2%

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{0.25}{\ell} \cdot \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \left(M \cdot M\right)}{d \cdot d}}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity55.2%

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

        \[\leadsto w0 \cdot \left(1 \cdot \sqrt{1 - \color{blue}{\frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \left(M \cdot M\right)}{d \cdot d} \cdot \frac{0.25}{\ell}}}\right) \]
      3. associate-/l*55.2%

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

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

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

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

    if -inf.0 < (/.f64 h l) < -1.00000000000000004e-166

    1. Initial program 81.1%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. associate-/l*82.0%

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M}{\frac{2 \cdot d}{D}}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    3. Simplified82.0%

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

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2} \cdot \frac{h}{\ell}} \]
      2. clear-num81.0%

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

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

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

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

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

    if -1.00000000000000004e-166 < (/.f64 h l)

    1. Initial program 84.3%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative84.3%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac85.0%

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    3. Simplified85.0%

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 90.8%

      \[\leadsto \color{blue}{w0} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \frac{0.25}{\ell}}{\frac{d}{M} \cdot \frac{d}{M}}}\\ \mathbf{elif}\;\frac{h}{\ell} \leq -1 \cdot 10^{-166}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]

Alternative 4: 85.7% accurate, 1.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \frac{0.25}{\ell}}{\frac{d}{M} \cdot \frac{d}{M}}}\\ \mathbf{elif}\;\frac{h}{\ell} \leq -5 \cdot 10^{-296}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= (/ h l) (- INFINITY))
   (* w0 (sqrt (- 1.0 (/ (* (* D (* D h)) (/ 0.25 l)) (* (/ d M) (/ d M))))))
   (if (<= (/ h l) -5e-296)
     (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ M d) (/ D 2.0)) 2.0)))))
     w0)))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((h / l) <= -((double) INFINITY)) {
		tmp = w0 * sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))));
	} else if ((h / l) <= -5e-296) {
		tmp = w0 * sqrt((1.0 - ((h / l) * pow(((M / d) * (D / 2.0)), 2.0))));
	} else {
		tmp = w0;
	}
	return tmp;
}
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((h / l) <= -Double.POSITIVE_INFINITY) {
		tmp = w0 * Math.sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))));
	} else if ((h / l) <= -5e-296) {
		tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M / d) * (D / 2.0)), 2.0))));
	} else {
		tmp = w0;
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	tmp = 0
	if (h / l) <= -math.inf:
		tmp = w0 * math.sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))))
	elif (h / l) <= -5e-296:
		tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M / d) * (D / 2.0)), 2.0))))
	else:
		tmp = w0
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (Float64(h / l) <= Float64(-Inf))
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(D * Float64(D * h)) * Float64(0.25 / l)) / Float64(Float64(d / M) * Float64(d / M))))));
	elseif (Float64(h / l) <= -5e-296)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0)))));
	else
		tmp = w0;
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if ((h / l) <= -Inf)
		tmp = w0 * sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))));
	elseif ((h / l) <= -5e-296)
		tmp = w0 * sqrt((1.0 - ((h / l) * (((M / d) * (D / 2.0)) ^ 2.0))));
	else
		tmp = w0;
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], (-Infinity)], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(D * N[(D * h), $MachinePrecision]), $MachinePrecision] * N[(0.25 / l), $MachinePrecision]), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -5e-296], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \frac{0.25}{\ell}}{\frac{d}{M} \cdot \frac{d}{M}}}\\

\mathbf{elif}\;\frac{h}{\ell} \leq -5 \cdot 10^{-296}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 h l) < -inf.0

    1. Initial program 43.2%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative43.2%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac43.3%

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 50.9%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25 \cdot \left({D}^{2} \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}\right)}{\ell \cdot {d}^{2}}} \]
      3. times-frac55.6%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25}{\ell} \cdot \frac{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {M}^{2}}{{d}^{2}}} \]
      6. associate-*l*55.2%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25}{\ell} \cdot \frac{\color{blue}{\left(D \cdot \left(D \cdot h\right)\right)} \cdot {M}^{2}}{{d}^{2}}} \]
      7. unpow255.2%

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{0.25}{\ell} \cdot \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \left(M \cdot M\right)}{d \cdot d}}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity55.2%

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

        \[\leadsto w0 \cdot \left(1 \cdot \sqrt{1 - \color{blue}{\frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \left(M \cdot M\right)}{d \cdot d} \cdot \frac{0.25}{\ell}}}\right) \]
      3. associate-/l*55.2%

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

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

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

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

    if -inf.0 < (/.f64 h l) < -5.0000000000000003e-296

    1. Initial program 78.3%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative78.3%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac79.0%

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    3. Simplified79.0%

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

    if -5.0000000000000003e-296 < (/.f64 h l)

    1. Initial program 88.1%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative88.1%

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

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 95.0%

      \[\leadsto \color{blue}{w0} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \frac{0.25}{\ell}}{\frac{d}{M} \cdot \frac{d}{M}}}\\ \mathbf{elif}\;\frac{h}{\ell} \leq -5 \cdot 10^{-296}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]

Alternative 5: 85.7% accurate, 1.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{+306}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \frac{0.25}{\ell}}{\frac{d}{M} \cdot \frac{d}{M}}}\\ \mathbf{elif}\;\frac{h}{\ell} \leq -5 \cdot 10^{-296}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{\frac{d \cdot 2}{D}}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= (/ h l) -1e+306)
   (* w0 (sqrt (- 1.0 (/ (* (* D (* D h)) (/ 0.25 l)) (* (/ d M) (/ d M))))))
   (if (<= (/ h l) -5e-296)
     (* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ M (/ (* d 2.0) D)) 2.0)))))
     w0)))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((h / l) <= -1e+306) {
		tmp = w0 * sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))));
	} else if ((h / l) <= -5e-296) {
		tmp = w0 * sqrt((1.0 - ((h / l) * pow((M / ((d * 2.0) / D)), 2.0))));
	} else {
		tmp = w0;
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if ((h / l) <= (-1d+306)) then
        tmp = w0 * sqrt((1.0d0 - (((d * (d * h)) * (0.25d0 / l)) / ((d_1 / m) * (d_1 / m)))))
    else if ((h / l) <= (-5d-296)) then
        tmp = w0 * sqrt((1.0d0 - ((h / l) * ((m / ((d_1 * 2.0d0) / d)) ** 2.0d0))))
    else
        tmp = w0
    end if
    code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((h / l) <= -1e+306) {
		tmp = w0 * Math.sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))));
	} else if ((h / l) <= -5e-296) {
		tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((M / ((d * 2.0) / D)), 2.0))));
	} else {
		tmp = w0;
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	tmp = 0
	if (h / l) <= -1e+306:
		tmp = w0 * math.sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))))
	elif (h / l) <= -5e-296:
		tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((M / ((d * 2.0) / D)), 2.0))))
	else:
		tmp = w0
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (Float64(h / l) <= -1e+306)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(D * Float64(D * h)) * Float64(0.25 / l)) / Float64(Float64(d / M) * Float64(d / M))))));
	elseif (Float64(h / l) <= -5e-296)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(M / Float64(Float64(d * 2.0) / D)) ^ 2.0)))));
	else
		tmp = w0;
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if ((h / l) <= -1e+306)
		tmp = w0 * sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))));
	elseif ((h / l) <= -5e-296)
		tmp = w0 * sqrt((1.0 - ((h / l) * ((M / ((d * 2.0) / D)) ^ 2.0))));
	else
		tmp = w0;
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], -1e+306], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(D * N[(D * h), $MachinePrecision]), $MachinePrecision] * N[(0.25 / l), $MachinePrecision]), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -5e-296], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(M / N[(N[(d * 2.0), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{+306}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \frac{0.25}{\ell}}{\frac{d}{M} \cdot \frac{d}{M}}}\\

\mathbf{elif}\;\frac{h}{\ell} \leq -5 \cdot 10^{-296}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{\frac{d \cdot 2}{D}}\right)}^{2}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 h l) < -1.00000000000000002e306

    1. Initial program 41.6%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative41.6%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac41.7%

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    3. Simplified41.7%

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 49.0%

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

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}} \]
      2. *-commutative49.0%

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25}{\ell} \cdot \frac{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {M}^{2}}{{d}^{2}}} \]
      6. associate-*l*53.2%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25}{\ell} \cdot \frac{\color{blue}{\left(D \cdot \left(D \cdot h\right)\right)} \cdot {M}^{2}}{{d}^{2}}} \]
      7. unpow253.2%

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{0.25}{\ell} \cdot \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \left(M \cdot M\right)}{d \cdot d}}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity53.2%

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

        \[\leadsto w0 \cdot \left(1 \cdot \sqrt{1 - \color{blue}{\frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \left(M \cdot M\right)}{d \cdot d} \cdot \frac{0.25}{\ell}}}\right) \]
      3. associate-/l*53.2%

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

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

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

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

    if -1.00000000000000002e306 < (/.f64 h l) < -5.0000000000000003e-296

    1. Initial program 78.9%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. associate-/l*81.2%

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

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

    if -5.0000000000000003e-296 < (/.f64 h l)

    1. Initial program 88.1%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative88.1%

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

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 95.0%

      \[\leadsto \color{blue}{w0} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification85.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{+306}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \frac{0.25}{\ell}}{\frac{d}{M} \cdot \frac{d}{M}}}\\ \mathbf{elif}\;\frac{h}{\ell} \leq -5 \cdot 10^{-296}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{\frac{d \cdot 2}{D}}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]

Alternative 6: 85.5% accurate, 1.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}{\ell}} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (* w0 (sqrt (- 1.0 (/ (* h (pow (* (/ M d) (* D 0.5)) 2.0)) l)))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * sqrt((1.0 - ((h * pow(((M / d) * (D * 0.5)), 2.0)) / l)));
}
NOTE: M and D should be sorted in increasing order before calling this function.
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 - ((h * (((m / d_1) * (d * 0.5d0)) ** 2.0d0)) / l)))
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * Math.sqrt((1.0 - ((h * Math.pow(((M / d) * (D * 0.5)), 2.0)) / l)));
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	return w0 * math.sqrt((1.0 - ((h * math.pow(((M / d) * (D * 0.5)), 2.0)) / l)))
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(Float64(M / d) * Float64(D * 0.5)) ^ 2.0)) / l))))
end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
	tmp = w0 * sqrt((1.0 - ((h * (((M / d) * (D * 0.5)) ^ 2.0)) / l)));
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}{\ell}}
\end{array}
Derivation
  1. Initial program 79.2%

    \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
  2. Step-by-step derivation
    1. *-commutative79.2%

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\color{blue}{\left(\frac{M \cdot D}{d \cdot 2}\right)}}^{2}} \]
    3. *-commutative79.2%

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h \cdot {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2}}{\ell}} \]
    7. div-inv85.1%

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

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

    \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}{\ell}}} \]
  6. Final simplification85.1%

    \[\leadsto w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}{\ell}} \]

Alternative 7: 78.3% accurate, 1.7× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;M \leq -1 \cdot 10^{+102}:\\ \;\;\;\;w0 + w0 \cdot \left(-0.125 \cdot \left(D \cdot \left(\frac{D}{\ell} \cdot \left(\frac{M}{d} \cdot \left(M \cdot \frac{h}{d}\right)\right)\right)\right)\right)\\ \mathbf{elif}\;M \leq -2 \cdot 10^{-161}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25}{d \cdot \ell} \cdot \left(\frac{D}{d} \cdot \left(D \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\right)}\\ \mathbf{elif}\;M \leq 7 \cdot 10^{-203}:\\ \;\;\;\;w0 \cdot \left(1 + \frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \frac{\frac{M}{d} \cdot \left(M \cdot h\right)}{d}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(D \cdot \left(\frac{D}{\ell} \cdot \left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)\right)\right) \cdot -0.25}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= M -1e+102)
   (+ w0 (* w0 (* -0.125 (* D (* (/ D l) (* (/ M d) (* M (/ h d))))))))
   (if (<= M -2e-161)
     (* w0 (sqrt (- 1.0 (* (/ 0.25 (* d l)) (* (/ D d) (* D (* h (* M M))))))))
     (if (<= M 7e-203)
       (* w0 (+ 1.0 (* (/ -0.125 l) (* D (* D (/ (* (/ M d) (* M h)) d))))))
       (*
        w0
        (sqrt
         (+ 1.0 (* (* D (* (/ D l) (* (/ (* M M) d) (/ h d)))) -0.25))))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= -1e+102) {
		tmp = w0 + (w0 * (-0.125 * (D * ((D / l) * ((M / d) * (M * (h / d)))))));
	} else if (M <= -2e-161) {
		tmp = w0 * sqrt((1.0 - ((0.25 / (d * l)) * ((D / d) * (D * (h * (M * M)))))));
	} else if (M <= 7e-203) {
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))));
	} else {
		tmp = w0 * sqrt((1.0 + ((D * ((D / l) * (((M * M) / d) * (h / d)))) * -0.25)));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (m <= (-1d+102)) then
        tmp = w0 + (w0 * ((-0.125d0) * (d * ((d / l) * ((m / d_1) * (m * (h / d_1)))))))
    else if (m <= (-2d-161)) then
        tmp = w0 * sqrt((1.0d0 - ((0.25d0 / (d_1 * l)) * ((d / d_1) * (d * (h * (m * m)))))))
    else if (m <= 7d-203) then
        tmp = w0 * (1.0d0 + (((-0.125d0) / l) * (d * (d * (((m / d_1) * (m * h)) / d_1)))))
    else
        tmp = w0 * sqrt((1.0d0 + ((d * ((d / l) * (((m * m) / d_1) * (h / d_1)))) * (-0.25d0))))
    end if
    code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= -1e+102) {
		tmp = w0 + (w0 * (-0.125 * (D * ((D / l) * ((M / d) * (M * (h / d)))))));
	} else if (M <= -2e-161) {
		tmp = w0 * Math.sqrt((1.0 - ((0.25 / (d * l)) * ((D / d) * (D * (h * (M * M)))))));
	} else if (M <= 7e-203) {
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))));
	} else {
		tmp = w0 * Math.sqrt((1.0 + ((D * ((D / l) * (((M * M) / d) * (h / d)))) * -0.25)));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	tmp = 0
	if M <= -1e+102:
		tmp = w0 + (w0 * (-0.125 * (D * ((D / l) * ((M / d) * (M * (h / d)))))))
	elif M <= -2e-161:
		tmp = w0 * math.sqrt((1.0 - ((0.25 / (d * l)) * ((D / d) * (D * (h * (M * M)))))))
	elif M <= 7e-203:
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))))
	else:
		tmp = w0 * math.sqrt((1.0 + ((D * ((D / l) * (((M * M) / d) * (h / d)))) * -0.25)))
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (M <= -1e+102)
		tmp = Float64(w0 + Float64(w0 * Float64(-0.125 * Float64(D * Float64(Float64(D / l) * Float64(Float64(M / d) * Float64(M * Float64(h / d))))))));
	elseif (M <= -2e-161)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.25 / Float64(d * l)) * Float64(Float64(D / d) * Float64(D * Float64(h * Float64(M * M))))))));
	elseif (M <= 7e-203)
		tmp = Float64(w0 * Float64(1.0 + Float64(Float64(-0.125 / l) * Float64(D * Float64(D * Float64(Float64(Float64(M / d) * Float64(M * h)) / d))))));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(D * Float64(Float64(D / l) * Float64(Float64(Float64(M * M) / d) * Float64(h / d)))) * -0.25))));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if (M <= -1e+102)
		tmp = w0 + (w0 * (-0.125 * (D * ((D / l) * ((M / d) * (M * (h / d)))))));
	elseif (M <= -2e-161)
		tmp = w0 * sqrt((1.0 - ((0.25 / (d * l)) * ((D / d) * (D * (h * (M * M)))))));
	elseif (M <= 7e-203)
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))));
	else
		tmp = w0 * sqrt((1.0 + ((D * ((D / l) * (((M * M) / d) * (h / d)))) * -0.25)));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, -1e+102], N[(w0 + N[(w0 * N[(-0.125 * N[(D * N[(N[(D / l), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(M * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, -2e-161], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.25 / N[(d * l), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(D * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 7e-203], N[(w0 * N[(1.0 + N[(N[(-0.125 / l), $MachinePrecision] * N[(D * N[(D * N[(N[(N[(M / d), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(D * N[(N[(D / l), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] / d), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -1 \cdot 10^{+102}:\\
\;\;\;\;w0 + w0 \cdot \left(-0.125 \cdot \left(D \cdot \left(\frac{D}{\ell} \cdot \left(\frac{M}{d} \cdot \left(M \cdot \frac{h}{d}\right)\right)\right)\right)\right)\\

\mathbf{elif}\;M \leq -2 \cdot 10^{-161}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25}{d \cdot \ell} \cdot \left(\frac{D}{d} \cdot \left(D \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\right)}\\

\mathbf{elif}\;M \leq 7 \cdot 10^{-203}:\\
\;\;\;\;w0 \cdot \left(1 + \frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \frac{\frac{M}{d} \cdot \left(M \cdot h\right)}{d}\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if M < -9.99999999999999977e101

    1. Initial program 60.3%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative60.3%

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

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 24.2%

      \[\leadsto w0 \cdot \color{blue}{\left(1 + -0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/24.2%

        \[\leadsto w0 \cdot \left(1 + \color{blue}{\frac{-0.125 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}\right) \]
      2. *-commutative24.2%

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

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

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

        \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{h \cdot {M}^{2}}{{d}^{2}}\right)} \cdot -0.125\right) \]
      6. unpow224.0%

        \[\leadsto w0 \cdot \left(1 + \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{h \cdot {M}^{2}}{{d}^{2}}\right) \cdot -0.125\right) \]
      7. *-commutative24.0%

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

        \[\leadsto w0 \cdot \left(1 + \left(\frac{D \cdot D}{\ell} \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{{d}^{2}}\right) \cdot -0.125\right) \]
      9. unpow224.0%

        \[\leadsto w0 \cdot \left(1 + \left(\frac{D \cdot D}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot h}{\color{blue}{d \cdot d}}\right) \cdot -0.125\right) \]
    6. Simplified24.0%

      \[\leadsto w0 \cdot \color{blue}{\left(1 + \left(\frac{D \cdot D}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot h}{d \cdot d}\right) \cdot -0.125\right)} \]
    7. Taylor expanded in D around 0 24.2%

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

        \[\leadsto w0 \cdot \left(1 + \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{\ell \cdot {d}^{2}}} \cdot -0.125\right) \]
      2. times-frac24.0%

        \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)} \cdot -0.125\right) \]
      3. unpow224.0%

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

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

        \[\leadsto w0 \cdot \left(1 + \left(\frac{{D}^{2}}{\ell} \cdot \color{blue}{\left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)}\right) \cdot -0.125\right) \]
      6. unpow234.3%

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

        \[\leadsto w0 \cdot \left(1 + \left(\color{blue}{\left(\frac{D}{\ell} \cdot D\right)} \cdot \left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)\right) \cdot -0.125\right) \]
      8. *-commutative37.5%

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

        \[\leadsto w0 \cdot \left(1 + \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(\color{blue}{\frac{M}{\frac{d}{M}}} \cdot \frac{h}{d}\right)\right) \cdot -0.125\right) \]
    9. Simplified50.6%

      \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right)} \cdot -0.125\right) \]
    10. Step-by-step derivation
      1. associate-*r/47.2%

        \[\leadsto w0 \cdot \left(1 + \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \color{blue}{\frac{\frac{M}{\frac{d}{M}} \cdot h}{d}}\right) \cdot -0.125\right) \]
      2. associate-/r/47.2%

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

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

        \[\leadsto \color{blue}{1 \cdot w0 + \left(\left(\left(D \cdot \frac{D}{\ell}\right) \cdot \frac{\left(\frac{M}{d} \cdot M\right) \cdot h}{d}\right) \cdot -0.125\right) \cdot w0} \]
      2. *-un-lft-identity47.2%

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

        \[\leadsto w0 + \color{blue}{\left(-0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \frac{\left(\frac{M}{d} \cdot M\right) \cdot h}{d}\right)\right)} \cdot w0 \]
      4. associate-*l*47.6%

        \[\leadsto w0 + \left(-0.125 \cdot \color{blue}{\left(D \cdot \left(\frac{D}{\ell} \cdot \frac{\left(\frac{M}{d} \cdot M\right) \cdot h}{d}\right)\right)}\right) \cdot w0 \]
      5. associate-*r/50.8%

        \[\leadsto w0 + \left(-0.125 \cdot \left(D \cdot \left(\frac{D}{\ell} \cdot \color{blue}{\left(\left(\frac{M}{d} \cdot M\right) \cdot \frac{h}{d}\right)}\right)\right)\right) \cdot w0 \]
      6. associate-*l*50.8%

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

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

    if -9.99999999999999977e101 < M < -2.00000000000000006e-161

    1. Initial program 89.9%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative89.9%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac89.9%

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    3. Simplified89.9%

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 71.4%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25 \cdot \left({D}^{2} \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}\right)}{\ell \cdot {d}^{2}}} \]
      3. times-frac73.3%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25}{\ell} \cdot \frac{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {M}^{2}}{{d}^{2}}} \]
      6. associate-*l*71.7%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25}{\ell} \cdot \frac{\color{blue}{\left(D \cdot \left(D \cdot h\right)\right)} \cdot {M}^{2}}{{d}^{2}}} \]
      7. unpow271.7%

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{0.25}{\ell} \cdot \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \left(M \cdot M\right)}{d \cdot d}}} \]
    7. Step-by-step derivation
      1. associate-*r/71.6%

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{0.25}{\ell} \cdot \color{blue}{\left(D \cdot \left(\left(D \cdot h\right) \cdot \left(M \cdot M\right)\right)\right)}}{d \cdot d}} \]
      3. *-commutative78.8%

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{0.25}{\ell} \cdot \left(D \cdot \left(\left(h \cdot D\right) \cdot \left(M \cdot M\right)\right)\right)}{d \cdot d}}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity78.8%

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{1 \cdot \left(\frac{\frac{0.25}{\ell}}{d} \cdot \frac{D \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot D\right)\right)}{d}\right)}} \]
    11. Step-by-step derivation
      1. *-lft-identity90.5%

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

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{0.25}{\ell \cdot d}} \cdot \frac{D \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot D\right)\right)}{d}} \]
      3. associate-/l*92.3%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25}{\ell \cdot d} \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(\left(h \cdot D\right) \cdot \left(M \cdot M\right)\right)}\right)} \]
      6. *-commutative92.3%

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

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

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

    if -2.00000000000000006e-161 < M < 7.0000000000000003e-203

    1. Initial program 89.8%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative89.8%

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

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

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

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2}}{\ell}} \]
      6. frac-times95.7%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h \cdot {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2}}{\ell}} \]
      7. div-inv95.7%

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}{\ell}}} \]
    6. Taylor expanded in h around 0 68.7%

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

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

        \[\leadsto w0 \cdot \color{blue}{\left(\frac{-0.125}{\ell} \cdot \left(\left(D \cdot D\right) \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right) + 1\right)} \]
      2. associate-*l*86.8%

        \[\leadsto w0 \cdot \left(\frac{-0.125}{\ell} \cdot \color{blue}{\left(D \cdot \left(D \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right)\right)} + 1\right) \]
      3. associate-/r/86.8%

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

      \[\leadsto w0 \cdot \color{blue}{\left(\frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \left(\left(\frac{M}{d} \cdot M\right) \cdot \frac{h}{d}\right)\right)\right) + 1\right)} \]
    10. Step-by-step derivation
      1. associate-*r/91.3%

        \[\leadsto w0 \cdot \left(\frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \color{blue}{\frac{\left(\frac{M}{d} \cdot M\right) \cdot h}{d}}\right)\right) + 1\right) \]
      2. associate-*l*92.9%

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

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

    if 7.0000000000000003e-203 < M

    1. Initial program 71.5%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative71.5%

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

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in w0 around 0 53.2%

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

        \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}}} \]
      2. cancel-sign-sub-inv53.2%

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 + -0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{\ell \cdot {d}^{2}}{h \cdot {M}^{2}}}}} \]
      6. associate-*r/53.3%

        \[\leadsto w0 \cdot \sqrt{1 + \color{blue}{\frac{-0.25 \cdot {D}^{2}}{\frac{\ell \cdot {d}^{2}}{h \cdot {M}^{2}}}}} \]
      7. unpow253.3%

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 + \frac{-0.25 \cdot \left(D \cdot D\right)}{\frac{\frac{\color{blue}{\left(d \cdot d\right)} \cdot \ell}{h}}{{M}^{2}}}} \]
      11. associate-*l*53.9%

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

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 + \frac{-0.25 \cdot \left(D \cdot D\right)}{\frac{\frac{d \cdot \left(d \cdot \ell\right)}{h}}{M \cdot M}}}} \]
    7. Taylor expanded in D around 0 53.2%

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 + \frac{-0.25 \cdot \left({D}^{2} \cdot \left(h \cdot \color{blue}{{M}^{2}}\right)\right)}{{d}^{2} \cdot \ell}} \]
      5. associate-*r/53.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq -1 \cdot 10^{+102}:\\ \;\;\;\;w0 + w0 \cdot \left(-0.125 \cdot \left(D \cdot \left(\frac{D}{\ell} \cdot \left(\frac{M}{d} \cdot \left(M \cdot \frac{h}{d}\right)\right)\right)\right)\right)\\ \mathbf{elif}\;M \leq -2 \cdot 10^{-161}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25}{d \cdot \ell} \cdot \left(\frac{D}{d} \cdot \left(D \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\right)}\\ \mathbf{elif}\;M \leq 7 \cdot 10^{-203}:\\ \;\;\;\;w0 \cdot \left(1 + \frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \frac{\frac{M}{d} \cdot \left(M \cdot h\right)}{d}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(D \cdot \left(\frac{D}{\ell} \cdot \left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)\right)\right) \cdot -0.25}\\ \end{array} \]

Alternative 8: 79.1% accurate, 1.7× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;M \leq -1 \cdot 10^{+101}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \frac{0.25}{\ell}}{\frac{d}{M} \cdot \frac{d}{M}}}\\ \mathbf{elif}\;M \leq -1.4 \cdot 10^{-162}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25}{d \cdot \ell} \cdot \left(\frac{D}{d} \cdot \left(D \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\right)}\\ \mathbf{elif}\;M \leq 5 \cdot 10^{-203}:\\ \;\;\;\;w0 \cdot \left(1 + \frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \frac{\frac{M}{d} \cdot \left(M \cdot h\right)}{d}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(D \cdot \left(\frac{D}{\ell} \cdot \left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)\right)\right) \cdot -0.25}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= M -1e+101)
   (* w0 (sqrt (- 1.0 (/ (* (* D (* D h)) (/ 0.25 l)) (* (/ d M) (/ d M))))))
   (if (<= M -1.4e-162)
     (* w0 (sqrt (- 1.0 (* (/ 0.25 (* d l)) (* (/ D d) (* D (* h (* M M))))))))
     (if (<= M 5e-203)
       (* w0 (+ 1.0 (* (/ -0.125 l) (* D (* D (/ (* (/ M d) (* M h)) d))))))
       (*
        w0
        (sqrt
         (+ 1.0 (* (* D (* (/ D l) (* (/ (* M M) d) (/ h d)))) -0.25))))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= -1e+101) {
		tmp = w0 * sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))));
	} else if (M <= -1.4e-162) {
		tmp = w0 * sqrt((1.0 - ((0.25 / (d * l)) * ((D / d) * (D * (h * (M * M)))))));
	} else if (M <= 5e-203) {
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))));
	} else {
		tmp = w0 * sqrt((1.0 + ((D * ((D / l) * (((M * M) / d) * (h / d)))) * -0.25)));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (m <= (-1d+101)) then
        tmp = w0 * sqrt((1.0d0 - (((d * (d * h)) * (0.25d0 / l)) / ((d_1 / m) * (d_1 / m)))))
    else if (m <= (-1.4d-162)) then
        tmp = w0 * sqrt((1.0d0 - ((0.25d0 / (d_1 * l)) * ((d / d_1) * (d * (h * (m * m)))))))
    else if (m <= 5d-203) then
        tmp = w0 * (1.0d0 + (((-0.125d0) / l) * (d * (d * (((m / d_1) * (m * h)) / d_1)))))
    else
        tmp = w0 * sqrt((1.0d0 + ((d * ((d / l) * (((m * m) / d_1) * (h / d_1)))) * (-0.25d0))))
    end if
    code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= -1e+101) {
		tmp = w0 * Math.sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))));
	} else if (M <= -1.4e-162) {
		tmp = w0 * Math.sqrt((1.0 - ((0.25 / (d * l)) * ((D / d) * (D * (h * (M * M)))))));
	} else if (M <= 5e-203) {
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))));
	} else {
		tmp = w0 * Math.sqrt((1.0 + ((D * ((D / l) * (((M * M) / d) * (h / d)))) * -0.25)));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	tmp = 0
	if M <= -1e+101:
		tmp = w0 * math.sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))))
	elif M <= -1.4e-162:
		tmp = w0 * math.sqrt((1.0 - ((0.25 / (d * l)) * ((D / d) * (D * (h * (M * M)))))))
	elif M <= 5e-203:
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))))
	else:
		tmp = w0 * math.sqrt((1.0 + ((D * ((D / l) * (((M * M) / d) * (h / d)))) * -0.25)))
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (M <= -1e+101)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(D * Float64(D * h)) * Float64(0.25 / l)) / Float64(Float64(d / M) * Float64(d / M))))));
	elseif (M <= -1.4e-162)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(0.25 / Float64(d * l)) * Float64(Float64(D / d) * Float64(D * Float64(h * Float64(M * M))))))));
	elseif (M <= 5e-203)
		tmp = Float64(w0 * Float64(1.0 + Float64(Float64(-0.125 / l) * Float64(D * Float64(D * Float64(Float64(Float64(M / d) * Float64(M * h)) / d))))));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(D * Float64(Float64(D / l) * Float64(Float64(Float64(M * M) / d) * Float64(h / d)))) * -0.25))));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if (M <= -1e+101)
		tmp = w0 * sqrt((1.0 - (((D * (D * h)) * (0.25 / l)) / ((d / M) * (d / M)))));
	elseif (M <= -1.4e-162)
		tmp = w0 * sqrt((1.0 - ((0.25 / (d * l)) * ((D / d) * (D * (h * (M * M)))))));
	elseif (M <= 5e-203)
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))));
	else
		tmp = w0 * sqrt((1.0 + ((D * ((D / l) * (((M * M) / d) * (h / d)))) * -0.25)));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, -1e+101], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(D * N[(D * h), $MachinePrecision]), $MachinePrecision] * N[(0.25 / l), $MachinePrecision]), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, -1.4e-162], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(0.25 / N[(d * l), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(D * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 5e-203], N[(w0 * N[(1.0 + N[(N[(-0.125 / l), $MachinePrecision] * N[(D * N[(D * N[(N[(N[(M / d), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(D * N[(N[(D / l), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] / d), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -1 \cdot 10^{+101}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \frac{0.25}{\ell}}{\frac{d}{M} \cdot \frac{d}{M}}}\\

\mathbf{elif}\;M \leq -1.4 \cdot 10^{-162}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25}{d \cdot \ell} \cdot \left(\frac{D}{d} \cdot \left(D \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\right)}\\

\mathbf{elif}\;M \leq 5 \cdot 10^{-203}:\\
\;\;\;\;w0 \cdot \left(1 + \frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \frac{\frac{M}{d} \cdot \left(M \cdot h\right)}{d}\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if M < -9.9999999999999998e100

    1. Initial program 60.3%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative60.3%

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

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 24.2%

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

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}} \]
      2. *-commutative24.2%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25 \cdot \left({D}^{2} \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}\right)}{\ell \cdot {d}^{2}}} \]
      3. times-frac24.2%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25}{\ell} \cdot \frac{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {M}^{2}}{{d}^{2}}} \]
      6. associate-*l*34.4%

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{0.25}{\ell} \cdot \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \left(M \cdot M\right)}{d \cdot d}}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity34.4%

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

        \[\leadsto w0 \cdot \left(1 \cdot \sqrt{1 - \color{blue}{\frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \left(M \cdot M\right)}{d \cdot d} \cdot \frac{0.25}{\ell}}}\right) \]
      3. associate-/l*37.5%

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

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

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

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

    if -9.9999999999999998e100 < M < -1.40000000000000011e-162

    1. Initial program 90.1%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative90.1%

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

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 71.8%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25 \cdot \left({D}^{2} \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}\right)}{\ell \cdot {d}^{2}}} \]
      3. times-frac73.7%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25}{\ell} \cdot \frac{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {M}^{2}}{{d}^{2}}} \]
      6. associate-*l*72.2%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{0.25}{\ell} \cdot \frac{\color{blue}{\left(D \cdot \left(D \cdot h\right)\right)} \cdot {M}^{2}}{{d}^{2}}} \]
      7. unpow272.2%

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{0.25}{\ell} \cdot \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \left(M \cdot M\right)}{d \cdot d}}} \]
    7. Step-by-step derivation
      1. associate-*r/72.1%

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{0.25}{\ell} \cdot \left(D \cdot \left(\left(h \cdot D\right) \cdot \left(M \cdot M\right)\right)\right)}{d \cdot d}}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity79.1%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{1 \cdot \frac{\frac{0.25}{\ell} \cdot \left(D \cdot \left(\left(h \cdot D\right) \cdot \left(M \cdot M\right)\right)\right)}{d \cdot d}}} \]
      2. times-frac90.7%

        \[\leadsto w0 \cdot \sqrt{1 - 1 \cdot \color{blue}{\left(\frac{\frac{0.25}{\ell}}{d} \cdot \frac{D \cdot \left(\left(h \cdot D\right) \cdot \left(M \cdot M\right)\right)}{d}\right)}} \]
      3. *-commutative90.7%

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{1 \cdot \left(\frac{\frac{0.25}{\ell}}{d} \cdot \frac{D \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot D\right)\right)}{d}\right)}} \]
    11. Step-by-step derivation
      1. *-lft-identity90.7%

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

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{0.25}{\ell \cdot d}} \cdot \frac{D \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot D\right)\right)}{d}} \]
      3. associate-/l*92.4%

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

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

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

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

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

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

    if -1.40000000000000011e-162 < M < 5.0000000000000002e-203

    1. Initial program 89.6%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative89.6%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac89.7%

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    3. Simplified89.7%

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

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

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h \cdot {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2}}{\ell}} \]
      7. div-inv95.6%

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}{\ell}}} \]
    6. Taylor expanded in h around 0 68.2%

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

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

        \[\leadsto w0 \cdot \color{blue}{\left(\frac{-0.125}{\ell} \cdot \left(\left(D \cdot D\right) \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right) + 1\right)} \]
      2. associate-*l*86.6%

        \[\leadsto w0 \cdot \left(\frac{-0.125}{\ell} \cdot \color{blue}{\left(D \cdot \left(D \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right)\right)} + 1\right) \]
      3. associate-/r/86.6%

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

      \[\leadsto w0 \cdot \color{blue}{\left(\frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \left(\left(\frac{M}{d} \cdot M\right) \cdot \frac{h}{d}\right)\right)\right) + 1\right)} \]
    10. Step-by-step derivation
      1. associate-*r/91.2%

        \[\leadsto w0 \cdot \left(\frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \color{blue}{\frac{\left(\frac{M}{d} \cdot M\right) \cdot h}{d}}\right)\right) + 1\right) \]
      2. associate-*l*92.8%

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

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

    if 5.0000000000000002e-203 < M

    1. Initial program 71.5%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative71.5%

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

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in w0 around 0 53.2%

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

        \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}}} \]
      2. cancel-sign-sub-inv53.2%

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 + -0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{\ell \cdot {d}^{2}}{h \cdot {M}^{2}}}}} \]
      6. associate-*r/53.3%

        \[\leadsto w0 \cdot \sqrt{1 + \color{blue}{\frac{-0.25 \cdot {D}^{2}}{\frac{\ell \cdot {d}^{2}}{h \cdot {M}^{2}}}}} \]
      7. unpow253.3%

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 + \frac{-0.25 \cdot \left(D \cdot D\right)}{\frac{\frac{\color{blue}{\left(d \cdot d\right)} \cdot \ell}{h}}{{M}^{2}}}} \]
      11. associate-*l*53.9%

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

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 + \frac{-0.25 \cdot \left(D \cdot D\right)}{\frac{\frac{d \cdot \left(d \cdot \ell\right)}{h}}{M \cdot M}}}} \]
    7. Taylor expanded in D around 0 53.2%

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 + \frac{-0.25 \cdot \left({D}^{2} \cdot \left(h \cdot \color{blue}{{M}^{2}}\right)\right)}{{d}^{2} \cdot \ell}} \]
      5. associate-*r/53.2%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq -1 \cdot 10^{+101}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(D \cdot \left(D \cdot h\right)\right) \cdot \frac{0.25}{\ell}}{\frac{d}{M} \cdot \frac{d}{M}}}\\ \mathbf{elif}\;M \leq -1.4 \cdot 10^{-162}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{0.25}{d \cdot \ell} \cdot \left(\frac{D}{d} \cdot \left(D \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\right)}\\ \mathbf{elif}\;M \leq 5 \cdot 10^{-203}:\\ \;\;\;\;w0 \cdot \left(1 + \frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \frac{\frac{M}{d} \cdot \left(M \cdot h\right)}{d}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(D \cdot \left(\frac{D}{\ell} \cdot \left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)\right)\right) \cdot -0.25}\\ \end{array} \]

Alternative 9: 72.7% accurate, 1.8× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;w0 \leq -1 \cdot 10^{-265}:\\ \;\;\;\;w0 \cdot \left(1 + \frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \frac{\frac{M}{d} \cdot \left(M \cdot h\right)}{d}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(D \cdot \left(\frac{D}{\ell} \cdot \left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)\right)\right) \cdot -0.25}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= w0 -1e-265)
   (* w0 (+ 1.0 (* (/ -0.125 l) (* D (* D (/ (* (/ M d) (* M h)) d))))))
   (*
    w0
    (sqrt (+ 1.0 (* (* D (* (/ D l) (* (/ (* M M) d) (/ h d)))) -0.25))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (w0 <= -1e-265) {
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))));
	} else {
		tmp = w0 * sqrt((1.0 + ((D * ((D / l) * (((M * M) / d) * (h / d)))) * -0.25)));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (w0 <= (-1d-265)) then
        tmp = w0 * (1.0d0 + (((-0.125d0) / l) * (d * (d * (((m / d_1) * (m * h)) / d_1)))))
    else
        tmp = w0 * sqrt((1.0d0 + ((d * ((d / l) * (((m * m) / d_1) * (h / d_1)))) * (-0.25d0))))
    end if
    code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (w0 <= -1e-265) {
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))));
	} else {
		tmp = w0 * Math.sqrt((1.0 + ((D * ((D / l) * (((M * M) / d) * (h / d)))) * -0.25)));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	tmp = 0
	if w0 <= -1e-265:
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))))
	else:
		tmp = w0 * math.sqrt((1.0 + ((D * ((D / l) * (((M * M) / d) * (h / d)))) * -0.25)))
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (w0 <= -1e-265)
		tmp = Float64(w0 * Float64(1.0 + Float64(Float64(-0.125 / l) * Float64(D * Float64(D * Float64(Float64(Float64(M / d) * Float64(M * h)) / d))))));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(D * Float64(Float64(D / l) * Float64(Float64(Float64(M * M) / d) * Float64(h / d)))) * -0.25))));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if (w0 <= -1e-265)
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))));
	else
		tmp = w0 * sqrt((1.0 + ((D * ((D / l) * (((M * M) / d) * (h / d)))) * -0.25)));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[w0, -1e-265], N[(w0 * N[(1.0 + N[(N[(-0.125 / l), $MachinePrecision] * N[(D * N[(D * N[(N[(N[(M / d), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(D * N[(N[(D / l), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] / d), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;w0 \leq -1 \cdot 10^{-265}:\\
\;\;\;\;w0 \cdot \left(1 + \frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \frac{\frac{M}{d} \cdot \left(M \cdot h\right)}{d}\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w0 < -9.99999999999999985e-266

    1. Initial program 79.9%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative79.9%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac80.7%

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    3. Simplified80.7%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\color{blue}{\left(\frac{M \cdot D}{d \cdot 2}\right)}}^{2}} \]
      3. *-commutative79.9%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2}}{\ell}} \]
      6. frac-times87.9%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h \cdot {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2}}{\ell}} \]
      7. div-inv87.9%

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}{\ell}}} \]
    6. Taylor expanded in h around 0 55.1%

      \[\leadsto w0 \cdot \color{blue}{\left(1 + -0.125 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{\ell \cdot {d}^{2}}\right)} \]
    7. Simplified65.3%

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

        \[\leadsto w0 \cdot \color{blue}{\left(\frac{-0.125}{\ell} \cdot \left(\left(D \cdot D\right) \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right) + 1\right)} \]
      2. associate-*l*74.1%

        \[\leadsto w0 \cdot \left(\frac{-0.125}{\ell} \cdot \color{blue}{\left(D \cdot \left(D \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right)\right)} + 1\right) \]
      3. associate-/r/74.1%

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

      \[\leadsto w0 \cdot \color{blue}{\left(\frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \left(\left(\frac{M}{d} \cdot M\right) \cdot \frac{h}{d}\right)\right)\right) + 1\right)} \]
    10. Step-by-step derivation
      1. associate-*r/75.0%

        \[\leadsto w0 \cdot \left(\frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \color{blue}{\frac{\left(\frac{M}{d} \cdot M\right) \cdot h}{d}}\right)\right) + 1\right) \]
      2. associate-*l*76.0%

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

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

    if -9.99999999999999985e-266 < w0

    1. Initial program 78.6%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative78.6%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac78.0%

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    3. Simplified78.0%

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in w0 around 0 58.8%

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

        \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2} \cdot \ell}}} \]
      2. cancel-sign-sub-inv58.8%

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 + -0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{\ell \cdot {d}^{2}}{h \cdot {M}^{2}}}}} \]
      6. associate-*r/59.5%

        \[\leadsto w0 \cdot \sqrt{1 + \color{blue}{\frac{-0.25 \cdot {D}^{2}}{\frac{\ell \cdot {d}^{2}}{h \cdot {M}^{2}}}}} \]
      7. unpow259.5%

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

        \[\leadsto w0 \cdot \sqrt{1 + \frac{-0.25 \cdot \left(D \cdot D\right)}{\color{blue}{\frac{\frac{\ell \cdot {d}^{2}}{h}}{{M}^{2}}}}} \]
      9. *-commutative59.0%

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

        \[\leadsto w0 \cdot \sqrt{1 + \frac{-0.25 \cdot \left(D \cdot D\right)}{\frac{\frac{\color{blue}{\left(d \cdot d\right)} \cdot \ell}{h}}{{M}^{2}}}} \]
      11. associate-*l*62.6%

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

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 + \frac{-0.25 \cdot \left(D \cdot D\right)}{\frac{\frac{d \cdot \left(d \cdot \ell\right)}{h}}{M \cdot M}}}} \]
    7. Taylor expanded in D around 0 58.8%

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 + \frac{-0.25 \cdot \left({D}^{2} \cdot \left(h \cdot \color{blue}{{M}^{2}}\right)\right)}{{d}^{2} \cdot \ell}} \]
      5. associate-*r/58.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;w0 \leq -1 \cdot 10^{-265}:\\ \;\;\;\;w0 \cdot \left(1 + \frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \frac{\frac{M}{d} \cdot \left(M \cdot h\right)}{d}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(D \cdot \left(\frac{D}{\ell} \cdot \left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)\right)\right) \cdot -0.25}\\ \end{array} \]

Alternative 10: 74.1% accurate, 8.6× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;M \leq -4.2 \cdot 10^{-10} \lor \neg \left(M \leq 2.5 \cdot 10^{-59}\right):\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \frac{M \cdot \frac{h}{d}}{\frac{d}{M}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (if (or (<= M -4.2e-10) (not (<= M 2.5e-59)))
   (* w0 (+ 1.0 (* -0.125 (* (* D (/ D l)) (/ (* M (/ h d)) (/ d M))))))
   w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((M <= -4.2e-10) || !(M <= 2.5e-59)) {
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((M * (h / d)) / (d / M)))));
	} else {
		tmp = w0;
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if ((m <= (-4.2d-10)) .or. (.not. (m <= 2.5d-59))) then
        tmp = w0 * (1.0d0 + ((-0.125d0) * ((d * (d / l)) * ((m * (h / d_1)) / (d_1 / m)))))
    else
        tmp = w0
    end if
    code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((M <= -4.2e-10) || !(M <= 2.5e-59)) {
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((M * (h / d)) / (d / M)))));
	} else {
		tmp = w0;
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	tmp = 0
	if (M <= -4.2e-10) or not (M <= 2.5e-59):
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((M * (h / d)) / (d / M)))))
	else:
		tmp = w0
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if ((M <= -4.2e-10) || !(M <= 2.5e-59))
		tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(D * Float64(D / l)) * Float64(Float64(M * Float64(h / d)) / Float64(d / M))))));
	else
		tmp = w0;
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if ((M <= -4.2e-10) || ~((M <= 2.5e-59)))
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((M * (h / d)) / (d / M)))));
	else
		tmp = w0;
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := If[Or[LessEqual[M, -4.2e-10], N[Not[LessEqual[M, 2.5e-59]], $MachinePrecision]], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h / d), $MachinePrecision]), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -4.2 \cdot 10^{-10} \lor \neg \left(M \leq 2.5 \cdot 10^{-59}\right):\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \frac{M \cdot \frac{h}{d}}{\frac{d}{M}}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < -4.2e-10 or 2.5000000000000001e-59 < M

    1. Initial program 71.7%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative71.7%

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

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 42.1%

      \[\leadsto w0 \cdot \color{blue}{\left(1 + -0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/42.1%

        \[\leadsto w0 \cdot \left(1 + \color{blue}{\frac{-0.125 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}\right) \]
      2. *-commutative42.1%

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

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

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

        \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{h \cdot {M}^{2}}{{d}^{2}}\right)} \cdot -0.125\right) \]
      6. unpow242.3%

        \[\leadsto w0 \cdot \left(1 + \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{h \cdot {M}^{2}}{{d}^{2}}\right) \cdot -0.125\right) \]
      7. *-commutative42.3%

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

        \[\leadsto w0 \cdot \left(1 + \left(\frac{D \cdot D}{\ell} \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{{d}^{2}}\right) \cdot -0.125\right) \]
      9. unpow242.3%

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

      \[\leadsto w0 \cdot \color{blue}{\left(1 + \left(\frac{D \cdot D}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot h}{d \cdot d}\right) \cdot -0.125\right)} \]
    7. Taylor expanded in D around 0 42.1%

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

        \[\leadsto w0 \cdot \left(1 + \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{\ell \cdot {d}^{2}}} \cdot -0.125\right) \]
      2. times-frac42.3%

        \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)} \cdot -0.125\right) \]
      3. unpow242.3%

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

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

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

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

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

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

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

      \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right)} \cdot -0.125\right) \]
    10. Step-by-step derivation
      1. associate-*l/61.0%

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

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

    if -4.2e-10 < M < 2.5000000000000001e-59

    1. Initial program 85.3%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative85.3%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac85.3%

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 84.0%

      \[\leadsto \color{blue}{w0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification73.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq -4.2 \cdot 10^{-10} \lor \neg \left(M \leq 2.5 \cdot 10^{-59}\right):\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \frac{M \cdot \frac{h}{d}}{\frac{d}{M}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]

Alternative 11: 72.2% accurate, 8.6× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -5.6 \cdot 10^{-74}:\\ \;\;\;\;w0\\ \mathbf{elif}\;d \leq 2.9 \cdot 10^{-8}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(\frac{h}{d} \cdot \frac{M}{\frac{d}{M}}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= d -5.6e-74)
   w0
   (if (<= d 2.9e-8)
     (* w0 (+ 1.0 (* -0.125 (* (* D (/ D l)) (* (/ h d) (/ M (/ d M)))))))
     w0)))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (d <= -5.6e-74) {
		tmp = w0;
	} else if (d <= 2.9e-8) {
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((h / d) * (M / (d / M))))));
	} else {
		tmp = w0;
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d_1 <= (-5.6d-74)) then
        tmp = w0
    else if (d_1 <= 2.9d-8) then
        tmp = w0 * (1.0d0 + ((-0.125d0) * ((d * (d / l)) * ((h / d_1) * (m / (d_1 / m))))))
    else
        tmp = w0
    end if
    code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (d <= -5.6e-74) {
		tmp = w0;
	} else if (d <= 2.9e-8) {
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((h / d) * (M / (d / M))))));
	} else {
		tmp = w0;
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	tmp = 0
	if d <= -5.6e-74:
		tmp = w0
	elif d <= 2.9e-8:
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((h / d) * (M / (d / M))))))
	else:
		tmp = w0
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (d <= -5.6e-74)
		tmp = w0;
	elseif (d <= 2.9e-8)
		tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(D * Float64(D / l)) * Float64(Float64(h / d) * Float64(M / Float64(d / M)))))));
	else
		tmp = w0;
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if (d <= -5.6e-74)
		tmp = w0;
	elseif (d <= 2.9e-8)
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((h / d) * (M / (d / M))))));
	else
		tmp = w0;
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[d, -5.6e-74], w0, If[LessEqual[d, 2.9e-8], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(h / d), $MachinePrecision] * N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5.6 \cdot 10^{-74}:\\
\;\;\;\;w0\\

\mathbf{elif}\;d \leq 2.9 \cdot 10^{-8}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(\frac{h}{d} \cdot \frac{M}{\frac{d}{M}}\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -5.59999999999999976e-74 or 2.9000000000000002e-8 < d

    1. Initial program 81.1%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative81.1%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac82.9%

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    3. Simplified82.9%

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 81.7%

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

    if -5.59999999999999976e-74 < d < 2.9000000000000002e-8

    1. Initial program 76.0%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative76.0%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac73.0%

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    3. Simplified73.0%

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 40.8%

      \[\leadsto w0 \cdot \color{blue}{\left(1 + -0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/40.8%

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

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

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

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

        \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{h \cdot {M}^{2}}{{d}^{2}}\right)} \cdot -0.125\right) \]
      6. unpow243.9%

        \[\leadsto w0 \cdot \left(1 + \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{h \cdot {M}^{2}}{{d}^{2}}\right) \cdot -0.125\right) \]
      7. *-commutative43.9%

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

        \[\leadsto w0 \cdot \left(1 + \left(\frac{D \cdot D}{\ell} \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{{d}^{2}}\right) \cdot -0.125\right) \]
      9. unpow243.9%

        \[\leadsto w0 \cdot \left(1 + \left(\frac{D \cdot D}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot h}{\color{blue}{d \cdot d}}\right) \cdot -0.125\right) \]
    6. Simplified43.9%

      \[\leadsto w0 \cdot \color{blue}{\left(1 + \left(\frac{D \cdot D}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot h}{d \cdot d}\right) \cdot -0.125\right)} \]
    7. Taylor expanded in D around 0 40.8%

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

        \[\leadsto w0 \cdot \left(1 + \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{\ell \cdot {d}^{2}}} \cdot -0.125\right) \]
      2. times-frac43.9%

        \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)} \cdot -0.125\right) \]
      3. unpow243.9%

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

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

        \[\leadsto w0 \cdot \left(1 + \left(\frac{{D}^{2}}{\ell} \cdot \color{blue}{\left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)}\right) \cdot -0.125\right) \]
      6. unpow255.7%

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

        \[\leadsto w0 \cdot \left(1 + \left(\color{blue}{\left(\frac{D}{\ell} \cdot D\right)} \cdot \left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)\right) \cdot -0.125\right) \]
      8. *-commutative57.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -5.6 \cdot 10^{-74}:\\ \;\;\;\;w0\\ \mathbf{elif}\;d \leq 2.9 \cdot 10^{-8}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(\frac{h}{d} \cdot \frac{M}{\frac{d}{M}}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]

Alternative 12: 73.5% accurate, 8.6× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -1.4 \cdot 10^{-73}:\\ \;\;\;\;w0\\ \mathbf{elif}\;d \leq 3.1 \cdot 10^{-9}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \frac{h \cdot \left(M \cdot \frac{M}{d}\right)}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= d -1.4e-73)
   w0
   (if (<= d 3.1e-9)
     (* w0 (+ 1.0 (* -0.125 (* (* D (/ D l)) (/ (* h (* M (/ M d))) d)))))
     w0)))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (d <= -1.4e-73) {
		tmp = w0;
	} else if (d <= 3.1e-9) {
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((h * (M * (M / d))) / d))));
	} else {
		tmp = w0;
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d_1 <= (-1.4d-73)) then
        tmp = w0
    else if (d_1 <= 3.1d-9) then
        tmp = w0 * (1.0d0 + ((-0.125d0) * ((d * (d / l)) * ((h * (m * (m / d_1))) / d_1))))
    else
        tmp = w0
    end if
    code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (d <= -1.4e-73) {
		tmp = w0;
	} else if (d <= 3.1e-9) {
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((h * (M * (M / d))) / d))));
	} else {
		tmp = w0;
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	tmp = 0
	if d <= -1.4e-73:
		tmp = w0
	elif d <= 3.1e-9:
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((h * (M * (M / d))) / d))))
	else:
		tmp = w0
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (d <= -1.4e-73)
		tmp = w0;
	elseif (d <= 3.1e-9)
		tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(D * Float64(D / l)) * Float64(Float64(h * Float64(M * Float64(M / d))) / d)))));
	else
		tmp = w0;
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if (d <= -1.4e-73)
		tmp = w0;
	elseif (d <= 3.1e-9)
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((h * (M * (M / d))) / d))));
	else
		tmp = w0;
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[d, -1.4e-73], w0, If[LessEqual[d, 3.1e-9], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.4 \cdot 10^{-73}:\\
\;\;\;\;w0\\

\mathbf{elif}\;d \leq 3.1 \cdot 10^{-9}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \frac{h \cdot \left(M \cdot \frac{M}{d}\right)}{d}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -1.40000000000000006e-73 or 3.10000000000000005e-9 < d

    1. Initial program 81.1%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative81.1%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac82.9%

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    3. Simplified82.9%

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 81.7%

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

    if -1.40000000000000006e-73 < d < 3.10000000000000005e-9

    1. Initial program 76.0%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative76.0%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac73.0%

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    3. Simplified73.0%

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 40.8%

      \[\leadsto w0 \cdot \color{blue}{\left(1 + -0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/40.8%

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

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

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

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

        \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{h \cdot {M}^{2}}{{d}^{2}}\right)} \cdot -0.125\right) \]
      6. unpow243.9%

        \[\leadsto w0 \cdot \left(1 + \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{h \cdot {M}^{2}}{{d}^{2}}\right) \cdot -0.125\right) \]
      7. *-commutative43.9%

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

        \[\leadsto w0 \cdot \left(1 + \left(\frac{D \cdot D}{\ell} \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{{d}^{2}}\right) \cdot -0.125\right) \]
      9. unpow243.9%

        \[\leadsto w0 \cdot \left(1 + \left(\frac{D \cdot D}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot h}{\color{blue}{d \cdot d}}\right) \cdot -0.125\right) \]
    6. Simplified43.9%

      \[\leadsto w0 \cdot \color{blue}{\left(1 + \left(\frac{D \cdot D}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot h}{d \cdot d}\right) \cdot -0.125\right)} \]
    7. Taylor expanded in D around 0 40.8%

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

        \[\leadsto w0 \cdot \left(1 + \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{\ell \cdot {d}^{2}}} \cdot -0.125\right) \]
      2. times-frac43.9%

        \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)} \cdot -0.125\right) \]
      3. unpow243.9%

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

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

        \[\leadsto w0 \cdot \left(1 + \left(\frac{{D}^{2}}{\ell} \cdot \color{blue}{\left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)}\right) \cdot -0.125\right) \]
      6. unpow255.7%

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

        \[\leadsto w0 \cdot \left(1 + \left(\color{blue}{\left(\frac{D}{\ell} \cdot D\right)} \cdot \left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)\right) \cdot -0.125\right) \]
      8. *-commutative57.9%

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

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

      \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right)} \cdot -0.125\right) \]
    10. Step-by-step derivation
      1. associate-*r/61.2%

        \[\leadsto w0 \cdot \left(1 + \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \color{blue}{\frac{\frac{M}{\frac{d}{M}} \cdot h}{d}}\right) \cdot -0.125\right) \]
      2. associate-/r/61.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.4 \cdot 10^{-73}:\\ \;\;\;\;w0\\ \mathbf{elif}\;d \leq 3.1 \cdot 10^{-9}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \frac{h \cdot \left(M \cdot \frac{M}{d}\right)}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]

Alternative 13: 73.8% accurate, 8.6× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;M \leq -7 \cdot 10^{-11}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \frac{M \cdot \frac{h}{d}}{\frac{d}{M}}\right)\right)\\ \mathbf{elif}\;M \leq 5 \cdot 10^{-59}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \frac{\left(\frac{M}{d} \cdot \left(M \cdot h\right)\right) \cdot \frac{D \cdot D}{\ell}}{d}\right)\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= M -7e-11)
   (* w0 (+ 1.0 (* -0.125 (* (* D (/ D l)) (/ (* M (/ h d)) (/ d M))))))
   (if (<= M 5e-59)
     w0
     (* w0 (+ 1.0 (* -0.125 (/ (* (* (/ M d) (* M h)) (/ (* D D) l)) d)))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= -7e-11) {
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((M * (h / d)) / (d / M)))));
	} else if (M <= 5e-59) {
		tmp = w0;
	} else {
		tmp = w0 * (1.0 + (-0.125 * ((((M / d) * (M * h)) * ((D * D) / l)) / d)));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (m <= (-7d-11)) then
        tmp = w0 * (1.0d0 + ((-0.125d0) * ((d * (d / l)) * ((m * (h / d_1)) / (d_1 / m)))))
    else if (m <= 5d-59) then
        tmp = w0
    else
        tmp = w0 * (1.0d0 + ((-0.125d0) * ((((m / d_1) * (m * h)) * ((d * d) / l)) / d_1)))
    end if
    code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= -7e-11) {
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((M * (h / d)) / (d / M)))));
	} else if (M <= 5e-59) {
		tmp = w0;
	} else {
		tmp = w0 * (1.0 + (-0.125 * ((((M / d) * (M * h)) * ((D * D) / l)) / d)));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	tmp = 0
	if M <= -7e-11:
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((M * (h / d)) / (d / M)))))
	elif M <= 5e-59:
		tmp = w0
	else:
		tmp = w0 * (1.0 + (-0.125 * ((((M / d) * (M * h)) * ((D * D) / l)) / d)))
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (M <= -7e-11)
		tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(D * Float64(D / l)) * Float64(Float64(M * Float64(h / d)) / Float64(d / M))))));
	elseif (M <= 5e-59)
		tmp = w0;
	else
		tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(Float64(M / d) * Float64(M * h)) * Float64(Float64(D * D) / l)) / d))));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if (M <= -7e-11)
		tmp = w0 * (1.0 + (-0.125 * ((D * (D / l)) * ((M * (h / d)) / (d / M)))));
	elseif (M <= 5e-59)
		tmp = w0;
	else
		tmp = w0 * (1.0 + (-0.125 * ((((M / d) * (M * h)) * ((D * D) / l)) / d)));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, -7e-11], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(h / d), $MachinePrecision]), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 5e-59], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(N[(M / d), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] * N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -7 \cdot 10^{-11}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \frac{M \cdot \frac{h}{d}}{\frac{d}{M}}\right)\right)\\

\mathbf{elif}\;M \leq 5 \cdot 10^{-59}:\\
\;\;\;\;w0\\

\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \frac{\left(\frac{M}{d} \cdot \left(M \cdot h\right)\right) \cdot \frac{D \cdot D}{\ell}}{d}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < -7.00000000000000038e-11

    1. Initial program 71.1%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative71.1%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac69.0%

        \[\leadsto w0 \cdot \sqrt{1 - {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2} \cdot \frac{h}{\ell}} \]
    3. Simplified69.0%

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 34.1%

      \[\leadsto w0 \cdot \color{blue}{\left(1 + -0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/34.1%

        \[\leadsto w0 \cdot \left(1 + \color{blue}{\frac{-0.125 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\ell \cdot {d}^{2}}}\right) \]
      2. *-commutative34.1%

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

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

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

        \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{h \cdot {M}^{2}}{{d}^{2}}\right)} \cdot -0.125\right) \]
      6. unpow236.2%

        \[\leadsto w0 \cdot \left(1 + \left(\frac{\color{blue}{D \cdot D}}{\ell} \cdot \frac{h \cdot {M}^{2}}{{d}^{2}}\right) \cdot -0.125\right) \]
      7. *-commutative36.2%

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

        \[\leadsto w0 \cdot \left(1 + \left(\frac{D \cdot D}{\ell} \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{{d}^{2}}\right) \cdot -0.125\right) \]
      9. unpow236.2%

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

      \[\leadsto w0 \cdot \color{blue}{\left(1 + \left(\frac{D \cdot D}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot h}{d \cdot d}\right) \cdot -0.125\right)} \]
    7. Taylor expanded in D around 0 34.1%

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

        \[\leadsto w0 \cdot \left(1 + \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{\ell \cdot {d}^{2}}} \cdot -0.125\right) \]
      2. times-frac36.2%

        \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\frac{{D}^{2}}{\ell} \cdot \frac{{M}^{2} \cdot h}{{d}^{2}}\right)} \cdot -0.125\right) \]
      3. unpow236.2%

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

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

        \[\leadsto w0 \cdot \left(1 + \left(\frac{{D}^{2}}{\ell} \cdot \color{blue}{\left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)}\right) \cdot -0.125\right) \]
      6. unpow243.1%

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

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

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

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

      \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right)} \cdot -0.125\right) \]
    10. Step-by-step derivation
      1. associate-*l/56.2%

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

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

    if -7.00000000000000038e-11 < M < 5.0000000000000001e-59

    1. Initial program 85.3%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative85.3%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac85.3%

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 84.0%

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

    if 5.0000000000000001e-59 < M

    1. Initial program 72.0%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative72.0%

        \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{\color{blue}{d \cdot 2}}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. times-frac73.3%

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 47.5%

      \[\leadsto w0 \cdot \color{blue}{\left(1 + -0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/47.5%

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

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

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

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

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

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

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

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

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

      \[\leadsto w0 \cdot \color{blue}{\left(1 + \left(\frac{D \cdot D}{\ell} \cdot \frac{\left(M \cdot M\right) \cdot h}{d \cdot d}\right) \cdot -0.125\right)} \]
    7. Taylor expanded in D around 0 47.5%

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

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

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

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

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

        \[\leadsto w0 \cdot \left(1 + \left(\frac{{D}^{2}}{\ell} \cdot \color{blue}{\left(\frac{M \cdot M}{d} \cdot \frac{h}{d}\right)}\right) \cdot -0.125\right) \]
      6. unpow250.9%

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

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

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

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

      \[\leadsto w0 \cdot \left(1 + \color{blue}{\left(\left(D \cdot \frac{D}{\ell}\right) \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right)} \cdot -0.125\right) \]
    10. Step-by-step derivation
      1. associate-*r/56.8%

        \[\leadsto w0 \cdot \left(1 + \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \color{blue}{\frac{\frac{M}{\frac{d}{M}} \cdot h}{d}}\right) \cdot -0.125\right) \]
      2. associate-/r/56.8%

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

      \[\leadsto w0 \cdot \left(1 + \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \color{blue}{\frac{\left(\frac{M}{d} \cdot M\right) \cdot h}{d}}\right) \cdot -0.125\right) \]
    12. Step-by-step derivation
      1. associate-*r/56.9%

        \[\leadsto w0 \cdot \left(1 + \color{blue}{\frac{\left(D \cdot \frac{D}{\ell}\right) \cdot \left(\left(\frac{M}{d} \cdot M\right) \cdot h\right)}{d}} \cdot -0.125\right) \]
      2. associate-*r/55.5%

        \[\leadsto w0 \cdot \left(1 + \frac{\color{blue}{\frac{D \cdot D}{\ell}} \cdot \left(\left(\frac{M}{d} \cdot M\right) \cdot h\right)}{d} \cdot -0.125\right) \]
      3. associate-*l*59.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq -7 \cdot 10^{-11}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \frac{M \cdot \frac{h}{d}}{\frac{d}{M}}\right)\right)\\ \mathbf{elif}\;M \leq 5 \cdot 10^{-59}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \frac{\left(\frac{M}{d} \cdot \left(M \cdot h\right)\right) \cdot \frac{D \cdot D}{\ell}}{d}\right)\\ \end{array} \]

Alternative 14: 74.4% accurate, 9.4× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 5.8 \cdot 10^{+69}:\\ \;\;\;\;w0 \cdot \left(1 + \frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \left(\frac{h}{d} \cdot \left(M \cdot \frac{M}{d}\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= l 5.8e+69)
   (* w0 (+ 1.0 (* (/ -0.125 l) (* D (* D (* (/ h d) (* M (/ M d))))))))
   w0))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (l <= 5.8e+69) {
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * ((h / d) * (M * (M / d)))))));
	} else {
		tmp = w0;
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (l <= 5.8d+69) then
        tmp = w0 * (1.0d0 + (((-0.125d0) / l) * (d * (d * ((h / d_1) * (m * (m / d_1)))))))
    else
        tmp = w0
    end if
    code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (l <= 5.8e+69) {
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * ((h / d) * (M * (M / d)))))));
	} else {
		tmp = w0;
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	tmp = 0
	if l <= 5.8e+69:
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * ((h / d) * (M * (M / d)))))))
	else:
		tmp = w0
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (l <= 5.8e+69)
		tmp = Float64(w0 * Float64(1.0 + Float64(Float64(-0.125 / l) * Float64(D * Float64(D * Float64(Float64(h / d) * Float64(M * Float64(M / d))))))));
	else
		tmp = w0;
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if (l <= 5.8e+69)
		tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * ((h / d) * (M * (M / d)))))));
	else
		tmp = w0;
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[l, 5.8e+69], N[(w0 * N[(1.0 + N[(N[(-0.125 / l), $MachinePrecision] * N[(D * N[(D * N[(N[(h / d), $MachinePrecision] * N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.8 \cdot 10^{+69}:\\
\;\;\;\;w0 \cdot \left(1 + \frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \left(\frac{h}{d} \cdot \left(M \cdot \frac{M}{d}\right)\right)\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 5.7999999999999997e69

    1. Initial program 79.4%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative79.4%

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

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

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

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

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{h \cdot {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2}}{\ell}} \]
      7. div-inv87.1%

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}{\ell}}} \]
    6. Taylor expanded in h around 0 57.8%

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

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

        \[\leadsto w0 \cdot \color{blue}{\left(\frac{-0.125}{\ell} \cdot \left(\left(D \cdot D\right) \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right) + 1\right)} \]
      2. associate-*l*75.0%

        \[\leadsto w0 \cdot \left(\frac{-0.125}{\ell} \cdot \color{blue}{\left(D \cdot \left(D \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right)\right)} + 1\right) \]
      3. associate-/r/75.0%

        \[\leadsto w0 \cdot \left(\frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \left(\color{blue}{\left(\frac{M}{d} \cdot M\right)} \cdot \frac{h}{d}\right)\right)\right) + 1\right) \]
    9. Applied egg-rr75.0%

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

    if 5.7999999999999997e69 < l

    1. Initial program 78.2%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. *-commutative78.2%

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

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    4. Taylor expanded in M around 0 78.6%

      \[\leadsto \color{blue}{w0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.7%

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

Alternative 15: 75.5% accurate, 10.3× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ w0 \cdot \left(1 + \frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \frac{\frac{M}{d} \cdot \left(M \cdot h\right)}{d}\right)\right)\right) \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (* w0 (+ 1.0 (* (/ -0.125 l) (* D (* D (/ (* (/ M d) (* M h)) d)))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))));
}
NOTE: M and D should be sorted in increasing order before calling this function.
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 * (1.0d0 + (((-0.125d0) / l) * (d * (d * (((m / d_1) * (m * h)) / d_1)))))
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))));
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	return w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))))
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	return Float64(w0 * Float64(1.0 + Float64(Float64(-0.125 / l) * Float64(D * Float64(D * Float64(Float64(Float64(M / d) * Float64(M * h)) / d))))))
end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
	tmp = w0 * (1.0 + ((-0.125 / l) * (D * (D * (((M / d) * (M * h)) / d)))));
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[(1.0 + N[(N[(-0.125 / l), $MachinePrecision] * N[(D * N[(D * N[(N[(N[(M / d), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \left(1 + \frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \frac{\frac{M}{d} \cdot \left(M \cdot h\right)}{d}\right)\right)\right)
\end{array}
Derivation
  1. Initial program 79.2%

    \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
  2. Step-by-step derivation
    1. *-commutative79.2%

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\color{blue}{\left(\frac{M \cdot D}{d \cdot 2}\right)}}^{2}} \]
    3. *-commutative79.2%

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \frac{h \cdot {\color{blue}{\left(\frac{M}{d} \cdot \frac{D}{2}\right)}}^{2}}{\ell}} \]
    7. div-inv85.1%

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

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

    \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}{\ell}}} \]
  6. Taylor expanded in h around 0 55.0%

    \[\leadsto w0 \cdot \color{blue}{\left(1 + -0.125 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{\ell \cdot {d}^{2}}\right)} \]
  7. Simplified67.1%

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

      \[\leadsto w0 \cdot \color{blue}{\left(\frac{-0.125}{\ell} \cdot \left(\left(D \cdot D\right) \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right) + 1\right)} \]
    2. associate-*l*73.7%

      \[\leadsto w0 \cdot \left(\frac{-0.125}{\ell} \cdot \color{blue}{\left(D \cdot \left(D \cdot \left(\frac{M}{\frac{d}{M}} \cdot \frac{h}{d}\right)\right)\right)} + 1\right) \]
    3. associate-/r/73.7%

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

    \[\leadsto w0 \cdot \color{blue}{\left(\frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \left(\left(\frac{M}{d} \cdot M\right) \cdot \frac{h}{d}\right)\right)\right) + 1\right)} \]
  10. Step-by-step derivation
    1. associate-*r/73.7%

      \[\leadsto w0 \cdot \left(\frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \color{blue}{\frac{\left(\frac{M}{d} \cdot M\right) \cdot h}{d}}\right)\right) + 1\right) \]
    2. associate-*l*74.2%

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

    \[\leadsto w0 \cdot \left(\frac{-0.125}{\ell} \cdot \left(D \cdot \left(D \cdot \color{blue}{\frac{\frac{M}{d} \cdot \left(M \cdot h\right)}{d}}\right)\right) + 1\right) \]
  12. Final simplification74.2%

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

Alternative 16: 67.6% accurate, 216.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ w0 \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d) :precision binary64 w0)
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	return w0;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    code = w0
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	return w0;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	return w0
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	return w0
end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
	tmp = w0;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0
\end{array}
Derivation
  1. Initial program 79.2%

    \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
  2. Step-by-step derivation
    1. *-commutative79.2%

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

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

    \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2} \cdot \frac{h}{\ell}}} \]
  4. Taylor expanded in M around 0 68.3%

    \[\leadsto \color{blue}{w0} \]
  5. Final simplification68.3%

    \[\leadsto w0 \]

Reproduce

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