Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.0% → 89.6%
Time: 18.2s
Alternatives: 7
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 7 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: 89.6% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 5 \cdot 10^{+143}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\left(\frac{d\_m}{M\_m \cdot \left(D\_m \cdot 0.5\right)} \cdot \frac{2 \cdot d\_m}{M\_m \cdot D\_m}\right) \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;{\left(\sqrt[3]{w0} \cdot \left(\left({\left(\frac{h \cdot -0.25}{\ell}\right)}^{0.16666666666666666} \cdot \sqrt[3]{M\_m \cdot D\_m}\right) \cdot e^{-0.3333333333333333 \cdot \log d\_m}\right)\right)}^{3}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 5.00000000000000012e143

    1. Initial program 90.6%

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

      \[\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. associate-*r/90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000012e143 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d))

    1. Initial program 70.6%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Simplified70.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. Step-by-step derivation
      1. add-cube-cbrt70.6%

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

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

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

      \[\leadsto {\color{blue}{\left(\sqrt[3]{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} \]
    7. Step-by-step derivation
      1. exp-prod39.1%

        \[\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} \]
      2. unpow-prod-up39.1%

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

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

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

        \[\leadsto {\left(\sqrt[3]{w0} \cdot \left({\left(e^{0.16666666666666666}\right)}^{\log \left(-0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{\ell}\right)} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(-2 \cdot \log d\right)}\right)\right)}^{3} \]
      6. pow-prod-down45.9%

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

        \[\leadsto {\left(\sqrt[3]{w0} \cdot \left({\left(e^{0.16666666666666666}\right)}^{\log \left(-0.25 \cdot \frac{{\color{blue}{\left(M \cdot D\right)}}^{2} \cdot h}{\ell}\right)} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(-2 \cdot \log d\right)}\right)\right)}^{3} \]
    8. Applied egg-rr45.9%

      \[\leadsto {\left(\sqrt[3]{w0} \cdot \color{blue}{\left({\left(e^{0.16666666666666666}\right)}^{\log \left(-0.25 \cdot \frac{{\left(M \cdot D\right)}^{2} \cdot h}{\ell}\right)} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(-2 \cdot \log d\right)}\right)}\right)}^{3} \]
    9. Step-by-step derivation
      1. exp-prod45.9%

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

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

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

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

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

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

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

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

      \[\leadsto {\left(\sqrt[3]{w0} \cdot \color{blue}{\left({\left(-0.25 \cdot \left({\left(D \cdot M\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}^{0.16666666666666666} \cdot e^{-0.3333333333333333 \cdot \log d}\right)}\right)}^{3} \]
    11. Taylor expanded in D around 0 49.5%

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

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

Alternative 2: 89.8% accurate, 0.7× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ d_m = \left|d\right| \\ \begin{array}{l} \mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 5 \cdot 10^{+143}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\left(\frac{d\_m}{M\_m \cdot \left(D\_m \cdot 0.5\right)} \cdot \frac{2 \cdot d\_m}{M\_m \cdot D\_m}\right) \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;{\left({\left(-0.25 \cdot \frac{h}{\ell}\right)}^{0.16666666666666666} \cdot \sqrt[3]{D\_m \cdot \frac{M\_m \cdot w0}{d\_m}}\right)}^{3}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
(FPCore (w0 M_m D_m h l d_m)
 :precision binary64
 (if (<= (/ (* M_m D_m) (* 2.0 d_m)) 5e+143)
   (*
    w0
    (sqrt
     (-
      1.0
      (/
       h
       (* (* (/ d_m (* M_m (* D_m 0.5))) (/ (* 2.0 d_m) (* M_m D_m))) l)))))
   (pow
    (*
     (pow (* -0.25 (/ h l)) 0.16666666666666666)
     (cbrt (* D_m (/ (* M_m w0) d_m))))
    3.0)))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
	double tmp;
	if (((M_m * D_m) / (2.0 * d_m)) <= 5e+143) {
		tmp = w0 * sqrt((1.0 - (h / (((d_m / (M_m * (D_m * 0.5))) * ((2.0 * d_m) / (M_m * D_m))) * l))));
	} else {
		tmp = pow((pow((-0.25 * (h / l)), 0.16666666666666666) * cbrt((D_m * ((M_m * w0) / d_m)))), 3.0);
	}
	return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
	double tmp;
	if (((M_m * D_m) / (2.0 * d_m)) <= 5e+143) {
		tmp = w0 * Math.sqrt((1.0 - (h / (((d_m / (M_m * (D_m * 0.5))) * ((2.0 * d_m) / (M_m * D_m))) * l))));
	} else {
		tmp = Math.pow((Math.pow((-0.25 * (h / l)), 0.16666666666666666) * Math.cbrt((D_m * ((M_m * w0) / d_m)))), 3.0);
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
d_m = abs(d)
function code(w0, M_m, D_m, h, l, d_m)
	tmp = 0.0
	if (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) <= 5e+143)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h / Float64(Float64(Float64(d_m / Float64(M_m * Float64(D_m * 0.5))) * Float64(Float64(2.0 * d_m) / Float64(M_m * D_m))) * l)))));
	else
		tmp = Float64((Float64(-0.25 * Float64(h / l)) ^ 0.16666666666666666) * cbrt(Float64(D_m * Float64(Float64(M_m * w0) / d_m)))) ^ 3.0;
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 5e+143], N[(w0 * N[Sqrt[N[(1.0 - N[(h / N[(N[(N[(d$95$m / N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * d$95$m), $MachinePrecision] / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(N[Power[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision], 0.16666666666666666], $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M$95$m * w0), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|

\\
\begin{array}{l}
\mathbf{if}\;\frac{M\_m \cdot D\_m}{2 \cdot d\_m} \leq 5 \cdot 10^{+143}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\left(\frac{d\_m}{M\_m \cdot \left(D\_m \cdot 0.5\right)} \cdot \frac{2 \cdot d\_m}{M\_m \cdot D\_m}\right) \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;{\left({\left(-0.25 \cdot \frac{h}{\ell}\right)}^{0.16666666666666666} \cdot \sqrt[3]{D\_m \cdot \frac{M\_m \cdot w0}{d\_m}}\right)}^{3}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 5.00000000000000012e143

    1. Initial program 90.6%

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

      \[\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. associate-*r/90.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000012e143 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d))

    1. Initial program 70.6%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Simplified70.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. Step-by-step derivation
      1. add-cube-cbrt70.6%

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

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

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

      \[\leadsto {\color{blue}{\left(\sqrt[3]{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} \]
    7. Step-by-step derivation
      1. exp-prod39.1%

        \[\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} \]
      2. unpow-prod-up39.1%

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

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

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

        \[\leadsto {\left(\sqrt[3]{w0} \cdot \left({\left(e^{0.16666666666666666}\right)}^{\log \left(-0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{\ell}\right)} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(-2 \cdot \log d\right)}\right)\right)}^{3} \]
      6. pow-prod-down45.9%

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

        \[\leadsto {\left(\sqrt[3]{w0} \cdot \left({\left(e^{0.16666666666666666}\right)}^{\log \left(-0.25 \cdot \frac{{\color{blue}{\left(M \cdot D\right)}}^{2} \cdot h}{\ell}\right)} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(-2 \cdot \log d\right)}\right)\right)}^{3} \]
    8. Applied egg-rr45.9%

      \[\leadsto {\left(\sqrt[3]{w0} \cdot \color{blue}{\left({\left(e^{0.16666666666666666}\right)}^{\log \left(-0.25 \cdot \frac{{\left(M \cdot D\right)}^{2} \cdot h}{\ell}\right)} \cdot {\left(e^{0.16666666666666666}\right)}^{\left(-2 \cdot \log d\right)}\right)}\right)}^{3} \]
    9. Step-by-step derivation
      1. exp-prod45.9%

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

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

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

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

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

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

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

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

      \[\leadsto {\left(\sqrt[3]{w0} \cdot \color{blue}{\left({\left(-0.25 \cdot \left({\left(D \cdot M\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}^{0.16666666666666666} \cdot e^{-0.3333333333333333 \cdot \log d}\right)}\right)}^{3} \]
    11. Taylor expanded in w0 around 0 81.1%

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

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

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

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

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

Alternative 3: 85.2% accurate, 1.7× speedup?

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

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

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


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

    1. Initial program 84.7%

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

      \[\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. unpow283.4%

        \[\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/83.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-num83.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-inv83.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-identity83.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-frac83.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-eval83.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-frac83.4%

        \[\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-rr83.4%

      \[\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. associate-*l/86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0000000000022e-312 < (/.f64 h l)

    1. Initial program 93.7%

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

      \[\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 97.2%

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

Alternative 4: 83.1% accurate, 1.7× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ d_m = \left|d\right| \\ \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-312}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d\_m}\right)\right) \cdot \left(0.5 \cdot \left(D\_m \cdot \left(\frac{h}{\ell} \cdot \frac{M\_m}{d\_m}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
(FPCore (w0 M_m D_m h l d_m)
 :precision binary64
 (if (<= (/ h l) -5e-312)
   (*
    w0
    (sqrt
     (-
      1.0
      (*
       (* M_m (* 0.5 (/ D_m d_m)))
       (* 0.5 (* D_m (* (/ h l) (/ M_m d_m))))))))
   w0))
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
	double tmp;
	if ((h / l) <= -5e-312) {
		tmp = w0 * sqrt((1.0 - ((M_m * (0.5 * (D_m / d_m))) * (0.5 * (D_m * ((h / l) * (M_m / d_m)))))));
	} else {
		tmp = w0;
	}
	return tmp;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_m_1
    real(8) :: tmp
    if ((h / l) <= (-5d-312)) then
        tmp = w0 * sqrt((1.0d0 - ((m_m * (0.5d0 * (d_m / d_m_1))) * (0.5d0 * (d_m * ((h / l) * (m_m / d_m_1)))))))
    else
        tmp = w0
    end if
    code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
	double tmp;
	if ((h / l) <= -5e-312) {
		tmp = w0 * Math.sqrt((1.0 - ((M_m * (0.5 * (D_m / d_m))) * (0.5 * (D_m * ((h / l) * (M_m / d_m)))))));
	} else {
		tmp = w0;
	}
	return tmp;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
d_m = math.fabs(d)
def code(w0, M_m, D_m, h, l, d_m):
	tmp = 0
	if (h / l) <= -5e-312:
		tmp = w0 * math.sqrt((1.0 - ((M_m * (0.5 * (D_m / d_m))) * (0.5 * (D_m * ((h / l) * (M_m / d_m)))))))
	else:
		tmp = w0
	return tmp
M_m = abs(M)
D_m = abs(D)
d_m = abs(d)
function code(w0, M_m, D_m, h, l, d_m)
	tmp = 0.0
	if (Float64(h / l) <= -5e-312)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * Float64(0.5 * Float64(D_m / d_m))) * Float64(0.5 * Float64(D_m * Float64(Float64(h / l) * Float64(M_m / d_m))))))));
	else
		tmp = w0;
	end
	return tmp
end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
function tmp_2 = code(w0, M_m, D_m, h, l, d_m)
	tmp = 0.0;
	if ((h / l) <= -5e-312)
		tmp = w0 * sqrt((1.0 - ((M_m * (0.5 * (D_m / d_m))) * (0.5 * (D_m * ((h / l) * (M_m / d_m)))))));
	else
		tmp = w0;
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := If[LessEqual[N[(h / l), $MachinePrecision], -5e-312], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * N[(0.5 * N[(D$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 * N[(D$95$m * N[(N[(h / l), $MachinePrecision] * N[(M$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|

\\
\begin{array}{l}
\mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-312}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d\_m}\right)\right) \cdot \left(0.5 \cdot \left(D\_m \cdot \left(\frac{h}{\ell} \cdot \frac{M\_m}{d\_m}\right)\right)\right)}\\

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


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

    1. Initial program 84.7%

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

      \[\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. unpow283.4%

        \[\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/83.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-num83.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-inv83.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-identity83.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-frac83.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-eval83.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-frac83.4%

        \[\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-rr83.4%

      \[\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. associate-*l/86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0000000000022e-312 < (/.f64 h l)

    1. Initial program 93.7%

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

      \[\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 97.2%

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

Alternative 5: 86.5% accurate, 1.8× speedup?

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

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

    \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
  2. Simplified87.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. associate-*r/88.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 86.0% accurate, 1.8× speedup?

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

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

    \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
  2. Simplified87.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. associate-*r/88.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 67.5% accurate, 216.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ d_m = \left|d\right| \\ w0 \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
d_m = (fabs.f64 d)
(FPCore (w0 M_m D_m h l d_m) :precision binary64 w0)
M_m = fabs(M);
D_m = fabs(D);
d_m = fabs(d);
double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
	return w0;
}
M_m = abs(m)
D_m = abs(d)
d_m = abs(d)
real(8) function code(w0, m_m, d_m, h, l, d_m_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m_m
    real(8), intent (in) :: d_m
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_m_1
    code = w0
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
d_m = Math.abs(d);
public static double code(double w0, double M_m, double D_m, double h, double l, double d_m) {
	return w0;
}
M_m = math.fabs(M)
D_m = math.fabs(D)
d_m = math.fabs(d)
def code(w0, M_m, D_m, h, l, d_m):
	return w0
M_m = abs(M)
D_m = abs(D)
d_m = abs(d)
function code(w0, M_m, D_m, h, l, d_m)
	return w0
end
M_m = abs(M);
D_m = abs(D);
d_m = abs(d);
function tmp = code(w0, M_m, D_m, h, l, d_m)
	tmp = w0;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
d_m = N[Abs[d], $MachinePrecision]
code[w0_, M$95$m_, D$95$m_, h_, l_, d$95$m_] := w0
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|

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

    \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
  2. Simplified87.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. Taylor expanded in M around 0 71.1%

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

Reproduce

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