Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.3% → 87.6%
Time: 25.4s
Alternatives: 9
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 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.3% 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.6% accurate, 0.2× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \frac{M \cdot D}{2 \cdot d_m}\\ \mathbf{if}\;{t_0}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+282}:\\ \;\;\;\;{\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\mathsf{fma}\left(-2, \log d_m, \log \left(-0.25 \cdot \frac{h \cdot {\left(M \cdot D\right)}^{2}}{\ell}\right)\right)\right)}\right)}^{3}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left({\left(\sqrt[3]{t_0}\right)}^{3}\right)}^{2}}{\ell}}\\ \end{array} \end{array} \]
d_m = (fabs.f64 d)
(FPCore (w0 M D h l d_m)
 :precision binary64
 (let* ((t_0 (/ (* M D) (* 2.0 d_m))))
   (if (<= (* (pow t_0 2.0) (/ h l)) -5e+282)
     (pow
      (*
       (cbrt w0)
       (pow
        (exp 0.16666666666666666)
        (fma -2.0 (log d_m) (log (* -0.25 (/ (* h (pow (* M D) 2.0)) l))))))
      3.0)
     (* w0 (sqrt (- 1.0 (/ (* h (pow (pow (cbrt t_0) 3.0) 2.0)) l)))))))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
	double t_0 = (M * D) / (2.0 * d_m);
	double tmp;
	if ((pow(t_0, 2.0) * (h / l)) <= -5e+282) {
		tmp = pow((cbrt(w0) * pow(exp(0.16666666666666666), fma(-2.0, log(d_m), log((-0.25 * ((h * pow((M * D), 2.0)) / l)))))), 3.0);
	} else {
		tmp = w0 * sqrt((1.0 - ((h * pow(pow(cbrt(t_0), 3.0), 2.0)) / l)));
	}
	return tmp;
}
d_m = abs(d)
function code(w0, M, D, h, l, d_m)
	t_0 = Float64(Float64(M * D) / Float64(2.0 * d_m))
	tmp = 0.0
	if (Float64((t_0 ^ 2.0) * Float64(h / l)) <= -5e+282)
		tmp = Float64(cbrt(w0) * (exp(0.16666666666666666) ^ fma(-2.0, log(d_m), log(Float64(-0.25 * Float64(Float64(h * (Float64(M * D) ^ 2.0)) / l)))))) ^ 3.0;
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * ((cbrt(t_0) ^ 3.0) ^ 2.0)) / l))));
	end
	return tmp
end
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M_, D_, h_, l_, d$95$m_] := Block[{t$95$0 = N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+282], N[Power[N[(N[Power[w0, 1/3], $MachinePrecision] * N[Power[N[Exp[0.16666666666666666], $MachinePrecision], N[(-2.0 * N[Log[d$95$m], $MachinePrecision] + N[Log[N[(-0.25 * N[(N[(h * N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 3.0], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|

\\
\begin{array}{l}
t_0 := \frac{M \cdot D}{2 \cdot d_m}\\
\mathbf{if}\;{t_0}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+282}:\\
\;\;\;\;{\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\mathsf{fma}\left(-2, \log d_m, \log \left(-0.25 \cdot \frac{h \cdot {\left(M \cdot D\right)}^{2}}{\ell}\right)\right)\right)}\right)}^{3}\\

\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left({\left(\sqrt[3]{t_0}\right)}^{3}\right)}^{2}}{\ell}}\\


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

    1. Initial program 61.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left({\left(1 \cdot w0\right)}^{0.3333333333333333} \cdot e^{0.16666666666666666 \cdot \left(\log \left(-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right) + -2 \cdot \log d\right)}\right)}}^{3} \]
    11. Step-by-step derivation
      1. unpow1/330.4%

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

        \[\leadsto {\left(\sqrt[3]{\color{blue}{w0}} \cdot e^{0.16666666666666666 \cdot \left(\log \left(-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right) + -2 \cdot \log d\right)}\right)}^{3} \]
      3. exp-prod30.4%

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

        \[\leadsto {\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\color{blue}{\left(-2 \cdot \log d + \log \left(-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)\right)}}\right)}^{3} \]
      5. fma-def30.4%

        \[\leadsto {\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\color{blue}{\left(\mathsf{fma}\left(-2, \log d, \log \left(-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)\right)\right)}}\right)}^{3} \]
      6. distribute-lft-neg-in30.4%

        \[\leadsto {\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\mathsf{fma}\left(-2, \log d, \log \color{blue}{\left(\left(-0.25\right) \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}\right)\right)}\right)}^{3} \]
      7. metadata-eval30.4%

        \[\leadsto {\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\mathsf{fma}\left(-2, \log d, \log \left(\color{blue}{-0.25} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)\right)\right)}\right)}^{3} \]
      8. associate-*r*30.5%

        \[\leadsto {\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\mathsf{fma}\left(-2, \log d, \log \left(-0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{\ell}\right)\right)\right)}\right)}^{3} \]
      9. unpow230.5%

        \[\leadsto {\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\mathsf{fma}\left(-2, \log d, \log \left(-0.25 \cdot \frac{\left(\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}\right) \cdot h}{\ell}\right)\right)\right)}\right)}^{3} \]
      10. unpow230.5%

        \[\leadsto {\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\mathsf{fma}\left(-2, \log d, \log \left(-0.25 \cdot \frac{\left(\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}\right) \cdot h}{\ell}\right)\right)\right)}\right)}^{3} \]
      11. swap-sqr39.5%

        \[\leadsto {\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\mathsf{fma}\left(-2, \log d, \log \left(-0.25 \cdot \frac{\color{blue}{\left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right)} \cdot h}{\ell}\right)\right)\right)}\right)}^{3} \]
      12. unpow239.5%

        \[\leadsto {\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\mathsf{fma}\left(-2, \log d, \log \left(-0.25 \cdot \frac{\color{blue}{{\left(D \cdot M\right)}^{2}} \cdot h}{\ell}\right)\right)\right)}\right)}^{3} \]
      13. *-commutative39.5%

        \[\leadsto {\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\mathsf{fma}\left(-2, \log d, \log \left(-0.25 \cdot \frac{\color{blue}{h \cdot {\left(D \cdot M\right)}^{2}}}{\ell}\right)\right)\right)}\right)}^{3} \]
    12. Simplified39.5%

      \[\leadsto {\color{blue}{\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\mathsf{fma}\left(-2, \log d, \log \left(-0.25 \cdot \frac{h \cdot {\left(D \cdot M\right)}^{2}}{\ell}\right)\right)\right)}\right)}}^{3} \]

    if -4.99999999999999978e282 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))

    1. Initial program 86.2%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+282}:\\ \;\;\;\;{\left(\sqrt[3]{w0} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(\mathsf{fma}\left(-2, \log d, \log \left(-0.25 \cdot \frac{h \cdot {\left(M \cdot D\right)}^{2}}{\ell}\right)\right)\right)}\right)}^{3}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left({\left(\sqrt[3]{\frac{M \cdot D}{2 \cdot d}}\right)}^{3}\right)}^{2}}{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 86.7% accurate, 0.7× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-13}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{\frac{2 \cdot d_m}{D}}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
d_m = (fabs.f64 d)
(FPCore (w0 M D h l d_m)
 :precision binary64
 (if (<= (* (pow (/ (* M D) (* 2.0 d_m)) 2.0) (/ h l)) -2e-13)
   (* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ M (/ (* 2.0 d_m) D)) 2.0)))))
   w0))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
	double tmp;
	if ((pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -2e-13) {
		tmp = w0 * sqrt((1.0 - ((h / l) * pow((M / ((2.0 * d_m) / D)), 2.0))));
	} else {
		tmp = w0;
	}
	return tmp;
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
    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_m
    real(8) :: tmp
    if (((((m * d) / (2.0d0 * d_m)) ** 2.0d0) * (h / l)) <= (-2d-13)) then
        tmp = w0 * sqrt((1.0d0 - ((h / l) * ((m / ((2.0d0 * d_m) / d)) ** 2.0d0))))
    else
        tmp = w0
    end if
    code = tmp
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
	double tmp;
	if ((Math.pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -2e-13) {
		tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((M / ((2.0 * d_m) / D)), 2.0))));
	} else {
		tmp = w0;
	}
	return tmp;
}
d_m = math.fabs(d)
def code(w0, M, D, h, l, d_m):
	tmp = 0
	if (math.pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -2e-13:
		tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((M / ((2.0 * d_m) / D)), 2.0))))
	else:
		tmp = w0
	return tmp
d_m = abs(d)
function code(w0, M, D, h, l, d_m)
	tmp = 0.0
	if (Float64((Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l)) <= -2e-13)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(M / Float64(Float64(2.0 * d_m) / D)) ^ 2.0)))));
	else
		tmp = w0;
	end
	return tmp
end
d_m = abs(d);
function tmp_2 = code(w0, M, D, h, l, d_m)
	tmp = 0.0;
	if (((((M * D) / (2.0 * d_m)) ^ 2.0) * (h / l)) <= -2e-13)
		tmp = w0 * sqrt((1.0 - ((h / l) * ((M / ((2.0 * d_m) / D)) ^ 2.0))));
	else
		tmp = w0;
	end
	tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M_, D_, h_, l_, d$95$m_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e-13], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(M / N[(N[(2.0 * d$95$m), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
d_m = \left|d\right|

\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-13}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{\frac{2 \cdot d_m}{D}}\right)}^{2}}\\

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


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

    1. Initial program 70.0%

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

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

    if -2.0000000000000001e-13 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))

    1. Initial program 84.7%

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

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

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

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

Alternative 3: 86.6% accurate, 0.7× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-13}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{\frac{D}{-2}}{\frac{d_m}{M}}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
d_m = (fabs.f64 d)
(FPCore (w0 M D h l d_m)
 :precision binary64
 (if (<= (* (pow (/ (* M D) (* 2.0 d_m)) 2.0) (/ h l)) -2e-13)
   (* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ (/ D -2.0) (/ d_m M)) 2.0)))))
   w0))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
	double tmp;
	if ((pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -2e-13) {
		tmp = w0 * sqrt((1.0 - ((h / l) * pow(((D / -2.0) / (d_m / M)), 2.0))));
	} else {
		tmp = w0;
	}
	return tmp;
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
    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_m
    real(8) :: tmp
    if (((((m * d) / (2.0d0 * d_m)) ** 2.0d0) * (h / l)) <= (-2d-13)) then
        tmp = w0 * sqrt((1.0d0 - ((h / l) * (((d / (-2.0d0)) / (d_m / m)) ** 2.0d0))))
    else
        tmp = w0
    end if
    code = tmp
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
	double tmp;
	if ((Math.pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -2e-13) {
		tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((D / -2.0) / (d_m / M)), 2.0))));
	} else {
		tmp = w0;
	}
	return tmp;
}
d_m = math.fabs(d)
def code(w0, M, D, h, l, d_m):
	tmp = 0
	if (math.pow(((M * D) / (2.0 * d_m)), 2.0) * (h / l)) <= -2e-13:
		tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((D / -2.0) / (d_m / M)), 2.0))))
	else:
		tmp = w0
	return tmp
d_m = abs(d)
function code(w0, M, D, h, l, d_m)
	tmp = 0.0
	if (Float64((Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l)) <= -2e-13)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(D / -2.0) / Float64(d_m / M)) ^ 2.0)))));
	else
		tmp = w0;
	end
	return tmp
end
d_m = abs(d);
function tmp_2 = code(w0, M, D, h, l, d_m)
	tmp = 0.0;
	if (((((M * D) / (2.0 * d_m)) ^ 2.0) * (h / l)) <= -2e-13)
		tmp = w0 * sqrt((1.0 - ((h / l) * (((D / -2.0) / (d_m / M)) ^ 2.0))));
	else
		tmp = w0;
	end
	tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M_, D_, h_, l_, d$95$m_] := If[LessEqual[N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e-13], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / -2.0), $MachinePrecision] / N[(d$95$m / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
d_m = \left|d\right|

\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{-13}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{\frac{D}{-2}}{\frac{d_m}{M}}\right)}^{2}}\\

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


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

    1. Initial program 70.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e-13 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))

    1. Initial program 84.7%

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

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

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

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

Alternative 4: 73.2% accurate, 1.0× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} \mathbf{if}\;D \leq 5.4 \cdot 10^{+51}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{d_m}{M \cdot \left(D \cdot -0.5\right)}\right)}^{-2}}\\ \end{array} \end{array} \]
d_m = (fabs.f64 d)
(FPCore (w0 M D h l d_m)
 :precision binary64
 (if (<= D 5.4e+51)
   w0
   (* w0 (sqrt (- 1.0 (* (/ h l) (pow (/ d_m (* M (* D -0.5))) -2.0)))))))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
	double tmp;
	if (D <= 5.4e+51) {
		tmp = w0;
	} else {
		tmp = w0 * sqrt((1.0 - ((h / l) * pow((d_m / (M * (D * -0.5))), -2.0))));
	}
	return tmp;
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
    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_m
    real(8) :: tmp
    if (d <= 5.4d+51) then
        tmp = w0
    else
        tmp = w0 * sqrt((1.0d0 - ((h / l) * ((d_m / (m * (d * (-0.5d0)))) ** (-2.0d0)))))
    end if
    code = tmp
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
	double tmp;
	if (D <= 5.4e+51) {
		tmp = w0;
	} else {
		tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow((d_m / (M * (D * -0.5))), -2.0))));
	}
	return tmp;
}
d_m = math.fabs(d)
def code(w0, M, D, h, l, d_m):
	tmp = 0
	if D <= 5.4e+51:
		tmp = w0
	else:
		tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow((d_m / (M * (D * -0.5))), -2.0))))
	return tmp
d_m = abs(d)
function code(w0, M, D, h, l, d_m)
	tmp = 0.0
	if (D <= 5.4e+51)
		tmp = w0;
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(d_m / Float64(M * Float64(D * -0.5))) ^ -2.0)))));
	end
	return tmp
end
d_m = abs(d);
function tmp_2 = code(w0, M, D, h, l, d_m)
	tmp = 0.0;
	if (D <= 5.4e+51)
		tmp = w0;
	else
		tmp = w0 * sqrt((1.0 - ((h / l) * ((d_m / (M * (D * -0.5))) ^ -2.0))));
	end
	tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M_, D_, h_, l_, d$95$m_] := If[LessEqual[D, 5.4e+51], w0, N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(d$95$m / N[(M * N[(D * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|

\\
\begin{array}{l}
\mathbf{if}\;D \leq 5.4 \cdot 10^{+51}:\\
\;\;\;\;w0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if D < 5.39999999999999983e51

    1. Initial program 78.9%

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

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

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

    if 5.39999999999999983e51 < D

    1. Initial program 83.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 64.2% accurate, 1.0× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} \mathbf{if}\;M \leq 4.7 \cdot 10^{+39}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot \left(w0 \cdot \left(\frac{h}{{d_m}^{2}} \cdot \frac{{\left(M \cdot D\right)}^{2}}{\ell}\right)\right)\\ \end{array} \end{array} \]
d_m = (fabs.f64 d)
(FPCore (w0 M D h l d_m)
 :precision binary64
 (if (<= M 4.7e+39)
   w0
   (* -0.125 (* w0 (* (/ h (pow d_m 2.0)) (/ (pow (* M D) 2.0) l))))))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
	double tmp;
	if (M <= 4.7e+39) {
		tmp = w0;
	} else {
		tmp = -0.125 * (w0 * ((h / pow(d_m, 2.0)) * (pow((M * D), 2.0) / l)));
	}
	return tmp;
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
    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_m
    real(8) :: tmp
    if (m <= 4.7d+39) then
        tmp = w0
    else
        tmp = (-0.125d0) * (w0 * ((h / (d_m ** 2.0d0)) * (((m * d) ** 2.0d0) / l)))
    end if
    code = tmp
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
	double tmp;
	if (M <= 4.7e+39) {
		tmp = w0;
	} else {
		tmp = -0.125 * (w0 * ((h / Math.pow(d_m, 2.0)) * (Math.pow((M * D), 2.0) / l)));
	}
	return tmp;
}
d_m = math.fabs(d)
def code(w0, M, D, h, l, d_m):
	tmp = 0
	if M <= 4.7e+39:
		tmp = w0
	else:
		tmp = -0.125 * (w0 * ((h / math.pow(d_m, 2.0)) * (math.pow((M * D), 2.0) / l)))
	return tmp
d_m = abs(d)
function code(w0, M, D, h, l, d_m)
	tmp = 0.0
	if (M <= 4.7e+39)
		tmp = w0;
	else
		tmp = Float64(-0.125 * Float64(w0 * Float64(Float64(h / (d_m ^ 2.0)) * Float64((Float64(M * D) ^ 2.0) / l))));
	end
	return tmp
end
d_m = abs(d);
function tmp_2 = code(w0, M, D, h, l, d_m)
	tmp = 0.0;
	if (M <= 4.7e+39)
		tmp = w0;
	else
		tmp = -0.125 * (w0 * ((h / (d_m ^ 2.0)) * (((M * D) ^ 2.0) / l)));
	end
	tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M_, D_, h_, l_, d$95$m_] := If[LessEqual[M, 4.7e+39], w0, N[(-0.125 * N[(w0 * N[(N[(h / N[Power[d$95$m, 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|

\\
\begin{array}{l}
\mathbf{if}\;M \leq 4.7 \cdot 10^{+39}:\\
\;\;\;\;w0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 4.6999999999999999e39

    1. Initial program 81.8%

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

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

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

    if 4.6999999999999999e39 < M

    1. Initial program 70.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 64.2% accurate, 1.0× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} \mathbf{if}\;M \leq 3.3 \cdot 10^{+37}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot \left(w0 \cdot \frac{\left(h \cdot {\left(M \cdot D\right)}^{2}\right) \cdot {d_m}^{-2}}{\ell}\right)\\ \end{array} \end{array} \]
d_m = (fabs.f64 d)
(FPCore (w0 M D h l d_m)
 :precision binary64
 (if (<= M 3.3e+37)
   w0
   (* -0.125 (* w0 (/ (* (* h (pow (* M D) 2.0)) (pow d_m -2.0)) l)))))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
	double tmp;
	if (M <= 3.3e+37) {
		tmp = w0;
	} else {
		tmp = -0.125 * (w0 * (((h * pow((M * D), 2.0)) * pow(d_m, -2.0)) / l));
	}
	return tmp;
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
    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_m
    real(8) :: tmp
    if (m <= 3.3d+37) then
        tmp = w0
    else
        tmp = (-0.125d0) * (w0 * (((h * ((m * d) ** 2.0d0)) * (d_m ** (-2.0d0))) / l))
    end if
    code = tmp
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
	double tmp;
	if (M <= 3.3e+37) {
		tmp = w0;
	} else {
		tmp = -0.125 * (w0 * (((h * Math.pow((M * D), 2.0)) * Math.pow(d_m, -2.0)) / l));
	}
	return tmp;
}
d_m = math.fabs(d)
def code(w0, M, D, h, l, d_m):
	tmp = 0
	if M <= 3.3e+37:
		tmp = w0
	else:
		tmp = -0.125 * (w0 * (((h * math.pow((M * D), 2.0)) * math.pow(d_m, -2.0)) / l))
	return tmp
d_m = abs(d)
function code(w0, M, D, h, l, d_m)
	tmp = 0.0
	if (M <= 3.3e+37)
		tmp = w0;
	else
		tmp = Float64(-0.125 * Float64(w0 * Float64(Float64(Float64(h * (Float64(M * D) ^ 2.0)) * (d_m ^ -2.0)) / l)));
	end
	return tmp
end
d_m = abs(d);
function tmp_2 = code(w0, M, D, h, l, d_m)
	tmp = 0.0;
	if (M <= 3.3e+37)
		tmp = w0;
	else
		tmp = -0.125 * (w0 * (((h * ((M * D) ^ 2.0)) * (d_m ^ -2.0)) / l));
	end
	tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M_, D_, h_, l_, d$95$m_] := If[LessEqual[M, 3.3e+37], w0, N[(-0.125 * N[(w0 * N[(N[(N[(h * N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[Power[d$95$m, -2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|

\\
\begin{array}{l}
\mathbf{if}\;M \leq 3.3 \cdot 10^{+37}:\\
\;\;\;\;w0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 3.3000000000000001e37

    1. Initial program 81.7%

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

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

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

    if 3.3000000000000001e37 < M

    1. Initial program 71.1%

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

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

      \[\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. *-commutative43.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.125 \cdot \left(\left(e^{\mathsf{log1p}\left(\left(h \cdot {d}^{\color{blue}{-2}}\right) \cdot \frac{{\left(D \cdot M\right)}^{2}}{\ell}\right)} - 1\right) \cdot w0\right) \]
    12. Applied egg-rr1.6%

      \[\leadsto -0.125 \cdot \left(\color{blue}{\left(e^{\mathsf{log1p}\left(\left(h \cdot {d}^{-2}\right) \cdot \frac{{\left(D \cdot M\right)}^{2}}{\ell}\right)} - 1\right)} \cdot w0\right) \]
    13. Step-by-step derivation
      1. expm1-def1.7%

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

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

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

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

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

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

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

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

Alternative 7: 86.2% accurate, 1.0× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ w0 \cdot \sqrt{1 - \frac{h \cdot {\left(M \cdot \frac{D}{2 \cdot d_m}\right)}^{2}}{\ell}} \end{array} \]
d_m = (fabs.f64 d)
(FPCore (w0 M D h l d_m)
 :precision binary64
 (* w0 (sqrt (- 1.0 (/ (* h (pow (* M (/ D (* 2.0 d_m))) 2.0)) l)))))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
	return w0 * sqrt((1.0 - ((h * pow((M * (D / (2.0 * d_m))), 2.0)) / l)));
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
    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_m
    code = w0 * sqrt((1.0d0 - ((h * ((m * (d / (2.0d0 * d_m))) ** 2.0d0)) / l)))
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
	return w0 * Math.sqrt((1.0 - ((h * Math.pow((M * (D / (2.0 * d_m))), 2.0)) / l)));
}
d_m = math.fabs(d)
def code(w0, M, D, h, l, d_m):
	return w0 * math.sqrt((1.0 - ((h * math.pow((M * (D / (2.0 * d_m))), 2.0)) / l)))
d_m = abs(d)
function code(w0, M, D, h, l, d_m)
	return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(M * Float64(D / Float64(2.0 * d_m))) ^ 2.0)) / l))))
end
d_m = abs(d);
function tmp = code(w0, M, D, h, l, d_m)
	tmp = w0 * sqrt((1.0 - ((h * ((M * (D / (2.0 * d_m))) ^ 2.0)) / l)));
end
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M_, D_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(M * N[(D / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|

\\
w0 \cdot \sqrt{1 - \frac{h \cdot {\left(M \cdot \frac{D}{2 \cdot d_m}\right)}^{2}}{\ell}}
\end{array}
Derivation
  1. Initial program 79.8%

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

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

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

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

Alternative 8: 86.3% accurate, 1.0× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ w0 \cdot \sqrt{1 - \frac{h \cdot {\left(\frac{\frac{d_m}{D \cdot -0.5}}{M}\right)}^{-2}}{\ell}} \end{array} \]
d_m = (fabs.f64 d)
(FPCore (w0 M D h l d_m)
 :precision binary64
 (* w0 (sqrt (- 1.0 (/ (* h (pow (/ (/ d_m (* D -0.5)) M) -2.0)) l)))))
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
	return w0 * sqrt((1.0 - ((h * pow(((d_m / (D * -0.5)) / M), -2.0)) / l)));
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
    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_m
    code = w0 * sqrt((1.0d0 - ((h * (((d_m / (d * (-0.5d0))) / m) ** (-2.0d0))) / l)))
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
	return w0 * Math.sqrt((1.0 - ((h * Math.pow(((d_m / (D * -0.5)) / M), -2.0)) / l)));
}
d_m = math.fabs(d)
def code(w0, M, D, h, l, d_m):
	return w0 * math.sqrt((1.0 - ((h * math.pow(((d_m / (D * -0.5)) / M), -2.0)) / l)))
d_m = abs(d)
function code(w0, M, D, h, l, d_m)
	return Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(Float64(d_m / Float64(D * -0.5)) / M) ^ -2.0)) / l))))
end
d_m = abs(d);
function tmp = code(w0, M, D, h, l, d_m)
	tmp = w0 * sqrt((1.0 - ((h * (((d_m / (D * -0.5)) / M) ^ -2.0)) / l)));
end
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M_, D_, h_, l_, d$95$m_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(N[(d$95$m / N[(D * -0.5), $MachinePrecision]), $MachinePrecision] / M), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
d_m = \left|d\right|

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 68.2% accurate, 216.0× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ w0 \end{array} \]
d_m = (fabs.f64 d)
(FPCore (w0 M D h l d_m) :precision binary64 w0)
d_m = fabs(d);
double code(double w0, double M, double D, double h, double l, double d_m) {
	return w0;
}
d_m = abs(d)
real(8) function code(w0, m, d, h, l, d_m)
    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_m
    code = w0
end function
d_m = Math.abs(d);
public static double code(double w0, double M, double D, double h, double l, double d_m) {
	return w0;
}
d_m = math.fabs(d)
def code(w0, M, D, h, l, d_m):
	return w0
d_m = abs(d)
function code(w0, M, D, h, l, d_m)
	return w0
end
d_m = abs(d);
function tmp = code(w0, M, D, h, l, d_m)
	tmp = w0;
end
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M_, D_, h_, l_, d$95$m_] := w0
\begin{array}{l}
d_m = \left|d\right|

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

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

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

    \[\leadsto \color{blue}{w0} \]
  5. Final simplification64.8%

    \[\leadsto w0 \]
  6. Add Preprocessing

Reproduce

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