Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.4% → 88.2%
Time: 16.4s
Alternatives: 3
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 3 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.4% accurate, 1.0× speedup?

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

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

Alternative 1: 88.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ w0 \cdot \sqrt{1 - M \cdot \left(\left(0.5 \cdot \frac{D}{d}\right) \cdot \left(h \cdot \frac{\frac{M}{\frac{\frac{d}{D}}{0.5}}}{\ell}\right)\right)} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (*
  w0
  (sqrt (- 1.0 (* M (* (* 0.5 (/ D d)) (* h (/ (/ M (/ (/ d D) 0.5)) l))))))))
double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * sqrt((1.0 - (M * ((0.5 * (D / d)) * (h * ((M / ((d / D) / 0.5)) / 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 * ((0.5d0 * (d / d_1)) * (h * ((m / ((d_1 / d) / 0.5d0)) / 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 - (M * ((0.5 * (D / d)) * (h * ((M / ((d / D) / 0.5)) / l))))));
}
def code(w0, M, D, h, l, d):
	return w0 * math.sqrt((1.0 - (M * ((0.5 * (D / d)) * (h * ((M / ((d / D) / 0.5)) / l))))))
function code(w0, M, D, h, l, d)
	return Float64(w0 * sqrt(Float64(1.0 - Float64(M * Float64(Float64(0.5 * Float64(D / d)) * Float64(h * Float64(Float64(M / Float64(Float64(d / D) / 0.5)) / l)))))))
end
function tmp = code(w0, M, D, h, l, d)
	tmp = w0 * sqrt((1.0 - (M * ((0.5 * (D / d)) * (h * ((M / ((d / D) / 0.5)) / l))))));
end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(M * N[(N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M / N[(N[(d / D), $MachinePrecision] / 0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
w0 \cdot \sqrt{1 - M \cdot \left(\left(0.5 \cdot \frac{D}{d}\right) \cdot \left(h \cdot \frac{\frac{M}{\frac{\frac{d}{D}}{0.5}}}{\ell}\right)\right)}
\end{array}
Derivation
  1. Initial program 81.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(w0 \cdot \sqrt{1 - \frac{M \cdot \left(0.5 \cdot \frac{D}{d}\right)}{1} \cdot \frac{\frac{\left(M \cdot 0.5\right) \cdot D}{d}}{\frac{\ell}{h}}}\right)} - 1} \]
    3. /-rgt-identity27.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 70.6% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \cdot D \leq 3.7 \cdot 10^{+209}:\\ \;\;\;\;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} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= (* M D) 3.7e+209)
   w0
   (* -0.125 (/ (* (* (* M D) (* M D)) (* w0 h)) (* l (pow d 2.0))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((M * D) <= 3.7e+209) {
		tmp = w0;
	} else {
		tmp = -0.125 * ((((M * D) * (M * D)) * (w0 * h)) / (l * pow(d, 2.0)));
	}
	return tmp;
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if ((m * d) <= 3.7d+209) then
        tmp = w0
    else
        tmp = (-0.125d0) * ((((m * d) * (m * d)) * (w0 * h)) / (l * (d_1 ** 2.0d0)))
    end if
    code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((M * D) <= 3.7e+209) {
		tmp = w0;
	} else {
		tmp = -0.125 * ((((M * D) * (M * D)) * (w0 * h)) / (l * Math.pow(d, 2.0)));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	tmp = 0
	if (M * D) <= 3.7e+209:
		tmp = w0
	else:
		tmp = -0.125 * ((((M * D) * (M * D)) * (w0 * h)) / (l * math.pow(d, 2.0)))
	return tmp
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (Float64(M * D) <= 3.7e+209)
		tmp = w0;
	else
		tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(M * D) * Float64(M * D)) * Float64(w0 * h)) / Float64(l * (d ^ 2.0))));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if ((M * D) <= 3.7e+209)
		tmp = w0;
	else
		tmp = -0.125 * ((((M * D) * (M * D)) * (w0 * h)) / (l * (d ^ 2.0)));
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(M * D), $MachinePrecision], 3.7e+209], w0, N[(-0.125 * N[(N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * N[(w0 * h), $MachinePrecision]), $MachinePrecision] / N[(l * N[Power[d, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \cdot D \leq 3.7 \cdot 10^{+209}:\\
\;\;\;\;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}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 M D) < 3.7e209

    1. Initial program 82.9%

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

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

    if 3.7e209 < (*.f64 M D)

    1. Initial program 62.8%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Taylor expanded in M around 0 44.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)} \]
    3. Step-by-step derivation
      1. +-commutative44.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. *-commutative44.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-def44.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. times-frac44.7%

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

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

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

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

        \[\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. unpow243.9%

        \[\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. unpow243.9%

        \[\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-sqr43.9%

        \[\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. unpow243.9%

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

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

        \[\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} \]
      2. *-commutative43.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \cdot D \leq 3.7 \cdot 10^{+209}:\\ \;\;\;\;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} \]

Alternative 3: 68.3% accurate, 216.0× speedup?

\[\begin{array}{l} \\ w0 \end{array} \]
(FPCore (w0 M D h l d) :precision binary64 w0)
double code(double w0, double M, double D, double h, double l, double d) {
	return w0;
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    code = w0
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	return w0;
}
def code(w0, M, D, h, l, d):
	return w0
function code(w0, M, D, h, l, d)
	return w0
end
function tmp = code(w0, M, D, h, l, d)
	tmp = w0;
end
code[w0_, M_, D_, h_, l_, d_] := w0
\begin{array}{l}

\\
w0
\end{array}
Derivation
  1. Initial program 81.2%

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

    \[\leadsto \color{blue}{w0} \]
  3. Final simplification67.7%

    \[\leadsto w0 \]

Reproduce

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