Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.2% → 86.9%
Time: 15.3s
Alternatives: 11
Speedup: 1.7×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 81.2% 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: 86.9% accurate, 1.7× speedup?

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

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


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

    1. Initial program 82.1%

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

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

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \left(\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{\frac{M \cdot D}{2}}{d}\right) \cdot \frac{h}{\ell}\right)\right)\right)\right) \]
      3. associate-*r/N/A

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

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \left(\frac{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2}\right) \cdot \frac{h}{\ell}}{d}\right)\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\left(\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2}\right) \cdot \frac{h}{\ell}\right), d\right)\right)\right)\right) \]
    4. Applied egg-rr79.1%

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

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

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot \frac{1}{4}}{d} \cdot h\right), \ell\right), d\right)\right)\right)\right) \]
      3. clear-numN/A

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

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{1 \cdot h}{\frac{d}{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot \frac{1}{4}}}\right), \ell\right), d\right)\right)\right)\right) \]
      5. metadata-evalN/A

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

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{\frac{1}{\frac{1}{h}}}{\frac{d}{\left(M \cdot \left(D \cdot \left(M \cdot D\right)\right)\right) \cdot \frac{1}{4}}}\right), \ell\right), d\right)\right)\right)\right) \]
      7. remove-double-divN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(h, \mathsf{/.f64}\left(d, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, D\right), \mathsf{*.f64}\left(\left(M \cdot D\right), \frac{1}{4}\right)\right)\right)\right), \ell\right), d\right)\right)\right)\right) \]
      15. *-lowering-*.f6486.1%

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(h, \mathsf{/.f64}\left(d, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, D\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, D\right), \frac{1}{4}\right)\right)\right)\right), \ell\right), d\right)\right)\right)\right) \]
    6. Applied egg-rr86.1%

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

    if 9.99999999999999957e110 < (*.f64 M D)

    1. Initial program 63.2%

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

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \left(\frac{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot h}{\ell}\right)\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot h\right), \ell\right)\right)\right)\right) \]
    4. Applied egg-rr56.8%

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

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

Alternative 2: 81.8% accurate, 1.6× speedup?

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

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

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


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

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({M}^{2}\right), h\right), d\right)\right)\right)\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(M \cdot M\right), h\right), d\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f6464.6%

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right), d\right)\right)\right)\right)\right) \]
    5. Simplified64.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\frac{D}{\frac{d}{D}}\right), \left(\frac{\frac{d}{h}}{M}\right)\right), M\right)\right)\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(D, \left(\frac{d}{D}\right)\right), \left(\frac{\frac{d}{h}}{M}\right)\right), M\right)\right)\right)\right) \]
      11. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(D, \mathsf{/.f64}\left(d, D\right)\right), \left(\frac{d}{M \cdot h}\right)\right), M\right)\right)\right)\right) \]
      13. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(D, \mathsf{/.f64}\left(d, D\right)\right), \mathsf{/.f64}\left(d, \left(M \cdot h\right)\right)\right), M\right)\right)\right)\right) \]
      14. *-lowering-*.f6474.3%

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(D, \mathsf{/.f64}\left(d, D\right)\right), \mathsf{/.f64}\left(d, \mathsf{*.f64}\left(M, h\right)\right)\right), M\right)\right)\right)\right) \]
    7. Applied egg-rr74.3%

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

    if -1.0000000000000001e287 < (/.f64 h l) < -1.97626e-323

    1. Initial program 81.5%

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

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right), \mathsf{/.f64}\left(h, \ell\right)\right)\right)\right)\right) \]
      2. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\left(\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M}{2} \cdot \frac{D}{d}\right)\right), \mathsf{/.f64}\left(h, \ell\right)\right)\right)\right)\right) \]
      3. associate-*r*N/A

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

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\left(\frac{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M}{2}\right) \cdot D}{d}\right), \mathsf{/.f64}\left(h, \ell\right)\right)\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M}{2}\right) \cdot D\right), d\right), \mathsf{/.f64}\left(h, \ell\right)\right)\right)\right)\right) \]
    4. Applied egg-rr68.8%

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

    if -1.97626e-323 < (/.f64 h l)

    1. Initial program 78.0%

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

      \[\leadsto \color{blue}{w0} \]
    4. Step-by-step derivation
      1. Simplified91.7%

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

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

    Alternative 3: 83.8% accurate, 1.7× speedup?

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

      1. Initial program 79.7%

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

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

          \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \left(\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{\frac{M \cdot D}{2}}{d}\right) \cdot \frac{h}{\ell}\right)\right)\right)\right) \]
        3. associate-*r/N/A

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

          \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \left(\frac{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2}\right) \cdot \frac{h}{\ell}}{d}\right)\right)\right)\right) \]
        5. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\left(\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2}\right) \cdot \frac{h}{\ell}\right), d\right)\right)\right)\right) \]
      4. Applied egg-rr70.2%

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

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, D\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, D\right), \left(\frac{\frac{1}{4}}{d}\right)\right)\right), \mathsf{/.f64}\left(h, \ell\right)\right), d\right)\right)\right)\right) \]
        8. /-lowering-/.f6478.4%

          \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, D\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, D\right), \mathsf{/.f64}\left(\frac{1}{4}, d\right)\right)\right), \mathsf{/.f64}\left(h, \ell\right)\right), d\right)\right)\right)\right) \]
      6. Applied egg-rr78.4%

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

      if -1.97626e-323 < (/.f64 h l)

      1. Initial program 78.0%

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

        \[\leadsto \color{blue}{w0} \]
      4. Step-by-step derivation
        1. Simplified91.7%

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

      Alternative 4: 83.1% accurate, 1.7× speedup?

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

        1. Initial program 77.3%

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

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

            \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \left(\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{\frac{M \cdot D}{2}}{d}\right) \cdot \frac{h}{\ell}\right)\right)\right)\right) \]
          3. associate-*r/N/A

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

            \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \left(\frac{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2}\right) \cdot \frac{h}{\ell}}{d}\right)\right)\right)\right) \]
          5. /-lowering-/.f64N/A

            \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\left(\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2}\right) \cdot \frac{h}{\ell}\right), d\right)\right)\right)\right) \]
        4. Applied egg-rr73.1%

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

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

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

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, D\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, D\right), \left(\frac{\frac{1}{4}}{d}\right)\right)\right), \mathsf{/.f64}\left(h, \ell\right)\right), d\right)\right)\right)\right) \]
          8. /-lowering-/.f6479.3%

            \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, D\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, D\right), \mathsf{/.f64}\left(\frac{1}{4}, d\right)\right)\right), \mathsf{/.f64}\left(h, \ell\right)\right), d\right)\right)\right)\right) \]
        6. Applied egg-rr79.3%

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

        if 1.15e-75 < d

        1. Initial program 81.8%

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

            \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \left(\frac{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot h}{\ell}\right)\right)\right)\right) \]
          2. /-lowering-/.f64N/A

            \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{sqrt.f64}\left(\mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot h\right), \ell\right)\right)\right)\right) \]
        4. Applied egg-rr75.8%

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

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

      Alternative 5: 78.5% accurate, 8.3× speedup?

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

        1. Initial program 79.1%

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

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

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

          if 7.3999999999999998e-125 < M

          1. Initial program 78.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({M}^{2}\right), h\right), d\right)\right)\right)\right)\right) \]
            15. unpow2N/A

              \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(M \cdot M\right), h\right), d\right)\right)\right)\right)\right) \]
            16. *-lowering-*.f6465.5%

              \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right), d\right)\right)\right)\right)\right) \]
          5. Simplified65.5%

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(\frac{1}{\frac{\frac{d}{h}}{M \cdot M}}\right), D\right), \left(\frac{d}{D}\right)\right)\right)\right)\right) \]
            9. clear-numN/A

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

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

              \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(M, M\right), \left(\frac{d}{h}\right)\right), D\right), \left(\frac{d}{D}\right)\right)\right)\right)\right) \]
            12. /-lowering-/.f64N/A

              \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{/.f64}\left(d, h\right)\right), D\right), \left(\frac{d}{D}\right)\right)\right)\right)\right) \]
            13. /-lowering-/.f6471.8%

              \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{/.f64}\left(d, h\right)\right), D\right), \mathsf{/.f64}\left(d, \color{blue}{D}\right)\right)\right)\right)\right) \]
          7. Applied egg-rr71.8%

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

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

        Alternative 6: 78.3% accurate, 8.3× speedup?

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

          1. Initial program 79.7%

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

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

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

            if 1.69999999999999996e-116 < M

            1. Initial program 77.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({M}^{2}\right), h\right), d\right)\right)\right)\right)\right) \]
              15. unpow2N/A

                \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(M \cdot M\right), h\right), d\right)\right)\right)\right)\right) \]
              16. *-lowering-*.f6463.6%

                \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right), d\right)\right)\right)\right)\right) \]
            5. Simplified63.6%

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

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

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

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

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

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

                \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\left(\frac{\left(M \cdot M\right) \cdot h}{d} \cdot \frac{D}{d}\right), \color{blue}{D}\right)\right)\right)\right) \]
            7. Applied egg-rr70.2%

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

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

          Alternative 7: 72.4% accurate, 9.0× speedup?

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

            1. Initial program 80.6%

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

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

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

              if 4e17 < M

              1. Initial program 73.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({M}^{2}\right), h\right), d\right)\right)\right)\right)\right) \]
                15. unpow2N/A

                  \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(M \cdot M\right), h\right), d\right)\right)\right)\right)\right) \]
                16. *-lowering-*.f6448.8%

                  \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right), d\right)\right)\right)\right)\right) \]
              5. Simplified48.8%

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\left({M}^{2}\right), h\right)\right), \left({D}^{2}\right)\right), \left({d}^{2}\right)\right), \ell\right)\right) \]
                11. unpow2N/A

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

                  \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \left({D}^{2}\right)\right), \left({d}^{2}\right)\right), \ell\right)\right) \]
                13. unpow2N/A

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

                  \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \mathsf{*.f64}\left(D, D\right)\right), \left({d}^{2}\right)\right), \ell\right)\right) \]
                15. unpow2N/A

                  \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \mathsf{*.f64}\left(D, D\right)\right), \left(d \cdot d\right)\right), \ell\right)\right) \]
                16. *-lowering-*.f6425.2%

                  \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \mathsf{*.f64}\left(D, D\right)\right), \mathsf{*.f64}\left(d, d\right)\right), \ell\right)\right) \]
              8. Simplified25.2%

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(h, \mathsf{*.f64}\left(M, M\right)\right), \mathsf{*.f64}\left(\frac{-1}{8}, D\right)\right), d\right), \left(\frac{D}{d}\right)\right), \ell\right)\right) \]
                12. /-lowering-/.f6431.7%

                  \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(h, \mathsf{*.f64}\left(M, M\right)\right), \mathsf{*.f64}\left(\frac{-1}{8}, D\right)\right), d\right), \mathsf{/.f64}\left(D, d\right)\right), \ell\right)\right) \]
              10. Applied egg-rr31.7%

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

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

            Alternative 8: 72.4% accurate, 9.0× speedup?

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

              1. Initial program 80.6%

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

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

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

                if 1.5e20 < M

                1. Initial program 73.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({M}^{2}\right), h\right), d\right)\right)\right)\right)\right) \]
                  15. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(M \cdot M\right), h\right), d\right)\right)\right)\right)\right) \]
                  16. *-lowering-*.f6448.8%

                    \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right), d\right)\right)\right)\right)\right) \]
                5. Simplified48.8%

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\left({M}^{2}\right), h\right)\right), \left({D}^{2}\right)\right), \left({d}^{2}\right)\right), \ell\right)\right) \]
                  11. unpow2N/A

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

                    \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \left({D}^{2}\right)\right), \left({d}^{2}\right)\right), \ell\right)\right) \]
                  13. unpow2N/A

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

                    \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \mathsf{*.f64}\left(D, D\right)\right), \left({d}^{2}\right)\right), \ell\right)\right) \]
                  15. unpow2N/A

                    \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \mathsf{*.f64}\left(D, D\right)\right), \left(d \cdot d\right)\right), \ell\right)\right) \]
                  16. *-lowering-*.f6425.2%

                    \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \mathsf{*.f64}\left(D, D\right)\right), \mathsf{*.f64}\left(d, d\right)\right), \ell\right)\right) \]
                8. Simplified25.2%

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(h, \mathsf{*.f64}\left(M, M\right)\right), \mathsf{/.f64}\left(\frac{-1}{8}, d\right)\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(D \cdot D\right), d\right), \ell\right)\right)\right) \]
                  13. *-lowering-*.f6429.6%

                    \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(h, \mathsf{*.f64}\left(M, M\right)\right), \mathsf{/.f64}\left(\frac{-1}{8}, d\right)\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \ell\right)\right)\right) \]
                10. Applied egg-rr29.6%

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

              Alternative 9: 71.4% accurate, 9.0× speedup?

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

                1. Initial program 79.8%

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

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

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

                  if 3.4000000000000001e96 < M

                  1. Initial program 75.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({M}^{2}\right), h\right), d\right)\right)\right)\right)\right) \]
                    15. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(M \cdot M\right), h\right), d\right)\right)\right)\right)\right) \]
                    16. *-lowering-*.f6441.4%

                      \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right), d\right)\right)\right)\right)\right) \]
                  5. Simplified41.4%

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\left({M}^{2}\right), h\right)\right), \left({D}^{2}\right)\right), \left({d}^{2}\right)\right), \ell\right)\right) \]
                    11. unpow2N/A

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

                      \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \left({D}^{2}\right)\right), \left({d}^{2}\right)\right), \ell\right)\right) \]
                    13. unpow2N/A

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

                      \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \mathsf{*.f64}\left(D, D\right)\right), \left({d}^{2}\right)\right), \ell\right)\right) \]
                    15. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \mathsf{*.f64}\left(D, D\right)\right), \left(d \cdot d\right)\right), \ell\right)\right) \]
                    16. *-lowering-*.f6427.0%

                      \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \mathsf{*.f64}\left(D, D\right)\right), \mathsf{*.f64}\left(d, d\right)\right), \ell\right)\right) \]
                  8. Simplified27.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(h, \mathsf{*.f64}\left(M, M\right)\right), \mathsf{*.f64}\left(\frac{-1}{8}, D\right)\right), \mathsf{/.f64}\left(D, \mathsf{*.f64}\left(d, \color{blue}{\left(d \cdot \ell\right)}\right)\right)\right)\right) \]
                    15. *-lowering-*.f6432.4%

                      \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(h, \mathsf{*.f64}\left(M, M\right)\right), \mathsf{*.f64}\left(\frac{-1}{8}, D\right)\right), \mathsf{/.f64}\left(D, \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(d, \color{blue}{\ell}\right)\right)\right)\right)\right) \]
                  10. Applied egg-rr32.4%

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

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

                Alternative 10: 71.4% accurate, 9.0× speedup?

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

                  1. Initial program 79.8%

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

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

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

                    if 3e96 < M

                    1. Initial program 75.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({M}^{2}\right), h\right), d\right)\right)\right)\right)\right) \]
                      15. unpow2N/A

                        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(M \cdot M\right), h\right), d\right)\right)\right)\right)\right) \]
                      16. *-lowering-*.f6441.4%

                        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\frac{-1}{8}, \ell\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right), d\right)\right)\right)\right)\right) \]
                    5. Simplified41.4%

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\left({M}^{2}\right), h\right)\right), \left({D}^{2}\right)\right), \left({d}^{2}\right)\right), \ell\right)\right) \]
                      11. unpow2N/A

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

                        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \left({D}^{2}\right)\right), \left({d}^{2}\right)\right), \ell\right)\right) \]
                      13. unpow2N/A

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

                        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \mathsf{*.f64}\left(D, D\right)\right), \left({d}^{2}\right)\right), \ell\right)\right) \]
                      15. unpow2N/A

                        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \mathsf{*.f64}\left(D, D\right)\right), \left(d \cdot d\right)\right), \ell\right)\right) \]
                      16. *-lowering-*.f6427.0%

                        \[\leadsto \mathsf{*.f64}\left(w0, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(\frac{-1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), h\right)\right), \mathsf{*.f64}\left(D, D\right)\right), \mathsf{*.f64}\left(d, d\right)\right), \ell\right)\right) \]
                    8. Simplified27.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 11: 68.0% accurate, 216.0× speedup?

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

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

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

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

                    Reproduce

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