Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 80.7% → 88.1%
Time: 19.4s
Alternatives: 10
Speedup: 1.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 80.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: 88.1% accurate, 0.7× speedup?

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

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


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

    1. Initial program 99.9%

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

    if 5.00000000000000009e183 < (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)))

    1. Initial program 54.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*58.4%

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

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

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{D}{d}}{\frac{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}{M}}}} \]
    5. Step-by-step derivation
      1. div-inv59.8%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{D}{d} \cdot \frac{1}{\frac{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}{M}}}} \]
      2. *-commutative59.8%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{1}{\frac{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}{M}} \cdot \frac{D}{d}}} \]
      3. clear-num59.8%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{M}{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}} \cdot \frac{D}{d}} \]
      4. associate-/r*59.8%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M}{4}}{\frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}} \cdot \frac{D}{d}} \]
      5. associate-/l/71.6%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M}{4}}{\color{blue}{\frac{\ell}{\frac{M}{\frac{d}{D}} \cdot h}}} \cdot \frac{D}{d}} \]
      6. *-commutative71.6%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M}{4}}{\frac{\ell}{\color{blue}{h \cdot \frac{M}{\frac{d}{D}}}}} \cdot \frac{D}{d}} \]
      7. associate-/r/68.5%

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

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

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

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

Alternative 2: 84.9% accurate, 1.7× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 h l) < -3.9999999e-318

    1. Initial program 82.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. associate-/l*83.8%

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

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

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{D}{d}}{\frac{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}{M}}}} \]
    5. Step-by-step derivation
      1. associate-/r/83.8%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{D}{d}}{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}} \cdot M}} \]
      2. associate-*l/85.0%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{D}{d} \cdot M}{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}}} \]
      3. *-commutative85.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{M \cdot \frac{D}{d}}}{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}} \]
      4. clear-num85.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{M \cdot \color{blue}{\frac{1}{\frac{d}{D}}}}{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}} \]
      5. div-inv85.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M}{\frac{d}{D}}}}{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}} \]
      6. clear-num84.4%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M}{\frac{d}{D}}}{4 \cdot \frac{\color{blue}{\frac{1}{\frac{h}{\ell}}}}{\frac{M}{\frac{d}{D}}}}} \]
      7. associate-/l/84.7%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M}{\frac{d}{D}}}{4 \cdot \color{blue}{\frac{1}{\frac{M}{\frac{d}{D}} \cdot \frac{h}{\ell}}}}} \]
      8. un-div-inv84.7%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M}{\frac{d}{D}}}{\color{blue}{\frac{4}{\frac{M}{\frac{d}{D}} \cdot \frac{h}{\ell}}}}} \]
      9. associate-/l*84.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.9999999e-318 < (/.f64 h l)

    1. Initial program 85.3%

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

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

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

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

Alternative 3: 77.7% accurate, 1.7× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;M_m \cdot D \leq 2.5 \cdot 10^{-290}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{M_m \cdot D}{d \cdot 4} \cdot \frac{\left(M_m \cdot D\right) \cdot \frac{h}{d}}{\ell}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D h l d)
 :precision binary64
 (if (<= (* M_m D) 2.5e-290)
   w0
   (*
    w0
    (sqrt (- 1.0 (* (/ (* M_m D) (* d 4.0)) (/ (* (* M_m D) (/ h d)) l)))))))
M_m = fabs(M);
assert(w0 < M_m && M_m < D && D < h && h < l && l < d);
double code(double w0, double M_m, double D, double h, double l, double d) {
	double tmp;
	if ((M_m * D) <= 2.5e-290) {
		tmp = w0;
	} else {
		tmp = w0 * sqrt((1.0 - (((M_m * D) / (d * 4.0)) * (((M_m * D) * (h / d)) / l))));
	}
	return tmp;
}
M_m = abs(M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m_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_m * d) <= 2.5d-290) then
        tmp = w0
    else
        tmp = w0 * sqrt((1.0d0 - (((m_m * d) / (d_1 * 4.0d0)) * (((m_m * d) * (h / d_1)) / l))))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert w0 < M_m && M_m < D && D < h && h < l && l < d;
public static double code(double w0, double M_m, double D, double h, double l, double d) {
	double tmp;
	if ((M_m * D) <= 2.5e-290) {
		tmp = w0;
	} else {
		tmp = w0 * Math.sqrt((1.0 - (((M_m * D) / (d * 4.0)) * (((M_m * D) * (h / d)) / l))));
	}
	return tmp;
}
M_m = math.fabs(M)
[w0, M_m, D, h, l, d] = sort([w0, M_m, D, h, l, d])
def code(w0, M_m, D, h, l, d):
	tmp = 0
	if (M_m * D) <= 2.5e-290:
		tmp = w0
	else:
		tmp = w0 * math.sqrt((1.0 - (((M_m * D) / (d * 4.0)) * (((M_m * D) * (h / d)) / l))))
	return tmp
M_m = abs(M)
w0, M_m, D, h, l, d = sort([w0, M_m, D, h, l, d])
function code(w0, M_m, D, h, l, d)
	tmp = 0.0
	if (Float64(M_m * D) <= 2.5e-290)
		tmp = w0;
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(M_m * D) / Float64(d * 4.0)) * Float64(Float64(Float64(M_m * D) * Float64(h / d)) / l)))));
	end
	return tmp
end
M_m = abs(M);
w0, M_m, D, h, l, d = num2cell(sort([w0, M_m, D, h, l, d])){:}
function tmp_2 = code(w0, M_m, D, h, l, d)
	tmp = 0.0;
	if ((M_m * D) <= 2.5e-290)
		tmp = w0;
	else
		tmp = w0 * sqrt((1.0 - (((M_m * D) / (d * 4.0)) * (((M_m * D) * (h / d)) / l))));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D_, h_, l_, d_] := If[LessEqual[N[(M$95$m * D), $MachinePrecision], 2.5e-290], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(M$95$m * D), $MachinePrecision] / N[(d * 4.0), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * D), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M_m \cdot D \leq 2.5 \cdot 10^{-290}:\\
\;\;\;\;w0\\

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


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

    1. Initial program 83.1%

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

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

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

    if 2.5e-290 < (*.f64 M D)

    1. Initial program 84.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. associate-/l*85.9%

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

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

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{D}{d}}{\frac{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}{M}}}} \]
    5. Step-by-step derivation
      1. div-inv84.3%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{D}{d} \cdot \frac{1}{\frac{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}{M}}}} \]
      2. *-commutative84.3%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{1}{\frac{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}{M}} \cdot \frac{D}{d}}} \]
      3. clear-num84.3%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{M}{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}} \cdot \frac{D}{d}} \]
      4. associate-/r*84.3%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M}{4}}{\frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}} \cdot \frac{D}{d}} \]
      5. associate-/l/87.7%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M}{4}}{\color{blue}{\frac{\ell}{\frac{M}{\frac{d}{D}} \cdot h}}} \cdot \frac{D}{d}} \]
      6. *-commutative87.7%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M}{4}}{\frac{\ell}{\color{blue}{h \cdot \frac{M}{\frac{d}{D}}}}} \cdot \frac{D}{d}} \]
      7. associate-/r/86.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{M}{\frac{4}{\frac{1}{\color{blue}{\frac{\frac{\ell}{h}}{D \cdot \frac{M}{d}}}}} \cdot \frac{d}{D}}} \]
      11. associate-/r/85.9%

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{M}{\frac{4}{\frac{h}{\ell} \cdot \color{blue}{\frac{D \cdot M}{d}}} \cdot \frac{d}{D}}} \]
      14. *-commutative85.1%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{M}{\frac{4}{\frac{h}{\ell} \cdot \frac{\color{blue}{M \cdot D}}{d}} \cdot \frac{d}{D}}} \]
    8. Applied egg-rr85.1%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{M}{\frac{4}{\frac{h}{\ell} \cdot \frac{M \cdot D}{d}} \cdot \frac{d}{D}}}} \]
    9. Step-by-step derivation
      1. *-commutative85.1%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{M}{\color{blue}{\frac{d}{D} \cdot \frac{4}{\frac{h}{\ell} \cdot \frac{M \cdot D}{d}}}}} \]
      2. associate-/r*85.1%

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M}{\frac{d}{D}}}{\frac{4}{\frac{h}{\ell} \cdot \frac{M \cdot D}{d}}}}} \]
      3. associate-/l*85.1%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{d}}}{\frac{4}{\frac{h}{\ell} \cdot \frac{M \cdot D}{d}}}} \]
      4. associate-/r/85.1%

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{D \cdot M}{4 \cdot d} \cdot \color{blue}{\frac{h \cdot \frac{M \cdot D}{d}}{\ell}}} \]
      8. associate-*r/86.2%

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{D \cdot M}{4 \cdot d} \cdot \frac{\color{blue}{\frac{h}{\frac{d}{M \cdot D}}}}{\ell}} \]
      10. associate-/r/88.5%

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

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

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

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

Alternative 4: 73.6% accurate, 1.8× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;M_m \leq 4.8 \cdot 10^{-158}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 + -0.125 \cdot \frac{\frac{D}{d} \cdot \left(h \cdot \left(w0 \cdot {M_m}^{2}\right)\right)}{\ell \cdot \frac{d}{D}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D h l d)
 :precision binary64
 (if (<= M_m 4.8e-158)
   w0
   (+ w0 (* -0.125 (/ (* (/ D d) (* h (* w0 (pow M_m 2.0)))) (* l (/ d D)))))))
M_m = fabs(M);
assert(w0 < M_m && M_m < D && D < h && h < l && l < d);
double code(double w0, double M_m, double D, double h, double l, double d) {
	double tmp;
	if (M_m <= 4.8e-158) {
		tmp = w0;
	} else {
		tmp = w0 + (-0.125 * (((D / d) * (h * (w0 * pow(M_m, 2.0)))) / (l * (d / D))));
	}
	return tmp;
}
M_m = abs(M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m_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_m <= 4.8d-158) then
        tmp = w0
    else
        tmp = w0 + ((-0.125d0) * (((d / d_1) * (h * (w0 * (m_m ** 2.0d0)))) / (l * (d_1 / d))))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert w0 < M_m && M_m < D && D < h && h < l && l < d;
public static double code(double w0, double M_m, double D, double h, double l, double d) {
	double tmp;
	if (M_m <= 4.8e-158) {
		tmp = w0;
	} else {
		tmp = w0 + (-0.125 * (((D / d) * (h * (w0 * Math.pow(M_m, 2.0)))) / (l * (d / D))));
	}
	return tmp;
}
M_m = math.fabs(M)
[w0, M_m, D, h, l, d] = sort([w0, M_m, D, h, l, d])
def code(w0, M_m, D, h, l, d):
	tmp = 0
	if M_m <= 4.8e-158:
		tmp = w0
	else:
		tmp = w0 + (-0.125 * (((D / d) * (h * (w0 * math.pow(M_m, 2.0)))) / (l * (d / D))))
	return tmp
M_m = abs(M)
w0, M_m, D, h, l, d = sort([w0, M_m, D, h, l, d])
function code(w0, M_m, D, h, l, d)
	tmp = 0.0
	if (M_m <= 4.8e-158)
		tmp = w0;
	else
		tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(h * Float64(w0 * (M_m ^ 2.0)))) / Float64(l * Float64(d / D)))));
	end
	return tmp
end
M_m = abs(M);
w0, M_m, D, h, l, d = num2cell(sort([w0, M_m, D, h, l, d])){:}
function tmp_2 = code(w0, M_m, D, h, l, d)
	tmp = 0.0;
	if (M_m <= 4.8e-158)
		tmp = w0;
	else
		tmp = w0 + (-0.125 * (((D / d) * (h * (w0 * (M_m ^ 2.0)))) / (l * (d / D))));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D_, h_, l_, d_] := If[LessEqual[M$95$m, 4.8e-158], w0, N[(w0 + N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(h * N[(w0 * N[Power[M$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M_m \leq 4.8 \cdot 10^{-158}:\\
\;\;\;\;w0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 4.80000000000000015e-158

    1. Initial program 82.2%

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

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

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

    if 4.80000000000000015e-158 < M

    1. Initial program 86.0%

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

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}} \]
      5. times-frac85.9%

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot \frac{D}{d}}{2}} \cdot \frac{M \cdot D}{2 \cdot d}}{\frac{\ell}{h}}} \]
      7. times-frac86.9%

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot \frac{D}{d}}{2} \cdot \color{blue}{\frac{M \cdot \frac{D}{d}}{2}}}{\frac{\ell}{h}}} \]
      9. frac-times86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 86.8% accurate, 1.8× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\ \\ w0 \cdot \sqrt{1 - \frac{\frac{M_m}{4}}{\frac{\ell}{h \cdot \left(D \cdot \frac{M_m}{d}\right)}} \cdot \frac{D}{d}} \end{array} \]
M_m = (fabs.f64 M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D h l d)
 :precision binary64
 (* w0 (sqrt (- 1.0 (* (/ (/ M_m 4.0) (/ l (* h (* D (/ M_m d))))) (/ D d))))))
M_m = fabs(M);
assert(w0 < M_m && M_m < D && D < h && h < l && l < d);
double code(double w0, double M_m, double D, double h, double l, double d) {
	return w0 * sqrt((1.0 - (((M_m / 4.0) / (l / (h * (D * (M_m / d))))) * (D / d))));
}
M_m = abs(M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m_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_m / 4.0d0) / (l / (h * (d * (m_m / d_1))))) * (d / d_1))))
end function
M_m = Math.abs(M);
assert w0 < M_m && M_m < D && D < h && h < l && l < d;
public static double code(double w0, double M_m, double D, double h, double l, double d) {
	return w0 * Math.sqrt((1.0 - (((M_m / 4.0) / (l / (h * (D * (M_m / d))))) * (D / d))));
}
M_m = math.fabs(M)
[w0, M_m, D, h, l, d] = sort([w0, M_m, D, h, l, d])
def code(w0, M_m, D, h, l, d):
	return w0 * math.sqrt((1.0 - (((M_m / 4.0) / (l / (h * (D * (M_m / d))))) * (D / d))))
M_m = abs(M)
w0, M_m, D, h, l, d = sort([w0, M_m, D, h, l, d])
function code(w0, M_m, D, h, l, d)
	return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(M_m / 4.0) / Float64(l / Float64(h * Float64(D * Float64(M_m / d))))) * Float64(D / d)))))
end
M_m = abs(M);
w0, M_m, D, h, l, d = num2cell(sort([w0, M_m, D, h, l, d])){:}
function tmp = code(w0, M_m, D, h, l, d)
	tmp = w0 * sqrt((1.0 - (((M_m / 4.0) / (l / (h * (D * (M_m / d))))) * (D / d))));
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(M$95$m / 4.0), $MachinePrecision] / N[(l / N[(h * N[(D * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\
\\
w0 \cdot \sqrt{1 - \frac{\frac{M_m}{4}}{\frac{\ell}{h \cdot \left(D \cdot \frac{M_m}{d}\right)}} \cdot \frac{D}{d}}
\end{array}
Derivation
  1. Initial program 83.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. associate-/l*84.8%

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

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

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

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

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

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

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

    \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{D}{d}}{\frac{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}{M}}}} \]
  5. Step-by-step derivation
    1. div-inv84.5%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{D}{d} \cdot \frac{1}{\frac{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}{M}}}} \]
    2. *-commutative84.5%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{1}{\frac{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}{M}} \cdot \frac{D}{d}}} \]
    3. clear-num84.5%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{M}{4 \cdot \frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}} \cdot \frac{D}{d}} \]
    4. associate-/r*84.5%

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M}{4}}{\frac{\frac{\ell}{h}}{\frac{M}{\frac{d}{D}}}}} \cdot \frac{D}{d}} \]
    5. associate-/l/88.8%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M}{4}}{\color{blue}{\frac{\ell}{\frac{M}{\frac{d}{D}} \cdot h}}} \cdot \frac{D}{d}} \]
    6. *-commutative88.8%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M}{4}}{\frac{\ell}{\color{blue}{h \cdot \frac{M}{\frac{d}{D}}}}} \cdot \frac{D}{d}} \]
    7. associate-/r/86.1%

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

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

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

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

Alternative 6: 72.5% accurate, 1.8× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\ \\ w0 + -0.125 \cdot \frac{\frac{D}{d}}{\frac{\ell}{h \cdot \left(w0 \cdot {M_m}^{2}\right)} \cdot \frac{d}{D}} \end{array} \]
M_m = (fabs.f64 M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D h l d)
 :precision binary64
 (+ w0 (* -0.125 (/ (/ D d) (* (/ l (* h (* w0 (pow M_m 2.0)))) (/ d D))))))
M_m = fabs(M);
assert(w0 < M_m && M_m < D && D < h && h < l && l < d);
double code(double w0, double M_m, double D, double h, double l, double d) {
	return w0 + (-0.125 * ((D / d) / ((l / (h * (w0 * pow(M_m, 2.0)))) * (d / D))));
}
M_m = abs(M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    code = w0 + ((-0.125d0) * ((d / d_1) / ((l / (h * (w0 * (m_m ** 2.0d0)))) * (d_1 / d))))
end function
M_m = Math.abs(M);
assert w0 < M_m && M_m < D && D < h && h < l && l < d;
public static double code(double w0, double M_m, double D, double h, double l, double d) {
	return w0 + (-0.125 * ((D / d) / ((l / (h * (w0 * Math.pow(M_m, 2.0)))) * (d / D))));
}
M_m = math.fabs(M)
[w0, M_m, D, h, l, d] = sort([w0, M_m, D, h, l, d])
def code(w0, M_m, D, h, l, d):
	return w0 + (-0.125 * ((D / d) / ((l / (h * (w0 * math.pow(M_m, 2.0)))) * (d / D))))
M_m = abs(M)
w0, M_m, D, h, l, d = sort([w0, M_m, D, h, l, d])
function code(w0, M_m, D, h, l, d)
	return Float64(w0 + Float64(-0.125 * Float64(Float64(D / d) / Float64(Float64(l / Float64(h * Float64(w0 * (M_m ^ 2.0)))) * Float64(d / D)))))
end
M_m = abs(M);
w0, M_m, D, h, l, d = num2cell(sort([w0, M_m, D, h, l, d])){:}
function tmp = code(w0, M_m, D, h, l, d)
	tmp = w0 + (-0.125 * ((D / d) / ((l / (h * (w0 * (M_m ^ 2.0)))) * (d / D))));
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D_, h_, l_, d_] := N[(w0 + N[(-0.125 * N[(N[(D / d), $MachinePrecision] / N[(N[(l / N[(h * N[(w0 * N[Power[M$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
[w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\
\\
w0 + -0.125 \cdot \frac{\frac{D}{d}}{\frac{\ell}{h \cdot \left(w0 \cdot {M_m}^{2}\right)} \cdot \frac{d}{D}}
\end{array}
Derivation
  1. Initial program 83.6%

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}} \]
    5. times-frac83.6%

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

      \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot \frac{D}{d}}{2}} \cdot \frac{M \cdot D}{2 \cdot d}}{\frac{\ell}{h}}} \]
    7. times-frac85.1%

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

      \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot \frac{D}{d}}{2} \cdot \color{blue}{\frac{M \cdot \frac{D}{d}}{2}}}{\frac{\ell}{h}}} \]
    9. frac-times85.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 72.5% accurate, 9.4× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;M_m \leq 2.25 \cdot 10^{-166}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 + -0.125 \cdot \left(\left(h \cdot w0\right) \cdot \frac{D \cdot \left(\frac{M_m}{d} \cdot \frac{M_m \cdot D}{d}\right)}{\ell}\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D h l d)
 :precision binary64
 (if (<= M_m 2.25e-166)
   w0
   (+ w0 (* -0.125 (* (* h w0) (/ (* D (* (/ M_m d) (/ (* M_m D) d))) l))))))
M_m = fabs(M);
assert(w0 < M_m && M_m < D && D < h && h < l && l < d);
double code(double w0, double M_m, double D, double h, double l, double d) {
	double tmp;
	if (M_m <= 2.25e-166) {
		tmp = w0;
	} else {
		tmp = w0 + (-0.125 * ((h * w0) * ((D * ((M_m / d) * ((M_m * D) / d))) / l)));
	}
	return tmp;
}
M_m = abs(M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m_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_m <= 2.25d-166) then
        tmp = w0
    else
        tmp = w0 + ((-0.125d0) * ((h * w0) * ((d * ((m_m / d_1) * ((m_m * d) / d_1))) / l)))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert w0 < M_m && M_m < D && D < h && h < l && l < d;
public static double code(double w0, double M_m, double D, double h, double l, double d) {
	double tmp;
	if (M_m <= 2.25e-166) {
		tmp = w0;
	} else {
		tmp = w0 + (-0.125 * ((h * w0) * ((D * ((M_m / d) * ((M_m * D) / d))) / l)));
	}
	return tmp;
}
M_m = math.fabs(M)
[w0, M_m, D, h, l, d] = sort([w0, M_m, D, h, l, d])
def code(w0, M_m, D, h, l, d):
	tmp = 0
	if M_m <= 2.25e-166:
		tmp = w0
	else:
		tmp = w0 + (-0.125 * ((h * w0) * ((D * ((M_m / d) * ((M_m * D) / d))) / l)))
	return tmp
M_m = abs(M)
w0, M_m, D, h, l, d = sort([w0, M_m, D, h, l, d])
function code(w0, M_m, D, h, l, d)
	tmp = 0.0
	if (M_m <= 2.25e-166)
		tmp = w0;
	else
		tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h * w0) * Float64(Float64(D * Float64(Float64(M_m / d) * Float64(Float64(M_m * D) / d))) / l))));
	end
	return tmp
end
M_m = abs(M);
w0, M_m, D, h, l, d = num2cell(sort([w0, M_m, D, h, l, d])){:}
function tmp_2 = code(w0, M_m, D, h, l, d)
	tmp = 0.0;
	if (M_m <= 2.25e-166)
		tmp = w0;
	else
		tmp = w0 + (-0.125 * ((h * w0) * ((D * ((M_m / d) * ((M_m * D) / d))) / l)));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D_, h_, l_, d_] := If[LessEqual[M$95$m, 2.25e-166], w0, N[(w0 + N[(-0.125 * N[(N[(h * w0), $MachinePrecision] * N[(N[(D * N[(N[(M$95$m / d), $MachinePrecision] * N[(N[(M$95$m * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\
\\
\begin{array}{l}
\mathbf{if}\;M_m \leq 2.25 \cdot 10^{-166}:\\
\;\;\;\;w0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 2.2499999999999999e-166

    1. Initial program 82.0%

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

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

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

    if 2.2499999999999999e-166 < M

    1. Initial program 86.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto w0 + -0.125 \cdot \frac{\frac{M}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}}{\frac{\ell}{h \cdot w0}} \]
      11. pow172.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 72.6% accurate, 9.4× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\ \\ \begin{array}{l} t_0 := \frac{M_m \cdot D}{d}\\ \mathbf{if}\;M_m \leq 1.6 \cdot 10^{-165}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 + -0.125 \cdot \left(\left(h \cdot w0\right) \cdot \frac{t_0 \cdot t_0}{\ell}\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D h l d)
 :precision binary64
 (let* ((t_0 (/ (* M_m D) d)))
   (if (<= M_m 1.6e-165) w0 (+ w0 (* -0.125 (* (* h w0) (/ (* t_0 t_0) l)))))))
M_m = fabs(M);
assert(w0 < M_m && M_m < D && D < h && h < l && l < d);
double code(double w0, double M_m, double D, double h, double l, double d) {
	double t_0 = (M_m * D) / d;
	double tmp;
	if (M_m <= 1.6e-165) {
		tmp = w0;
	} else {
		tmp = w0 + (-0.125 * ((h * w0) * ((t_0 * t_0) / l)));
	}
	return tmp;
}
M_m = abs(M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (m_m * d) / d_1
    if (m_m <= 1.6d-165) then
        tmp = w0
    else
        tmp = w0 + ((-0.125d0) * ((h * w0) * ((t_0 * t_0) / l)))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert w0 < M_m && M_m < D && D < h && h < l && l < d;
public static double code(double w0, double M_m, double D, double h, double l, double d) {
	double t_0 = (M_m * D) / d;
	double tmp;
	if (M_m <= 1.6e-165) {
		tmp = w0;
	} else {
		tmp = w0 + (-0.125 * ((h * w0) * ((t_0 * t_0) / l)));
	}
	return tmp;
}
M_m = math.fabs(M)
[w0, M_m, D, h, l, d] = sort([w0, M_m, D, h, l, d])
def code(w0, M_m, D, h, l, d):
	t_0 = (M_m * D) / d
	tmp = 0
	if M_m <= 1.6e-165:
		tmp = w0
	else:
		tmp = w0 + (-0.125 * ((h * w0) * ((t_0 * t_0) / l)))
	return tmp
M_m = abs(M)
w0, M_m, D, h, l, d = sort([w0, M_m, D, h, l, d])
function code(w0, M_m, D, h, l, d)
	t_0 = Float64(Float64(M_m * D) / d)
	tmp = 0.0
	if (M_m <= 1.6e-165)
		tmp = w0;
	else
		tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(h * w0) * Float64(Float64(t_0 * t_0) / l))));
	end
	return tmp
end
M_m = abs(M);
w0, M_m, D, h, l, d = num2cell(sort([w0, M_m, D, h, l, d])){:}
function tmp_2 = code(w0, M_m, D, h, l, d)
	t_0 = (M_m * D) / d;
	tmp = 0.0;
	if (M_m <= 1.6e-165)
		tmp = w0;
	else
		tmp = w0 + (-0.125 * ((h * w0) * ((t_0 * t_0) / l)));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[(M$95$m * D), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[M$95$m, 1.6e-165], w0, N[(w0 + N[(-0.125 * N[(N[(h * w0), $MachinePrecision] * N[(N[(t$95$0 * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\
\\
\begin{array}{l}
t_0 := \frac{M_m \cdot D}{d}\\
\mathbf{if}\;M_m \leq 1.6 \cdot 10^{-165}:\\
\;\;\;\;w0\\

\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(h \cdot w0\right) \cdot \frac{t_0 \cdot t_0}{\ell}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 1.60000000000000006e-165

    1. Initial program 82.0%

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

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

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

    if 1.60000000000000006e-165 < M

    1. Initial program 86.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto w0 + -0.125 \cdot \frac{\frac{M}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}}{\frac{\ell}{h \cdot w0}} \]
      11. pow172.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 72.7% accurate, 9.4× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\ \\ \begin{array}{l} t_0 := \frac{M_m \cdot D}{d}\\ \mathbf{if}\;M_m \leq 4 \cdot 10^{-222}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 + -0.125 \cdot \left(\left(t_0 \cdot \frac{t_0}{\ell}\right) \cdot \left(h \cdot w0\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D h l d)
 :precision binary64
 (let* ((t_0 (/ (* M_m D) d)))
   (if (<= M_m 4e-222) w0 (+ w0 (* -0.125 (* (* t_0 (/ t_0 l)) (* h w0)))))))
M_m = fabs(M);
assert(w0 < M_m && M_m < D && D < h && h < l && l < d);
double code(double w0, double M_m, double D, double h, double l, double d) {
	double t_0 = (M_m * D) / d;
	double tmp;
	if (M_m <= 4e-222) {
		tmp = w0;
	} else {
		tmp = w0 + (-0.125 * ((t_0 * (t_0 / l)) * (h * w0)));
	}
	return tmp;
}
M_m = abs(M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (m_m * d) / d_1
    if (m_m <= 4d-222) then
        tmp = w0
    else
        tmp = w0 + ((-0.125d0) * ((t_0 * (t_0 / l)) * (h * w0)))
    end if
    code = tmp
end function
M_m = Math.abs(M);
assert w0 < M_m && M_m < D && D < h && h < l && l < d;
public static double code(double w0, double M_m, double D, double h, double l, double d) {
	double t_0 = (M_m * D) / d;
	double tmp;
	if (M_m <= 4e-222) {
		tmp = w0;
	} else {
		tmp = w0 + (-0.125 * ((t_0 * (t_0 / l)) * (h * w0)));
	}
	return tmp;
}
M_m = math.fabs(M)
[w0, M_m, D, h, l, d] = sort([w0, M_m, D, h, l, d])
def code(w0, M_m, D, h, l, d):
	t_0 = (M_m * D) / d
	tmp = 0
	if M_m <= 4e-222:
		tmp = w0
	else:
		tmp = w0 + (-0.125 * ((t_0 * (t_0 / l)) * (h * w0)))
	return tmp
M_m = abs(M)
w0, M_m, D, h, l, d = sort([w0, M_m, D, h, l, d])
function code(w0, M_m, D, h, l, d)
	t_0 = Float64(Float64(M_m * D) / d)
	tmp = 0.0
	if (M_m <= 4e-222)
		tmp = w0;
	else
		tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(t_0 * Float64(t_0 / l)) * Float64(h * w0))));
	end
	return tmp
end
M_m = abs(M);
w0, M_m, D, h, l, d = num2cell(sort([w0, M_m, D, h, l, d])){:}
function tmp_2 = code(w0, M_m, D, h, l, d)
	t_0 = (M_m * D) / d;
	tmp = 0.0;
	if (M_m <= 4e-222)
		tmp = w0;
	else
		tmp = w0 + (-0.125 * ((t_0 * (t_0 / l)) * (h * w0)));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D_, h_, l_, d_] := Block[{t$95$0 = N[(N[(M$95$m * D), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[M$95$m, 4e-222], w0, N[(w0 + N[(-0.125 * N[(N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision] * N[(h * w0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\
\\
\begin{array}{l}
t_0 := \frac{M_m \cdot D}{d}\\
\mathbf{if}\;M_m \leq 4 \cdot 10^{-222}:\\
\;\;\;\;w0\\

\mathbf{else}:\\
\;\;\;\;w0 + -0.125 \cdot \left(\left(t_0 \cdot \frac{t_0}{\ell}\right) \cdot \left(h \cdot w0\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 4.00000000000000019e-222

    1. Initial program 80.5%

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

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

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

    if 4.00000000000000019e-222 < M

    1. Initial program 87.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot \frac{D}{d}}{2} \cdot \color{blue}{\frac{M \cdot \frac{D}{d}}{2}}}{\frac{\ell}{h}}} \]
      9. frac-times88.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto w0 + -0.125 \cdot \frac{\frac{M}{\frac{d}{D}} \cdot \color{blue}{\frac{M}{\frac{d}{D}}}}{\frac{\ell}{h \cdot w0}} \]
      11. pow173.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 68.6% accurate, 216.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\ \\ w0 \end{array} \]
M_m = (fabs.f64 M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D h l d) :precision binary64 w0)
M_m = fabs(M);
assert(w0 < M_m && M_m < D && D < h && h < l && l < d);
double code(double w0, double M_m, double D, double h, double l, double d) {
	return w0;
}
M_m = abs(M)
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
real(8) function code(w0, m_m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m_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
M_m = Math.abs(M);
assert w0 < M_m && M_m < D && D < h && h < l && l < d;
public static double code(double w0, double M_m, double D, double h, double l, double d) {
	return w0;
}
M_m = math.fabs(M)
[w0, M_m, D, h, l, d] = sort([w0, M_m, D, h, l, d])
def code(w0, M_m, D, h, l, d):
	return w0
M_m = abs(M)
w0, M_m, D, h, l, d = sort([w0, M_m, D, h, l, d])
function code(w0, M_m, D, h, l, d)
	return w0
end
M_m = abs(M);
w0, M_m, D, h, l, d = num2cell(sort([w0, M_m, D, h, l, d])){:}
function tmp = code(w0, M_m, D, h, l, d)
	tmp = w0;
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: w0, M_m, D, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D_, h_, l_, d_] := w0
\begin{array}{l}
M_m = \left|M\right|
\\
[w0, M_m, D, h, l, d] = \mathsf{sort}([w0, M_m, D, h, l, d])\\
\\
w0
\end{array}
Derivation
  1. Initial program 83.6%

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

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

    \[\leadsto \color{blue}{w0} \]
  4. Final simplification63.8%

    \[\leadsto w0 \]

Reproduce

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