Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.0% → 87.8%
Time: 17.5s
Alternatives: 10
Speedup: 1.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 81.0% 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: 87.8% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\left(M \cdot \frac{0.5 \cdot D}{d}\right) \cdot h}{\left(\frac{2}{M} \cdot \frac{d}{D}\right) \cdot \ell}}} \]
  8. Step-by-step derivation
    1. clear-num90.3%

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

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

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

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

    \[\leadsto w0 \cdot \sqrt{1 - \frac{\left(M \cdot \color{blue}{\frac{1}{\frac{d}{0.5 \cdot D}}}\right) \cdot h}{\left(\frac{2}{M} \cdot \frac{d}{D}\right) \cdot \ell}} \]
  12. Step-by-step derivation
    1. un-div-inv90.2%

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

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

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

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

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

Alternative 2: 75.6% accurate, 1.7× speedup?

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

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


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

    1. Initial program 85.7%

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

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

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

    if 2.0000000000000002e-208 < (*.f64 M D)

    1. Initial program 74.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\left(M \cdot \frac{0.5 \cdot D}{d}\right) \cdot h}{\left(\ell \cdot \frac{2}{M}\right) \cdot \frac{d}{D}}}} \]
      6. *-un-lft-identity77.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 69.6% accurate, 1.7× speedup?

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

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


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

    1. Initial program 82.7%

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

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

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

    if 9.5999999999999995e-13 < M

    1. Initial program 79.0%

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

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

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

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

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

        \[\leadsto w0 \cdot \color{blue}{\mathsf{fma}\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}, -0.125, 1\right)} \]
      4. associate-*r*49.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 69.7% accurate, 1.7× speedup?

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

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


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

    1. Initial program 82.7%

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

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

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

    if 1.04999999999999997e-12 < M

    1. Initial program 79.0%

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

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

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

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

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

        \[\leadsto w0 \cdot \color{blue}{\mathsf{fma}\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}, -0.125, 1\right)} \]
      4. associate-*r*49.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 69.1% accurate, 1.8× speedup?

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

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


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

    1. Initial program 82.8%

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

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

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

    if 4.00000000000000033e-5 < M

    1. Initial program 78.6%

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

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

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

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

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

        \[\leadsto w0 \cdot \color{blue}{\mathsf{fma}\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}, -0.125, 1\right)} \]
      4. associate-*r*48.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 88.4% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 86.3% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 85.3% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 67.5% accurate, 21.6× speedup?

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

\mathbf{else}:\\
\;\;\;\;\frac{w0 \cdot h}{h}\\


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

    1. Initial program 82.2%

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

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

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

    if 3.0999999999999999e-62 < M

    1. Initial program 80.9%

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

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

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

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

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

        \[\leadsto w0 \cdot \color{blue}{\mathsf{fma}\left(\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}, -0.125, 1\right)} \]
      4. associate-*r*50.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{h \cdot \mathsf{fma}\left(-0.125, \frac{{\left(D \cdot M\right)}^{2} \cdot w0}{{d}^{2} \cdot \ell}, \frac{w0}{h}\right)} \]
    10. Taylor expanded in D around 0 36.5%

      \[\leadsto h \cdot \color{blue}{\frac{w0}{h}} \]
    11. Step-by-step derivation
      1. associate-*r/49.3%

        \[\leadsto \color{blue}{\frac{h \cdot w0}{h}} \]
    12. Applied egg-rr49.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 3.1 \cdot 10^{-62}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;\frac{w0 \cdot h}{h}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 67.5% accurate, 216.0× speedup?

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

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

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

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

Reproduce

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