Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.6% → 86.5%
Time: 14.5s
Alternatives: 10
Speedup: 1.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 81.6% 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: 86.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell}\\ \mathbf{if}\;t_0 \leq 2 \cdot 10^{+107}:\\ \;\;\;\;w0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(h \cdot \left(\frac{D}{d} \cdot \left(\frac{M}{d} \cdot \left(D \cdot \frac{M}{\ell}\right)\right)\right)\right)}\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (let* ((t_0 (- 1.0 (* (pow (/ (* D M) (* d 2.0)) 2.0) (/ h l)))))
   (if (<= t_0 2e+107)
     (* w0 (sqrt t_0))
     (*
      w0
      (sqrt (- 1.0 (* 0.25 (* h (* (/ D d) (* (/ M d) (* D (/ M l))))))))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = 1.0 - (pow(((D * M) / (d * 2.0)), 2.0) * (h / l));
	double tmp;
	if (t_0 <= 2e+107) {
		tmp = w0 * sqrt(t_0);
	} else {
		tmp = w0 * sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / l))))))));
	}
	return tmp;
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 - ((((d * m) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l))
    if (t_0 <= 2d+107) then
        tmp = w0 * sqrt(t_0)
    else
        tmp = w0 * sqrt((1.0d0 - (0.25d0 * (h * ((d / d_1) * ((m / d_1) * (d * (m / l))))))))
    end if
    code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = 1.0 - (Math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l));
	double tmp;
	if (t_0 <= 2e+107) {
		tmp = w0 * Math.sqrt(t_0);
	} else {
		tmp = w0 * Math.sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / l))))))));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	t_0 = 1.0 - (math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l))
	tmp = 0
	if t_0 <= 2e+107:
		tmp = w0 * math.sqrt(t_0)
	else:
		tmp = w0 * math.sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / l))))))))
	return tmp
function code(w0, M, D, h, l, d)
	t_0 = Float64(1.0 - Float64((Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l)))
	tmp = 0.0
	if (t_0 <= 2e+107)
		tmp = Float64(w0 * sqrt(t_0));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(h * Float64(Float64(D / d) * Float64(Float64(M / d) * Float64(D * Float64(M / l)))))))));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	t_0 = 1.0 - ((((D * M) / (d * 2.0)) ^ 2.0) * (h / l));
	tmp = 0.0;
	if (t_0 <= 2e+107)
		tmp = w0 * sqrt(t_0);
	else
		tmp = w0 * sqrt((1.0 - (0.25 * (h * ((D / d) * ((M / d) * (D * (M / l))))))));
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(1.0 - N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e+107], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(h * N[(N[(D / d), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(D * N[(M / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


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

    1. Initial program 100.0%

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

    if 1.9999999999999999e107 < (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)))

    1. Initial program 49.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{0.25 \cdot \frac{\left(D \cdot D\right) \cdot \left(M \cdot M\right)}{\frac{d \cdot \left(d \cdot \ell\right)}{h}}}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity46.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 83.0% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 81.9%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{0.25 \cdot \frac{\left(D \cdot D\right) \cdot \left(M \cdot M\right)}{\frac{d \cdot \left(d \cdot \ell\right)}{h}}}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity55.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.5000000000000005e67 < D

    1. Initial program 69.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;D \leq 7.5 \cdot 10^{+67}:\\ \;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(h \cdot \left(\frac{D}{d} \cdot \left(\frac{M}{d} \cdot \left(D \cdot \frac{M}{\ell}\right)\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}\\ \end{array} \]

Alternative 3: 86.5% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 74.9% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;D \leq 4800000:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(-0.25 \cdot \left(h \cdot \left(D \cdot \frac{D}{d}\right)\right)\right) \cdot \frac{M \cdot \frac{M}{d}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(M \cdot \left(\frac{D}{d} \cdot \left(\frac{D}{d} \cdot \frac{M}{\frac{\ell}{h}}\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= D 4800000.0)
   (* w0 (sqrt (+ 1.0 (* (* -0.25 (* h (* D (/ D d)))) (/ (* M (/ M d)) l)))))
   (* w0 (+ 1.0 (* -0.125 (* M (* (/ D d) (* (/ D d) (/ M (/ l h))))))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (D <= 4800000.0) {
		tmp = w0 * sqrt((1.0 + ((-0.25 * (h * (D * (D / d)))) * ((M * (M / d)) / l))));
	} else {
		tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h)))))));
	}
	return tmp;
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (d <= 4800000.0d0) then
        tmp = w0 * sqrt((1.0d0 + (((-0.25d0) * (h * (d * (d / d_1)))) * ((m * (m / d_1)) / l))))
    else
        tmp = w0 * (1.0d0 + ((-0.125d0) * (m * ((d / d_1) * ((d / d_1) * (m / (l / h)))))))
    end if
    code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (D <= 4800000.0) {
		tmp = w0 * Math.sqrt((1.0 + ((-0.25 * (h * (D * (D / d)))) * ((M * (M / d)) / l))));
	} else {
		tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h)))))));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	tmp = 0
	if D <= 4800000.0:
		tmp = w0 * math.sqrt((1.0 + ((-0.25 * (h * (D * (D / d)))) * ((M * (M / d)) / l))))
	else:
		tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h)))))))
	return tmp
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (D <= 4800000.0)
		tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(-0.25 * Float64(h * Float64(D * Float64(D / d)))) * Float64(Float64(M * Float64(M / d)) / l)))));
	else
		tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(M * Float64(Float64(D / d) * Float64(Float64(D / d) * Float64(M / Float64(l / h))))))));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if (D <= 4800000.0)
		tmp = w0 * sqrt((1.0 + ((-0.25 * (h * (D * (D / d)))) * ((M * (M / d)) / l))));
	else
		tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h)))))));
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[D, 4800000.0], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(-0.25 * N[(h * N[(D * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(M / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[(1.0 + N[(-0.125 * N[(M * N[(N[(D / d), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(M / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;D \leq 4800000:\\
\;\;\;\;w0 \cdot \sqrt{1 + \left(-0.25 \cdot \left(h \cdot \left(D \cdot \frac{D}{d}\right)\right)\right) \cdot \frac{M \cdot \frac{M}{d}}{\ell}}\\

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


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

    1. Initial program 82.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(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
    3. Taylor expanded in D around 0 52.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{0.25 \cdot \frac{\left(D \cdot D\right) \cdot \left(M \cdot M\right)}{\frac{d \cdot \left(d \cdot \ell\right)}{h}}}} \]
    6. Step-by-step derivation
      1. *-un-lft-identity55.8%

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

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

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

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

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

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

        \[\leadsto w0 \cdot \color{blue}{\left(1 \cdot \sqrt{1 - 0.25 \cdot \left(h \cdot \left(\frac{D \cdot D}{d} \cdot \frac{M \cdot M}{d \cdot \ell}\right)\right)}\right)} \]
      2. cancel-sign-sub-inv67.9%

        \[\leadsto w0 \cdot \left(1 \cdot \sqrt{\color{blue}{1 + \left(-0.25\right) \cdot \left(h \cdot \left(\frac{D \cdot D}{d} \cdot \frac{M \cdot M}{d \cdot \ell}\right)\right)}}\right) \]
      3. metadata-eval67.9%

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

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

        \[\leadsto w0 \cdot \left(1 \cdot \sqrt{1 + -0.25 \cdot \left(\left(h \cdot \color{blue}{\frac{D}{\frac{d}{D}}}\right) \cdot \frac{M \cdot M}{d \cdot \ell}\right)}\right) \]
      6. times-frac77.8%

        \[\leadsto w0 \cdot \left(1 \cdot \sqrt{1 + -0.25 \cdot \left(\left(h \cdot \frac{D}{\frac{d}{D}}\right) \cdot \color{blue}{\left(\frac{M}{d} \cdot \frac{M}{\ell}\right)}\right)}\right) \]
    10. Applied egg-rr77.8%

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

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

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

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

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

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

    if 4.8e6 < D

    1. Initial program 70.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 + -0.125 \cdot \color{blue}{\left(M \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M}{\frac{\ell}{h}}\right)\right)}\right) \cdot w0 \]
      10. associate-*l*65.0%

        \[\leadsto \left(1 + -0.125 \cdot \left(M \cdot \color{blue}{\left(\frac{D}{d} \cdot \left(\frac{D}{d} \cdot \frac{M}{\frac{\ell}{h}}\right)\right)}\right)\right) \cdot w0 \]
    11. Simplified65.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;D \leq 4800000:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(-0.25 \cdot \left(h \cdot \left(D \cdot \frac{D}{d}\right)\right)\right) \cdot \frac{M \cdot \frac{M}{d}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(M \cdot \left(\frac{D}{d} \cdot \left(\frac{D}{d} \cdot \frac{M}{\frac{\ell}{h}}\right)\right)\right)\right)\\ \end{array} \]

Alternative 5: 82.6% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{0.25 \cdot \frac{\left(D \cdot D\right) \cdot \left(M \cdot M\right)}{\frac{d \cdot \left(d \cdot \ell\right)}{h}}}} \]
  6. Step-by-step derivation
    1. *-un-lft-identity54.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 68.2% accurate, 9.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 1.05 \cdot 10^{-145}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right)\right)\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= M 1.05e-145)
   w0
   (* w0 (+ 1.0 (* -0.125 (* (* (/ D d) (/ D d)) (/ (* h (* M M)) l)))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= 1.05e-145) {
		tmp = w0;
	} else {
		tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) * ((h * (M * M)) / l))));
	}
	return tmp;
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (m <= 1.05d-145) then
        tmp = w0
    else
        tmp = w0 * (1.0d0 + ((-0.125d0) * (((d / d_1) * (d / d_1)) * ((h * (m * m)) / l))))
    end if
    code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= 1.05e-145) {
		tmp = w0;
	} else {
		tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) * ((h * (M * M)) / l))));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	tmp = 0
	if M <= 1.05e-145:
		tmp = w0
	else:
		tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) * ((h * (M * M)) / l))))
	return tmp
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (M <= 1.05e-145)
		tmp = w0;
	else
		tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(h * Float64(M * M)) / l)))));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if (M <= 1.05e-145)
		tmp = w0;
	else
		tmp = w0 * (1.0 + (-0.125 * (((D / d) * (D / d)) * ((h * (M * M)) / l))));
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 1.05e-145], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.05 \cdot 10^{-145}:\\
\;\;\;\;w0\\

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


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

    1. Initial program 81.1%

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

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

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

    if 1.04999999999999996e-145 < M

    1. Initial program 78.1%

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

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

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

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

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

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

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

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

      \[\leadsto w0 \cdot \color{blue}{\left(1 + \left(\frac{D \cdot D}{d \cdot d} \cdot \frac{\left(M \cdot M\right) \cdot h}{\ell}\right) \cdot -0.125\right)} \]
    6. Taylor expanded in D around 0 50.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 1.05 \cdot 10^{-145}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right)\right)\\ \end{array} \]

Alternative 7: 72.3% accurate, 9.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 2.2 \cdot 10^{-196}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(M \cdot \left(\frac{D}{d} \cdot \left(\frac{D}{d} \cdot \frac{M}{\frac{\ell}{h}}\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= M 2.2e-196)
   w0
   (* w0 (+ 1.0 (* -0.125 (* M (* (/ D d) (* (/ D d) (/ M (/ l h))))))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= 2.2e-196) {
		tmp = w0;
	} else {
		tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h)))))));
	}
	return tmp;
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (m <= 2.2d-196) then
        tmp = w0
    else
        tmp = w0 * (1.0d0 + ((-0.125d0) * (m * ((d / d_1) * ((d / d_1) * (m / (l / h)))))))
    end if
    code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= 2.2e-196) {
		tmp = w0;
	} else {
		tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h)))))));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	tmp = 0
	if M <= 2.2e-196:
		tmp = w0
	else:
		tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h)))))))
	return tmp
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (M <= 2.2e-196)
		tmp = w0;
	else
		tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(M * Float64(Float64(D / d) * Float64(Float64(D / d) * Float64(M / Float64(l / h))))))));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if (M <= 2.2e-196)
		tmp = w0;
	else
		tmp = w0 * (1.0 + (-0.125 * (M * ((D / d) * ((D / d) * (M / (l / h)))))));
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 2.2e-196], w0, N[(w0 * N[(1.0 + N[(-0.125 * N[(M * N[(N[(D / d), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(M / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.2 \cdot 10^{-196}:\\
\;\;\;\;w0\\

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


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

    1. Initial program 81.4%

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

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

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

    if 2.20000000000000015e-196 < M

    1. Initial program 77.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 + -0.125 \cdot \color{blue}{\left(M \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M}{\frac{\ell}{h}}\right)\right)}\right) \cdot w0 \]
      10. associate-*l*72.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 2.2 \cdot 10^{-196}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \left(M \cdot \left(\frac{D}{d} \cdot \left(\frac{D}{d} \cdot \frac{M}{\frac{\ell}{h}}\right)\right)\right)\right)\\ \end{array} \]

Alternative 8: 65.4% accurate, 10.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 7.5 \cdot 10^{+50}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot \left(\left(M \cdot \left(M \cdot \left(w0 \cdot h\right)\right)\right) \cdot \frac{\frac{D}{d}}{d \cdot \frac{\ell}{D}}\right)\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= M 7.5e+50)
   w0
   (* -0.125 (* (* M (* M (* w0 h))) (/ (/ D d) (* d (/ l D)))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= 7.5e+50) {
		tmp = w0;
	} else {
		tmp = -0.125 * ((M * (M * (w0 * h))) * ((D / d) / (d * (l / D))));
	}
	return tmp;
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (m <= 7.5d+50) then
        tmp = w0
    else
        tmp = (-0.125d0) * ((m * (m * (w0 * h))) * ((d / d_1) / (d_1 * (l / d))))
    end if
    code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= 7.5e+50) {
		tmp = w0;
	} else {
		tmp = -0.125 * ((M * (M * (w0 * h))) * ((D / d) / (d * (l / D))));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	tmp = 0
	if M <= 7.5e+50:
		tmp = w0
	else:
		tmp = -0.125 * ((M * (M * (w0 * h))) * ((D / d) / (d * (l / D))))
	return tmp
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (M <= 7.5e+50)
		tmp = w0;
	else
		tmp = Float64(-0.125 * Float64(Float64(M * Float64(M * Float64(w0 * h))) * Float64(Float64(D / d) / Float64(d * Float64(l / D)))));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if (M <= 7.5e+50)
		tmp = w0;
	else
		tmp = -0.125 * ((M * (M * (w0 * h))) * ((D / d) / (d * (l / D))));
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 7.5e+50], w0, N[(-0.125 * N[(N[(M * N[(M * N[(w0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] / N[(d * N[(l / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 82.2%

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

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

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

    if 7.4999999999999999e50 < M

    1. Initial program 70.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.125 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \frac{\left(h \cdot w0\right) \cdot \left(M \cdot M\right)}{\ell}\right)} \]
    9. Taylor expanded in D around 0 31.8%

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

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

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

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

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

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

        \[\leadsto -0.125 \cdot \frac{D \cdot D}{\frac{\ell \cdot \left(d \cdot d\right)}{\color{blue}{\left(h \cdot w0\right) \cdot \left(M \cdot M\right)}}} \]
      7. associate-/r/31.8%

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

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

        \[\leadsto -0.125 \cdot \left(\color{blue}{\left(\left(M \cdot M\right) \cdot \left(h \cdot w0\right)\right)} \cdot \frac{D \cdot D}{\ell \cdot \left(d \cdot d\right)}\right) \]
      10. associate-*l*32.4%

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

        \[\leadsto -0.125 \cdot \left(\left(M \cdot \left(M \cdot \left(h \cdot w0\right)\right)\right) \cdot \color{blue}{\frac{\frac{D \cdot D}{\ell}}{d \cdot d}}\right) \]
      12. associate-/l*34.4%

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

      \[\leadsto -0.125 \cdot \color{blue}{\left(\left(M \cdot \left(M \cdot \left(h \cdot w0\right)\right)\right) \cdot \frac{\frac{D}{\frac{\ell}{D}}}{d \cdot d}\right)} \]
    12. Taylor expanded in D around 0 32.4%

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

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

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

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

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

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

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

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

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

Alternative 9: 65.3% accurate, 10.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 1.1 \cdot 10^{+52}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot \frac{\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(\left(M \cdot M\right) \cdot \left(w0 \cdot h\right)\right)}{\ell}\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= M 1.1e+52)
   w0
   (* -0.125 (/ (* (* (/ D d) (/ D d)) (* (* M M) (* w0 h))) l))))
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= 1.1e+52) {
		tmp = w0;
	} else {
		tmp = -0.125 * ((((D / d) * (D / d)) * ((M * M) * (w0 * h))) / l);
	}
	return tmp;
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if (m <= 1.1d+52) then
        tmp = w0
    else
        tmp = (-0.125d0) * ((((d / d_1) * (d / d_1)) * ((m * m) * (w0 * h))) / l)
    end if
    code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= 1.1e+52) {
		tmp = w0;
	} else {
		tmp = -0.125 * ((((D / d) * (D / d)) * ((M * M) * (w0 * h))) / l);
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	tmp = 0
	if M <= 1.1e+52:
		tmp = w0
	else:
		tmp = -0.125 * ((((D / d) * (D / d)) * ((M * M) * (w0 * h))) / l)
	return tmp
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (M <= 1.1e+52)
		tmp = w0;
	else
		tmp = Float64(-0.125 * Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) * Float64(w0 * h))) / l));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if (M <= 1.1e+52)
		tmp = w0;
	else
		tmp = -0.125 * ((((D / d) * (D / d)) * ((M * M) * (w0 * h))) / l);
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 1.1e+52], w0, N[(-0.125 * N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] * N[(w0 * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 82.2%

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

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

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

    if 1.1e52 < M

    1. Initial program 70.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 67.7% accurate, 216.0× speedup?

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

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

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

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

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

    \[\leadsto w0 \]

Reproduce

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