Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.5% → 87.4%
Time: 14.3s
Alternatives: 13
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 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.5% accurate, 1.0× speedup?

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

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

Alternative 1: 87.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\ \mathbf{if}\;t_0 \leq 10^{+283}:\\ \;\;\;\;w0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(h \cdot {\left(0.5 \cdot \frac{M}{\frac{d}{D}}\right)}^{2}\right) \cdot \frac{-1}{\ell}}\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (let* ((t_0 (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)))))
   (if (<= t_0 1e+283)
     (* w0 (sqrt t_0))
     (*
      w0
      (sqrt (+ 1.0 (* (* h (pow (* 0.5 (/ M (/ d D))) 2.0)) (/ -1.0 l))))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = 1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l));
	double tmp;
	if (t_0 <= 1e+283) {
		tmp = w0 * sqrt(t_0);
	} else {
		tmp = w0 * sqrt((1.0 + ((h * pow((0.5 * (M / (d / D))), 2.0)) * (-1.0 / 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 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))
    if (t_0 <= 1d+283) then
        tmp = w0 * sqrt(t_0)
    else
        tmp = w0 * sqrt((1.0d0 + ((h * ((0.5d0 * (m / (d_1 / d))) ** 2.0d0)) * ((-1.0d0) / 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(((M * D) / (2.0 * d)), 2.0) * (h / l));
	double tmp;
	if (t_0 <= 1e+283) {
		tmp = w0 * Math.sqrt(t_0);
	} else {
		tmp = w0 * Math.sqrt((1.0 + ((h * Math.pow((0.5 * (M / (d / D))), 2.0)) * (-1.0 / l))));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	t_0 = 1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))
	tmp = 0
	if t_0 <= 1e+283:
		tmp = w0 * math.sqrt(t_0)
	else:
		tmp = w0 * math.sqrt((1.0 + ((h * math.pow((0.5 * (M / (d / D))), 2.0)) * (-1.0 / l))))
	return tmp
function code(w0, M, D, h, l, d)
	t_0 = Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))
	tmp = 0.0
	if (t_0 <= 1e+283)
		tmp = Float64(w0 * sqrt(t_0));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(h * (Float64(0.5 * Float64(M / Float64(d / D))) ^ 2.0)) * Float64(-1.0 / l)))));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	t_0 = 1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l));
	tmp = 0.0;
	if (t_0 <= 1e+283)
		tmp = w0 * sqrt(t_0);
	else
		tmp = w0 * sqrt((1.0 + ((h * ((0.5 * (M / (d / D))) ^ 2.0)) * (-1.0 / 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[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+283], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(h * N[Power[N[(0.5 * N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


\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))) < 9.99999999999999955e282

    1. Initial program 99.9%

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

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

    1. Initial program 38.1%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac40.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 86.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\ \mathbf{if}\;t_0 \leq \infty:\\ \;\;\;\;w0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(1 + \frac{D \cdot \left(\frac{D}{d} \cdot \left(M \cdot \left(h \cdot \frac{M}{d}\right)\right)\right)}{\ell} \cdot -0.125\right)\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (let* ((t_0 (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)))))
   (if (<= t_0 INFINITY)
     (* w0 (sqrt t_0))
     (* w0 (+ 1.0 (* (/ (* D (* (/ D d) (* M (* h (/ M d))))) l) -0.125))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = 1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l));
	double tmp;
	if (t_0 <= ((double) INFINITY)) {
		tmp = w0 * sqrt(t_0);
	} else {
		tmp = w0 * (1.0 + (((D * ((D / d) * (M * (h * (M / d))))) / l) * -0.125));
	}
	return tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = 1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l));
	double tmp;
	if (t_0 <= Double.POSITIVE_INFINITY) {
		tmp = w0 * Math.sqrt(t_0);
	} else {
		tmp = w0 * (1.0 + (((D * ((D / d) * (M * (h * (M / d))))) / l) * -0.125));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	t_0 = 1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))
	tmp = 0
	if t_0 <= math.inf:
		tmp = w0 * math.sqrt(t_0)
	else:
		tmp = w0 * (1.0 + (((D * ((D / d) * (M * (h * (M / d))))) / l) * -0.125))
	return tmp
function code(w0, M, D, h, l, d)
	t_0 = Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))
	tmp = 0.0
	if (t_0 <= Inf)
		tmp = Float64(w0 * sqrt(t_0));
	else
		tmp = Float64(w0 * Float64(1.0 + Float64(Float64(Float64(D * Float64(Float64(D / d) * Float64(M * Float64(h * Float64(M / d))))) / l) * -0.125)));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	t_0 = 1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l));
	tmp = 0.0;
	if (t_0 <= Inf)
		tmp = w0 * sqrt(t_0);
	else
		tmp = w0 * (1.0 + (((D * ((D / d) * (M * (h * (M / d))))) / l) * -0.125));
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, Infinity], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[(1.0 + N[(N[(N[(D * N[(N[(D / d), $MachinePrecision] * N[(M * N[(h * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;w0 \cdot \left(1 + \frac{D \cdot \left(\frac{D}{d} \cdot \left(M \cdot \left(h \cdot \frac{M}{d}\right)\right)\right)}{\ell} \cdot -0.125\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))) < +inf.0

    1. Initial program 89.3%

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

    if +inf.0 < (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)))

    1. Initial program 0.0%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac4.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 87.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\ \mathbf{if}\;t_0 \leq 10^{+283}:\\ \;\;\;\;w0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot \left(0.25 \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)}{\ell}}\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (let* ((t_0 (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)))))
   (if (<= t_0 1e+283)
     (* w0 (sqrt t_0))
     (* w0 (sqrt (- 1.0 (/ (* h (* 0.25 (pow (* D (/ M d)) 2.0))) l)))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = 1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l));
	double tmp;
	if (t_0 <= 1e+283) {
		tmp = w0 * sqrt(t_0);
	} else {
		tmp = w0 * sqrt((1.0 - ((h * (0.25 * pow((D * (M / d)), 2.0))) / 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 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))
    if (t_0 <= 1d+283) then
        tmp = w0 * sqrt(t_0)
    else
        tmp = w0 * sqrt((1.0d0 - ((h * (0.25d0 * ((d * (m / d_1)) ** 2.0d0))) / 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(((M * D) / (2.0 * d)), 2.0) * (h / l));
	double tmp;
	if (t_0 <= 1e+283) {
		tmp = w0 * Math.sqrt(t_0);
	} else {
		tmp = w0 * Math.sqrt((1.0 - ((h * (0.25 * Math.pow((D * (M / d)), 2.0))) / l)));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	t_0 = 1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))
	tmp = 0
	if t_0 <= 1e+283:
		tmp = w0 * math.sqrt(t_0)
	else:
		tmp = w0 * math.sqrt((1.0 - ((h * (0.25 * math.pow((D * (M / d)), 2.0))) / l)))
	return tmp
function code(w0, M, D, h, l, d)
	t_0 = Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))
	tmp = 0.0
	if (t_0 <= 1e+283)
		tmp = Float64(w0 * sqrt(t_0));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * Float64(0.25 * (Float64(D * Float64(M / d)) ^ 2.0))) / l))));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	t_0 = 1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l));
	tmp = 0.0;
	if (t_0 <= 1e+283)
		tmp = w0 * sqrt(t_0);
	else
		tmp = w0 * sqrt((1.0 - ((h * (0.25 * ((D * (M / d)) ^ 2.0))) / 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[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+283], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[(0.25 * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


\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))) < 9.99999999999999955e282

    1. Initial program 99.9%

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

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

    1. Initial program 38.1%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac40.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 87.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\ \mathbf{if}\;t_0 \leq 10^{+283}:\\ \;\;\;\;w0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h \cdot {\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}}\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (let* ((t_0 (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l)))))
   (if (<= t_0 1e+283)
     (* w0 (sqrt t_0))
     (* w0 (sqrt (- 1.0 (/ (* h (pow (* M (* D (/ 0.5 d))) 2.0)) l)))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = 1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l));
	double tmp;
	if (t_0 <= 1e+283) {
		tmp = w0 * sqrt(t_0);
	} else {
		tmp = w0 * sqrt((1.0 - ((h * pow((M * (D * (0.5 / d))), 2.0)) / 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 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))
    if (t_0 <= 1d+283) then
        tmp = w0 * sqrt(t_0)
    else
        tmp = w0 * sqrt((1.0d0 - ((h * ((m * (d * (0.5d0 / d_1))) ** 2.0d0)) / 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(((M * D) / (2.0 * d)), 2.0) * (h / l));
	double tmp;
	if (t_0 <= 1e+283) {
		tmp = w0 * Math.sqrt(t_0);
	} else {
		tmp = w0 * Math.sqrt((1.0 - ((h * Math.pow((M * (D * (0.5 / d))), 2.0)) / l)));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	t_0 = 1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))
	tmp = 0
	if t_0 <= 1e+283:
		tmp = w0 * math.sqrt(t_0)
	else:
		tmp = w0 * math.sqrt((1.0 - ((h * math.pow((M * (D * (0.5 / d))), 2.0)) / l)))
	return tmp
function code(w0, M, D, h, l, d)
	t_0 = Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))
	tmp = 0.0
	if (t_0 <= 1e+283)
		tmp = Float64(w0 * sqrt(t_0));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h * (Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0)) / l))));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	t_0 = 1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l));
	tmp = 0.0;
	if (t_0 <= 1e+283)
		tmp = w0 * sqrt(t_0);
	else
		tmp = w0 * sqrt((1.0 - ((h * ((M * (D * (0.5 / d))) ^ 2.0)) / 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[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+283], N[(w0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h * N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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


\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))) < 9.99999999999999955e282

    1. Initial program 99.9%

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

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

    1. Initial program 38.1%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac40.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 86.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\ \;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot \left(M \cdot h\right)}{\ell}\right)}\\ \mathbf{elif}\;\frac{h}{\ell} \leq -1 \cdot 10^{-270}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= (/ h l) (- INFINITY))
   (* w0 (sqrt (- 1.0 (* 0.25 (* (* (/ D d) (/ D d)) (/ (* M (* M h)) l))))))
   (if (<= (/ h l) -1e-270)
     (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0)))))
     w0)))
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((h / l) <= -((double) INFINITY)) {
		tmp = w0 * sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * ((M * (M * h)) / l)))));
	} else if ((h / l) <= -1e-270) {
		tmp = w0 * sqrt((1.0 - ((h / l) * pow(((D / d) * (M / 2.0)), 2.0))));
	} else {
		tmp = w0;
	}
	return tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((h / l) <= -Double.POSITIVE_INFINITY) {
		tmp = w0 * Math.sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * ((M * (M * h)) / l)))));
	} else if ((h / l) <= -1e-270) {
		tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0))));
	} else {
		tmp = w0;
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	tmp = 0
	if (h / l) <= -math.inf:
		tmp = w0 * math.sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * ((M * (M * h)) / l)))))
	elif (h / l) <= -1e-270:
		tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0))))
	else:
		tmp = w0
	return tmp
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (Float64(h / l) <= Float64(-Inf))
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * Float64(M * h)) / l))))));
	elseif (Float64(h / l) <= -1e-270)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)))));
	else
		tmp = w0;
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if ((h / l) <= -Inf)
		tmp = w0 * sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * ((M * (M * h)) / l)))));
	elseif ((h / l) <= -1e-270)
		tmp = w0 * sqrt((1.0 - ((h / l) * (((D / d) * (M / 2.0)) ^ 2.0))));
	else
		tmp = w0;
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], (-Infinity)], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(M * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -1e-270], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 h l) < -inf.0

    1. Initial program 40.4%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac40.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (/.f64 h l) < -1e-270

    1. Initial program 85.1%

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

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

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

    if -1e-270 < (/.f64 h l)

    1. Initial program 85.6%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac85.6%

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

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

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

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

Alternative 6: 84.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \leq -\infty:\\ \;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot \left(M \cdot h\right)}{\ell}\right)}\\ \mathbf{elif}\;\frac{h}{\ell} \leq -1 \cdot 10^{-308}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(1 + \frac{D \cdot \left(\frac{D}{d} \cdot \left(M \cdot \left(h \cdot \frac{M}{d}\right)\right)\right)}{\ell} \cdot -0.125\right)\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= (/ h l) (- INFINITY))
   (* w0 (sqrt (- 1.0 (* 0.25 (* (* (/ D d) (/ D d)) (/ (* M (* M h)) l))))))
   (if (<= (/ h l) -1e-308)
     (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ M d) (/ D 2.0)) 2.0)))))
     (* w0 (+ 1.0 (* (/ (* D (* (/ D d) (* M (* h (/ M d))))) l) -0.125))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((h / l) <= -((double) INFINITY)) {
		tmp = w0 * sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * ((M * (M * h)) / l)))));
	} else if ((h / l) <= -1e-308) {
		tmp = w0 * sqrt((1.0 - ((h / l) * pow(((M / d) * (D / 2.0)), 2.0))));
	} else {
		tmp = w0 * (1.0 + (((D * ((D / d) * (M * (h * (M / d))))) / l) * -0.125));
	}
	return tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((h / l) <= -Double.POSITIVE_INFINITY) {
		tmp = w0 * Math.sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * ((M * (M * h)) / l)))));
	} else if ((h / l) <= -1e-308) {
		tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((M / d) * (D / 2.0)), 2.0))));
	} else {
		tmp = w0 * (1.0 + (((D * ((D / d) * (M * (h * (M / d))))) / l) * -0.125));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	tmp = 0
	if (h / l) <= -math.inf:
		tmp = w0 * math.sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * ((M * (M * h)) / l)))))
	elif (h / l) <= -1e-308:
		tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((M / d) * (D / 2.0)), 2.0))))
	else:
		tmp = w0 * (1.0 + (((D * ((D / d) * (M * (h * (M / d))))) / l) * -0.125))
	return tmp
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (Float64(h / l) <= Float64(-Inf))
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * Float64(M * h)) / l))))));
	elseif (Float64(h / l) <= -1e-308)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0)))));
	else
		tmp = Float64(w0 * Float64(1.0 + Float64(Float64(Float64(D * Float64(Float64(D / d) * Float64(M * Float64(h * Float64(M / d))))) / l) * -0.125)));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if ((h / l) <= -Inf)
		tmp = w0 * sqrt((1.0 - (0.25 * (((D / d) * (D / d)) * ((M * (M * h)) / l)))));
	elseif ((h / l) <= -1e-308)
		tmp = w0 * sqrt((1.0 - ((h / l) * (((M / d) * (D / 2.0)) ^ 2.0))));
	else
		tmp = w0 * (1.0 + (((D * ((D / d) * (M * (h * (M / d))))) / l) * -0.125));
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(h / l), $MachinePrecision], (-Infinity)], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * N[(M * h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(h / l), $MachinePrecision], -1e-308], 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], N[(w0 * N[(1.0 + N[(N[(N[(D * N[(N[(D / d), $MachinePrecision] * N[(M * N[(h * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 h l) < -inf.0

    1. Initial program 40.4%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac40.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -inf.0 < (/.f64 h l) < -9.9999999999999991e-309

    1. Initial program 85.5%

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

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

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

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

    if -9.9999999999999991e-309 < (/.f64 h l)

    1. Initial program 85.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 78.3% accurate, 1.8× speedup?

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

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

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


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

    1. Initial program 80.7%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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) \]
    8. Step-by-step derivation
      1. times-frac61.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) \]
      2. unpow261.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) \]
      3. unpow261.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) \]
      4. times-frac69.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000002e-84 < M

    1. Initial program 82.7%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac82.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 81.1% accurate, 1.9× speedup?

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

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

    \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
  2. Step-by-step derivation
    1. times-frac81.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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) \]
    2. unpow256.0%

      \[\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) \]
    3. unpow256.0%

      \[\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) \]
    4. times-frac65.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 73.2% accurate, 9.4× speedup?

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

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

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


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

    1. Initial program 80.6%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac80.6%

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

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

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

    if 8.9999999999999998e-128 < M

    1. Initial program 82.5%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac82.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 72.6% accurate, 9.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 2.5 \cdot 10^{-201}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(1 + \frac{D \cdot \left(\frac{D}{d} \cdot \left(M \cdot \left(h \cdot \frac{M}{d}\right)\right)\right)}{\ell} \cdot -0.125\right)\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= M 2.5e-201)
   w0
   (* w0 (+ 1.0 (* (/ (* D (* (/ D d) (* M (* h (/ M d))))) l) -0.125)))))
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (M <= 2.5e-201) {
		tmp = w0;
	} else {
		tmp = w0 * (1.0 + (((D * ((D / d) * (M * (h * (M / d))))) / l) * -0.125));
	}
	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.5d-201) then
        tmp = w0
    else
        tmp = w0 * (1.0d0 + (((d * ((d / d_1) * (m * (h * (m / d_1))))) / l) * (-0.125d0)))
    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.5e-201) {
		tmp = w0;
	} else {
		tmp = w0 * (1.0 + (((D * ((D / d) * (M * (h * (M / d))))) / l) * -0.125));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	tmp = 0
	if M <= 2.5e-201:
		tmp = w0
	else:
		tmp = w0 * (1.0 + (((D * ((D / d) * (M * (h * (M / d))))) / l) * -0.125))
	return tmp
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (M <= 2.5e-201)
		tmp = w0;
	else
		tmp = Float64(w0 * Float64(1.0 + Float64(Float64(Float64(D * Float64(Float64(D / d) * Float64(M * Float64(h * Float64(M / d))))) / l) * -0.125)));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if (M <= 2.5e-201)
		tmp = w0;
	else
		tmp = w0 * (1.0 + (((D * ((D / d) * (M * (h * (M / d))))) / l) * -0.125));
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 2.5e-201], w0, N[(w0 * N[(1.0 + N[(N[(N[(D * N[(N[(D / d), $MachinePrecision] * N[(M * N[(h * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 80.4%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac80.4%

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

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

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

    if 2.5e-201 < M

    1. Initial program 82.6%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac82.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 65.7% accurate, 10.3× speedup?

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

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

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


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

    1. Initial program 81.6%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac81.6%

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

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

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

    if 3e74 < M

    1. Initial program 79.6%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 65.5% accurate, 10.3× speedup?

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

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

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


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

    1. Initial program 81.6%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac81.6%

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

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

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

    if 3e74 < M

    1. Initial program 79.6%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. times-frac79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 68.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 81.3%

    \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
  2. Step-by-step derivation
    1. times-frac81.4%

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

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

    \[\leadsto \color{blue}{w0} \]
  5. Final simplification69.1%

    \[\leadsto w0 \]

Reproduce

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