Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.3% → 91.3%
Time: 22.4s
Alternatives: 8
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 8 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: 91.3% 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}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+250}:\\ \;\;\;\;{\left(\sqrt[3]{w0} \cdot \left(\left({\left(h \cdot \frac{-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}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \left(D\_m \cdot 0.5\right)\right) \cdot \frac{h}{d\_m \cdot \left(\ell \cdot \left(d\_m \cdot \frac{2}{M\_m \cdot D\_m}\right)\right)}}\\ \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 (<= (* (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0) (/ h l)) -5e+250)
   (pow
    (*
     (cbrt w0)
     (*
      (* (pow (* h (/ -0.25 l)) 0.16666666666666666) (cbrt (* M_m D_m)))
      (exp (* -0.3333333333333333 (log d_m)))))
    3.0)
   (*
    w0
    (sqrt
     (-
      1.0
      (*
       (* M_m (* D_m 0.5))
       (/ h (* d_m (* l (* d_m (/ 2.0 (* M_m D_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) {
	double tmp;
	if ((pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -5e+250) {
		tmp = pow((cbrt(w0) * ((pow((h * (-0.25 / l)), 0.16666666666666666) * cbrt((M_m * D_m))) * exp((-0.3333333333333333 * log(d_m))))), 3.0);
	} else {
		tmp = w0 * sqrt((1.0 - ((M_m * (D_m * 0.5)) * (h / (d_m * (l * (d_m * (2.0 / (M_m * D_m)))))))));
	}
	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 ((Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -5e+250) {
		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);
	} else {
		tmp = w0 * Math.sqrt((1.0 - ((M_m * (D_m * 0.5)) * (h / (d_m * (l * (d_m * (2.0 / (M_m * D_m)))))))));
	}
	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(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l)) <= -5e+250)
		tmp = Float64(cbrt(w0) * Float64(Float64((Float64(h * Float64(-0.25 / l)) ^ 0.16666666666666666) * cbrt(Float64(M_m * D_m))) * exp(Float64(-0.3333333333333333 * log(d_m))))) ^ 3.0;
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * Float64(D_m * 0.5)) * Float64(h / Float64(d_m * Float64(l * Float64(d_m * Float64(2.0 / Float64(M_m * D_m))))))))));
	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[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+250], N[Power[N[(N[Power[w0, 1/3], $MachinePrecision] * N[(N[(N[Power[N[(h * N[(-0.25 / l), $MachinePrecision]), $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], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / N[(d$95$m * N[(l * N[(d$95$m * N[(2.0 / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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|

\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+250}:\\
\;\;\;\;{\left(\sqrt[3]{w0} \cdot \left(\left({\left(h \cdot \frac{-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}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.0000000000000002e250

    1. Initial program 55.0%

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

      \[\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. Applied egg-rr56.3%

      \[\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}} \]
    5. Taylor expanded in d around 0 23.6%

      \[\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} \]
    6. Step-by-step derivation
      1. exp-prod23.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} \]
      2. unpow-prod-up23.4%

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

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

        \[\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*22.3%

        \[\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. unpow-prod-down24.8%

        \[\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. *-commutative24.8%

        \[\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} \]
    7. Applied egg-rr24.8%

      \[\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} \]
    8. Step-by-step derivation
      1. exp-prod24.8%

        \[\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-prod25.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. *-commutative25.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. *-commutative25.1%

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

        \[\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^{\left(-2 \cdot \log d\right) \cdot 0.16666666666666666}\right)\right)}^{3} \]
      6. associate-/l*24.0%

        \[\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^{\left(-2 \cdot \log d\right) \cdot 0.16666666666666666}\right)\right)}^{3} \]
      7. *-commutative24.0%

        \[\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^{\left(-2 \cdot \log d\right) \cdot 0.16666666666666666}\right)\right)}^{3} \]
      8. *-commutative24.0%

        \[\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.16666666666666666 \cdot \left(-2 \cdot \log d\right)}}\right)\right)}^{3} \]
      9. associate-*r*24.0%

        \[\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} \]
      10. metadata-eval24.0%

        \[\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} \]
    9. Simplified24.0%

      \[\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} \]
    10. Taylor expanded in D around 0 14.8%

      \[\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} \]
    11. Step-by-step derivation
      1. *-commutative14.8%

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

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

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

    if -5.0000000000000002e250 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))

    1. Initial program 88.5%

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

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

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

        \[\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. clear-num88.5%

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2}}}{\frac{2 \cdot d}{M \cdot D} \cdot d} \cdot \frac{h}{\ell}} \]
      7. associate-/l*88.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{M \cdot \frac{D}{2}}}{\frac{2 \cdot d}{M \cdot D} \cdot d} \cdot \frac{h}{\ell}} \]
      8. div-inv88.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 88.3% 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}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+250}:\\ \;\;\;\;{\left(\sqrt[3]{w0} \cdot \left({\left(-0.25 \cdot \left(\frac{h}{\ell} \cdot {\left(M\_m \cdot D\_m\right)}^{2}\right)\right)}^{0.16666666666666666} \cdot \sqrt[3]{\frac{1}{d\_m}}\right)\right)}^{3}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \left(D\_m \cdot 0.5\right)\right) \cdot \frac{h}{d\_m \cdot \left(\ell \cdot \left(d\_m \cdot \frac{2}{M\_m \cdot D\_m}\right)\right)}}\\ \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 (<= (* (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0) (/ h l)) -5e+250)
   (pow
    (*
     (cbrt w0)
     (*
      (pow (* -0.25 (* (/ h l) (pow (* M_m D_m) 2.0))) 0.16666666666666666)
      (cbrt (/ 1.0 d_m))))
    3.0)
   (*
    w0
    (sqrt
     (-
      1.0
      (*
       (* M_m (* D_m 0.5))
       (/ h (* d_m (* l (* d_m (/ 2.0 (* M_m D_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) {
	double tmp;
	if ((pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -5e+250) {
		tmp = pow((cbrt(w0) * (pow((-0.25 * ((h / l) * pow((M_m * D_m), 2.0))), 0.16666666666666666) * cbrt((1.0 / d_m)))), 3.0);
	} else {
		tmp = w0 * sqrt((1.0 - ((M_m * (D_m * 0.5)) * (h / (d_m * (l * (d_m * (2.0 / (M_m * D_m)))))))));
	}
	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 ((Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -5e+250) {
		tmp = Math.pow((Math.cbrt(w0) * (Math.pow((-0.25 * ((h / l) * Math.pow((M_m * D_m), 2.0))), 0.16666666666666666) * Math.cbrt((1.0 / d_m)))), 3.0);
	} else {
		tmp = w0 * Math.sqrt((1.0 - ((M_m * (D_m * 0.5)) * (h / (d_m * (l * (d_m * (2.0 / (M_m * D_m)))))))));
	}
	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(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l)) <= -5e+250)
		tmp = Float64(cbrt(w0) * Float64((Float64(-0.25 * Float64(Float64(h / l) * (Float64(M_m * D_m) ^ 2.0))) ^ 0.16666666666666666) * cbrt(Float64(1.0 / d_m)))) ^ 3.0;
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * Float64(D_m * 0.5)) * Float64(h / Float64(d_m * Float64(l * Float64(d_m * Float64(2.0 / Float64(M_m * D_m))))))))));
	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[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+250], N[Power[N[(N[Power[w0, 1/3], $MachinePrecision] * N[(N[Power[N[(-0.25 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M$95$m * D$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.16666666666666666], $MachinePrecision] * N[Power[N[(1.0 / d$95$m), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / N[(d$95$m * N[(l * N[(d$95$m * N[(2.0 / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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|

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.0000000000000002e250

    1. Initial program 55.0%

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

      \[\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. Applied egg-rr56.3%

      \[\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}} \]
    5. Taylor expanded in d around 0 23.6%

      \[\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} \]
    6. Step-by-step derivation
      1. exp-prod23.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} \]
      2. unpow-prod-up23.4%

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

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

        \[\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*22.3%

        \[\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. unpow-prod-down24.8%

        \[\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. *-commutative24.8%

        \[\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} \]
    7. Applied egg-rr24.8%

      \[\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} \]
    8. Step-by-step derivation
      1. exp-prod24.8%

        \[\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-prod25.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. *-commutative25.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. *-commutative25.1%

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

        \[\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^{\left(-2 \cdot \log d\right) \cdot 0.16666666666666666}\right)\right)}^{3} \]
      6. associate-/l*24.0%

        \[\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^{\left(-2 \cdot \log d\right) \cdot 0.16666666666666666}\right)\right)}^{3} \]
      7. *-commutative24.0%

        \[\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^{\left(-2 \cdot \log d\right) \cdot 0.16666666666666666}\right)\right)}^{3} \]
      8. *-commutative24.0%

        \[\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.16666666666666666 \cdot \left(-2 \cdot \log d\right)}}\right)\right)}^{3} \]
      9. associate-*r*24.0%

        \[\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} \]
      10. metadata-eval24.0%

        \[\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} \]
    9. Simplified24.0%

      \[\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} \]
    10. Taylor expanded in d around 0 24.4%

      \[\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 \color{blue}{\sqrt[3]{\frac{1}{d}}}\right)\right)}^{3} \]

    if -5.0000000000000002e250 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))

    1. Initial program 88.5%

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

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

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

        \[\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. clear-num88.5%

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2}}}{\frac{2 \cdot d}{M \cdot D} \cdot d} \cdot \frac{h}{\ell}} \]
      7. associate-/l*88.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{M \cdot \frac{D}{2}}}{\frac{2 \cdot d}{M \cdot D} \cdot d} \cdot \frac{h}{\ell}} \]
      8. div-inv88.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 88.2% 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}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+250}:\\ \;\;\;\;{\left(\sqrt[3]{w0} \cdot \left({\left(-0.25 \cdot \left(\frac{h}{\ell} \cdot {\left(M\_m \cdot D\_m\right)}^{2}\right)\right)}^{0.16666666666666666} \cdot {d\_m}^{-0.3333333333333333}\right)\right)}^{3}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \left(D\_m \cdot 0.5\right)\right) \cdot \frac{h}{d\_m \cdot \left(\ell \cdot \left(d\_m \cdot \frac{2}{M\_m \cdot D\_m}\right)\right)}}\\ \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 (<= (* (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0) (/ h l)) -5e+250)
   (pow
    (*
     (cbrt w0)
     (*
      (pow (* -0.25 (* (/ h l) (pow (* M_m D_m) 2.0))) 0.16666666666666666)
      (pow d_m -0.3333333333333333)))
    3.0)
   (*
    w0
    (sqrt
     (-
      1.0
      (*
       (* M_m (* D_m 0.5))
       (/ h (* d_m (* l (* d_m (/ 2.0 (* M_m D_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) {
	double tmp;
	if ((pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -5e+250) {
		tmp = pow((cbrt(w0) * (pow((-0.25 * ((h / l) * pow((M_m * D_m), 2.0))), 0.16666666666666666) * pow(d_m, -0.3333333333333333))), 3.0);
	} else {
		tmp = w0 * sqrt((1.0 - ((M_m * (D_m * 0.5)) * (h / (d_m * (l * (d_m * (2.0 / (M_m * D_m)))))))));
	}
	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 ((Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0) * (h / l)) <= -5e+250) {
		tmp = Math.pow((Math.cbrt(w0) * (Math.pow((-0.25 * ((h / l) * Math.pow((M_m * D_m), 2.0))), 0.16666666666666666) * Math.pow(d_m, -0.3333333333333333))), 3.0);
	} else {
		tmp = w0 * Math.sqrt((1.0 - ((M_m * (D_m * 0.5)) * (h / (d_m * (l * (d_m * (2.0 / (M_m * D_m)))))))));
	}
	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(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0) * Float64(h / l)) <= -5e+250)
		tmp = Float64(cbrt(w0) * Float64((Float64(-0.25 * Float64(Float64(h / l) * (Float64(M_m * D_m) ^ 2.0))) ^ 0.16666666666666666) * (d_m ^ -0.3333333333333333))) ^ 3.0;
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * Float64(D_m * 0.5)) * Float64(h / Float64(d_m * Float64(l * Float64(d_m * Float64(2.0 / Float64(M_m * D_m))))))))));
	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[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -5e+250], N[Power[N[(N[Power[w0, 1/3], $MachinePrecision] * N[(N[Power[N[(-0.25 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M$95$m * D$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.16666666666666666], $MachinePrecision] * N[Power[d$95$m, -0.3333333333333333], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / N[(d$95$m * N[(l * N[(d$95$m * N[(2.0 / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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|

\\
\begin{array}{l}
\mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2} \cdot \frac{h}{\ell} \leq -5 \cdot 10^{+250}:\\
\;\;\;\;{\left(\sqrt[3]{w0} \cdot \left({\left(-0.25 \cdot \left(\frac{h}{\ell} \cdot {\left(M\_m \cdot D\_m\right)}^{2}\right)\right)}^{0.16666666666666666} \cdot {d\_m}^{-0.3333333333333333}\right)\right)}^{3}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -5.0000000000000002e250

    1. Initial program 55.0%

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

      \[\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. Applied egg-rr56.3%

      \[\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}} \]
    5. Taylor expanded in d around 0 23.6%

      \[\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} \]
    6. Step-by-step derivation
      1. exp-prod23.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} \]
      2. unpow-prod-up23.4%

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

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

        \[\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*22.3%

        \[\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. unpow-prod-down24.8%

        \[\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. *-commutative24.8%

        \[\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} \]
    7. Applied egg-rr24.8%

      \[\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} \]
    8. Step-by-step derivation
      1. exp-prod24.8%

        \[\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-prod25.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. *-commutative25.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. *-commutative25.1%

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

        \[\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^{\left(-2 \cdot \log d\right) \cdot 0.16666666666666666}\right)\right)}^{3} \]
      6. associate-/l*24.0%

        \[\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^{\left(-2 \cdot \log d\right) \cdot 0.16666666666666666}\right)\right)}^{3} \]
      7. *-commutative24.0%

        \[\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^{\left(-2 \cdot \log d\right) \cdot 0.16666666666666666}\right)\right)}^{3} \]
      8. *-commutative24.0%

        \[\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.16666666666666666 \cdot \left(-2 \cdot \log d\right)}}\right)\right)}^{3} \]
      9. associate-*r*24.0%

        \[\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} \]
      10. metadata-eval24.0%

        \[\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} \]
    9. Simplified24.0%

      \[\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} \]
    10. Step-by-step derivation
      1. *-commutative24.0%

        \[\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}{\log d \cdot -0.3333333333333333}}\right)\right)}^{3} \]
      2. exp-to-pow24.0%

        \[\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 \color{blue}{{d}^{-0.3333333333333333}}\right)\right)}^{3} \]
    11. Applied egg-rr24.0%

      \[\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 \color{blue}{{d}^{-0.3333333333333333}}\right)\right)}^{3} \]

    if -5.0000000000000002e250 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))

    1. Initial program 88.5%

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

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

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

        \[\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. clear-num88.5%

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2}}}{\frac{2 \cdot d}{M \cdot D} \cdot d} \cdot \frac{h}{\ell}} \]
      7. associate-/l*88.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{M \cdot \frac{D}{2}}}{\frac{2 \cdot d}{M \cdot D} \cdot d} \cdot \frac{h}{\ell}} \]
      8. div-inv88.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(M \cdot \left(0.5 \cdot D\right)\right) \cdot \frac{h}{d \cdot \left(\left(d \cdot \frac{2}{M \cdot D}\right) \cdot \ell\right)}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.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^{+250}:\\ \;\;\;\;{\left(\sqrt[3]{w0} \cdot \left({\left(-0.25 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot D\right)}^{2}\right)\right)}^{0.16666666666666666} \cdot {d}^{-0.3333333333333333}\right)\right)}^{3}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \left(M \cdot \left(D \cdot 0.5\right)\right) \cdot \frac{h}{d \cdot \left(\ell \cdot \left(d \cdot \frac{2}{M \cdot D}\right)\right)}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 87.1% accurate, 1.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ d_m = \left|d\right| \\ \begin{array}{l} \mathbf{if}\;\ell \leq 10^{+53}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d\_m}\right)\right)}^{2}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \left(M\_m \cdot \left(D\_m \cdot 0.5\right)\right) \cdot \frac{h}{d\_m \cdot \left(\ell \cdot \left(d\_m \cdot \frac{2}{M\_m \cdot D\_m}\right)\right)}}\\ \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 (<= l 1e+53)
   (* w0 (sqrt (- 1.0 (/ (* h (pow (* M_m (* 0.5 (/ D_m d_m))) 2.0)) l))))
   (*
    w0
    (sqrt
     (-
      1.0
      (*
       (* M_m (* D_m 0.5))
       (/ h (* d_m (* l (* d_m (/ 2.0 (* M_m D_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) {
	double tmp;
	if (l <= 1e+53) {
		tmp = w0 * sqrt((1.0 - ((h * pow((M_m * (0.5 * (D_m / d_m))), 2.0)) / l)));
	} else {
		tmp = w0 * sqrt((1.0 - ((M_m * (D_m * 0.5)) * (h / (d_m * (l * (d_m * (2.0 / (M_m * D_m)))))))));
	}
	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 (l <= 1d+53) then
        tmp = w0 * sqrt((1.0d0 - ((h * ((m_m * (0.5d0 * (d_m / d_m_1))) ** 2.0d0)) / l)))
    else
        tmp = w0 * sqrt((1.0d0 - ((m_m * (d_m * 0.5d0)) * (h / (d_m_1 * (l * (d_m_1 * (2.0d0 / (m_m * d_m)))))))))
    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 (l <= 1e+53) {
		tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow((M_m * (0.5 * (D_m / d_m))), 2.0)) / l)));
	} else {
		tmp = w0 * Math.sqrt((1.0 - ((M_m * (D_m * 0.5)) * (h / (d_m * (l * (d_m * (2.0 / (M_m * D_m)))))))));
	}
	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 l <= 1e+53:
		tmp = w0 * math.sqrt((1.0 - ((h * math.pow((M_m * (0.5 * (D_m / d_m))), 2.0)) / l)))
	else:
		tmp = w0 * math.sqrt((1.0 - ((M_m * (D_m * 0.5)) * (h / (d_m * (l * (d_m * (2.0 / (M_m * D_m)))))))))
	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 (l <= 1e+53)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d_m))) ^ 2.0)) / l))));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M_m * Float64(D_m * 0.5)) * Float64(h / Float64(d_m * Float64(l * Float64(d_m * Float64(2.0 / Float64(M_m * D_m))))))))));
	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 (l <= 1e+53)
		tmp = w0 * sqrt((1.0 - ((h * ((M_m * (0.5 * (D_m / d_m))) ^ 2.0)) / l)));
	else
		tmp = w0 * sqrt((1.0 - ((M_m * (D_m * 0.5)) * (h / (d_m * (l * (d_m * (2.0 / (M_m * D_m)))))))));
	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[l, 1e+53], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / N[(d$95$m * N[(l * N[(d$95$m * N[(2.0 / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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|

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if l < 9.9999999999999999e52

    1. Initial program 80.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.9999999999999999e52 < l

    1. Initial program 75.0%

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

      \[\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/75.0%

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

        \[\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. clear-num75.0%

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2}}}{\frac{2 \cdot d}{M \cdot D} \cdot d} \cdot \frac{h}{\ell}} \]
      7. associate-/l*75.0%

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{M \cdot \frac{D}{2}}}{\frac{2 \cdot d}{M \cdot D} \cdot d} \cdot \frac{h}{\ell}} \]
      8. div-inv75.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 86.2% accurate, 1.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ d_m = \left|d\right| \\ w0 \cdot \sqrt{1 + \left(h \cdot {\left(0.5 \cdot \left(D\_m \cdot \frac{M\_m}{d\_m}\right)\right)}^{2}\right) \cdot \frac{-1}{\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 (pow (* 0.5 (* D_m (/ M_m d_m))) 2.0)) (/ -1.0 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 * pow((0.5 * (D_m * (M_m / d_m))), 2.0)) * (-1.0 / 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 * ((0.5d0 * (d_m * (m_m / d_m_1))) ** 2.0d0)) * ((-1.0d0) / 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 * Math.pow((0.5 * (D_m * (M_m / d_m))), 2.0)) * (-1.0 / 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 * math.pow((0.5 * (D_m * (M_m / d_m))), 2.0)) * (-1.0 / 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(Float64(h * (Float64(0.5 * Float64(D_m * Float64(M_m / d_m))) ^ 2.0)) * Float64(-1.0 / 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 * ((0.5 * (D_m * (M_m / d_m))) ^ 2.0)) * (-1.0 / 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[(N[(h * N[Power[N[(0.5 * N[(D$95$m * N[(M$95$m / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / 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 + \left(h \cdot {\left(0.5 \cdot \left(D\_m \cdot \frac{M\_m}{d\_m}\right)\right)}^{2}\right) \cdot \frac{-1}{\ell}}
\end{array}
Derivation
  1. Initial program 79.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 76.0% 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}\;M\_m \cdot D\_m \leq 5 \cdot 10^{+14}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 + -0.125 \cdot \left(\left(\left(M\_m \cdot D\_m\right) \cdot \frac{M\_m \cdot D\_m}{{d\_m}^{2}}\right) \cdot \frac{h \cdot w0}{\ell}\right)\\ \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) 5e+14)
   w0
   (+
    w0
    (*
     -0.125
     (* (* (* M_m D_m) (/ (* M_m D_m) (pow d_m 2.0))) (/ (* h w0) 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) {
	double tmp;
	if ((M_m * D_m) <= 5e+14) {
		tmp = w0;
	} else {
		tmp = w0 + (-0.125 * (((M_m * D_m) * ((M_m * D_m) / pow(d_m, 2.0))) * ((h * w0) / l)));
	}
	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 ((m_m * d_m) <= 5d+14) then
        tmp = w0
    else
        tmp = w0 + ((-0.125d0) * (((m_m * d_m) * ((m_m * d_m) / (d_m_1 ** 2.0d0))) * ((h * w0) / l)))
    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 ((M_m * D_m) <= 5e+14) {
		tmp = w0;
	} else {
		tmp = w0 + (-0.125 * (((M_m * D_m) * ((M_m * D_m) / Math.pow(d_m, 2.0))) * ((h * w0) / l)));
	}
	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 (M_m * D_m) <= 5e+14:
		tmp = w0
	else:
		tmp = w0 + (-0.125 * (((M_m * D_m) * ((M_m * D_m) / math.pow(d_m, 2.0))) * ((h * w0) / l)))
	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(M_m * D_m) <= 5e+14)
		tmp = w0;
	else
		tmp = Float64(w0 + Float64(-0.125 * Float64(Float64(Float64(M_m * D_m) * Float64(Float64(M_m * D_m) / (d_m ^ 2.0))) * Float64(Float64(h * w0) / l))));
	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 ((M_m * D_m) <= 5e+14)
		tmp = w0;
	else
		tmp = w0 + (-0.125 * (((M_m * D_m) * ((M_m * D_m) / (d_m ^ 2.0))) * ((h * w0) / l)));
	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[(M$95$m * D$95$m), $MachinePrecision], 5e+14], w0, N[(w0 + N[(-0.125 * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[Power[d$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h * w0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
d_m = \left|d\right|

\\
\begin{array}{l}
\mathbf{if}\;M\_m \cdot D\_m \leq 5 \cdot 10^{+14}:\\
\;\;\;\;w0\\

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


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

    1. Initial program 83.0%

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

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

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

    if 5e14 < (*.f64 M D)

    1. Initial program 62.5%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Simplified62.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 29.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 87.1% 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 - \left(M\_m \cdot \left(D\_m \cdot 0.5\right)\right) \cdot \frac{h}{d\_m \cdot \left(\ell \cdot \left(d\_m \cdot \frac{2}{M\_m \cdot D\_m}\right)\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
    (* (* M_m (* D_m 0.5)) (/ h (* d_m (* l (* d_m (/ 2.0 (* M_m D_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 - ((M_m * (D_m * 0.5)) * (h / (d_m * (l * (d_m * (2.0 / (M_m * D_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 - ((m_m * (d_m * 0.5d0)) * (h / (d_m_1 * (l * (d_m_1 * (2.0d0 / (m_m * d_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 - ((M_m * (D_m * 0.5)) * (h / (d_m * (l * (d_m * (2.0 / (M_m * D_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 - ((M_m * (D_m * 0.5)) * (h / (d_m * (l * (d_m * (2.0 / (M_m * D_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(Float64(M_m * Float64(D_m * 0.5)) * Float64(h / Float64(d_m * Float64(l * Float64(d_m * Float64(2.0 / Float64(M_m * D_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 - ((M_m * (D_m * 0.5)) * (h / (d_m * (l * (d_m * (2.0 / (M_m * D_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[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / N[(d$95$m * N[(l * N[(d$95$m * N[(2.0 / N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 - \left(M\_m \cdot \left(D\_m \cdot 0.5\right)\right) \cdot \frac{h}{d\_m \cdot \left(\ell \cdot \left(d\_m \cdot \frac{2}{M\_m \cdot D\_m}\right)\right)}}
\end{array}
Derivation
  1. Initial program 79.1%

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

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

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

      \[\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. clear-num79.1%

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2}}}{\frac{2 \cdot d}{M \cdot D} \cdot d} \cdot \frac{h}{\ell}} \]
    7. associate-/l*78.7%

      \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{M \cdot \frac{D}{2}}}{\frac{2 \cdot d}{M \cdot D} \cdot d} \cdot \frac{h}{\ell}} \]
    8. div-inv78.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 67.8% 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 79.1%

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

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

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

Reproduce

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