Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.3% → 87.3%
Time: 14.7s
Alternatives: 11
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 11 alternatives:

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

Initial Program: 81.3% accurate, 1.0× speedup?

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

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

Alternative 1: 87.3% accurate, 0.5× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{1 - {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell}}\\ \mathbf{if}\;t_0 \leq 2 \cdot 10^{+139}:\\ \;\;\;\;w0 \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (let* ((t_0 (sqrt (- 1.0 (* (pow (/ (* D M) (* d 2.0)) 2.0) (/ h l))))))
   (if (<= t_0 2e+139)
     (* w0 t_0)
     (* w0 (sqrt (- 1.0 (* h (/ (pow (* M (* D (/ 0.5 d))) 2.0) l))))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = sqrt((1.0 - (pow(((D * M) / (d * 2.0)), 2.0) * (h / l))));
	double tmp;
	if (t_0 <= 2e+139) {
		tmp = w0 * t_0;
	} else {
		tmp = w0 * sqrt((1.0 - (h * (pow((M * (D * (0.5 / d))), 2.0) / l))));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
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 = sqrt((1.0d0 - ((((d * m) / (d_1 * 2.0d0)) ** 2.0d0) * (h / l))))
    if (t_0 <= 2d+139) then
        tmp = w0 * t_0
    else
        tmp = w0 * sqrt((1.0d0 - (h * (((m * (d * (0.5d0 / d_1))) ** 2.0d0) / l))))
    end if
    code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = Math.sqrt((1.0 - (Math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l))));
	double tmp;
	if (t_0 <= 2e+139) {
		tmp = w0 * t_0;
	} else {
		tmp = w0 * Math.sqrt((1.0 - (h * (Math.pow((M * (D * (0.5 / d))), 2.0) / l))));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	t_0 = math.sqrt((1.0 - (math.pow(((D * M) / (d * 2.0)), 2.0) * (h / l))))
	tmp = 0
	if t_0 <= 2e+139:
		tmp = w0 * t_0
	else:
		tmp = w0 * math.sqrt((1.0 - (h * (math.pow((M * (D * (0.5 / d))), 2.0) / l))))
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	t_0 = sqrt(Float64(1.0 - Float64((Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0) * Float64(h / l))))
	tmp = 0.0
	if (t_0 <= 2e+139)
		tmp = Float64(w0 * t_0);
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0) / l)))));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	t_0 = sqrt((1.0 - ((((D * M) / (d * 2.0)) ^ 2.0) * (h / l))));
	tmp = 0.0;
	if (t_0 <= 2e+139)
		tmp = w0 * t_0;
	else
		tmp = w0 * sqrt((1.0 - (h * (((M * (D * (0.5 / d))) ^ 2.0) / l))));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 2e+139], N[(w0 * t$95$0), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{1 - {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{h}{\ell}}\\
\mathbf{if}\;t_0 \leq 2 \cdot 10^{+139}:\\
\;\;\;\;w0 \cdot t_0\\

\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \frac{{\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 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l)))) < 2.00000000000000007e139

    1. Initial program 99.9%

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

    if 2.00000000000000007e139 < (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2) (/.f64 h l))))

    1. Initial program 46.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. associate-/l*49.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 85.8% accurate, 1.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ w0 \cdot \sqrt{1 + \left(h \cdot {\left(D \cdot \frac{M \cdot 0.5}{d}\right)}^{2}\right) \cdot \frac{-1}{\ell}} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (* w0 (sqrt (+ 1.0 (* (* h (pow (* D (/ (* M 0.5) d)) 2.0)) (/ -1.0 l))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * sqrt((1.0 + ((h * pow((D * ((M * 0.5) / d)), 2.0)) * (-1.0 / l))));
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    code = w0 * sqrt((1.0d0 + ((h * ((d * ((m * 0.5d0) / d_1)) ** 2.0d0)) * ((-1.0d0) / l))))
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * Math.sqrt((1.0 + ((h * Math.pow((D * ((M * 0.5) / d)), 2.0)) * (-1.0 / l))));
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	return w0 * math.sqrt((1.0 + ((h * math.pow((D * ((M * 0.5) / d)), 2.0)) * (-1.0 / l))))
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	return Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(h * (Float64(D * Float64(Float64(M * 0.5) / d)) ^ 2.0)) * Float64(-1.0 / l)))))
end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
	tmp = w0 * sqrt((1.0 + ((h * ((D * ((M * 0.5) / d)) ^ 2.0)) * (-1.0 / l))));
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 + N[(N[(h * N[Power[N[(D * N[(N[(M * 0.5), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 + \left(h \cdot {\left(D \cdot \frac{M \cdot 0.5}{d}\right)}^{2}\right) \cdot \frac{-1}{\ell}}
\end{array}
Derivation
  1. Initial program 83.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. associate-/l*82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 86.0% accurate, 1.0× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (* w0 (sqrt (- 1.0 (* h (/ (pow (* M (* D (/ 0.5 d))) 2.0) l))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * sqrt((1.0 - (h * (pow((M * (D * (0.5 / d))), 2.0) / l))));
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    code = w0 * sqrt((1.0d0 - (h * (((m * (d * (0.5d0 / d_1))) ** 2.0d0) / l))))
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * Math.sqrt((1.0 - (h * (Math.pow((M * (D * (0.5 / d))), 2.0) / l))));
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	return w0 * math.sqrt((1.0 - (h * (math.pow((M * (D * (0.5 / d))), 2.0) / l))))
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	return Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64((Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0) / l)))))
end
M, D = num2cell(sort([M, D])){:}
function tmp = code(w0, M, D, h, l, d)
	tmp = w0 * sqrt((1.0 - (h * (((M * (D * (0.5 / d))) ^ 2.0) / l))));
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
w0 \cdot \sqrt{1 - h \cdot \frac{{\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell}}
\end{array}
Derivation
  1. Initial program 83.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. associate-/l*82.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 72.5% accurate, 1.7× speedup?

\[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;D \cdot M \leq 10^{-148}:\\ \;\;\;\;w0\\ \mathbf{elif}\;D \cdot M \leq 2 \cdot 10^{+119}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d \cdot \left(d \cdot \frac{\ell}{h}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \left(\left(\frac{D}{\ell} \cdot \frac{D}{d \cdot d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}\\ \end{array} \end{array} \]
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (w0 M D h l d)
 :precision binary64
 (if (<= (* D M) 1e-148)
   w0
   (if (<= (* D M) 2e+119)
     (* w0 (+ 1.0 (* -0.125 (/ (* (* D M) (* D M)) (* d (* d (/ l h)))))))
     (*
      w0
      (sqrt (+ 1.0 (* -0.25 (* (* (/ D l) (/ D (* d d))) (* h (* M M))))))))))
assert(M < D);
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((D * M) <= 1e-148) {
		tmp = w0;
	} else if ((D * M) <= 2e+119) {
		tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h))))));
	} else {
		tmp = w0 * sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * M))))));
	}
	return tmp;
}
NOTE: M and D should be sorted in increasing order before calling this function.
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: tmp
    if ((d * m) <= 1d-148) then
        tmp = w0
    else if ((d * m) <= 2d+119) then
        tmp = w0 * (1.0d0 + ((-0.125d0) * (((d * m) * (d * m)) / (d_1 * (d_1 * (l / h))))))
    else
        tmp = w0 * sqrt((1.0d0 + ((-0.25d0) * (((d / l) * (d / (d_1 * d_1))) * (h * (m * m))))))
    end if
    code = tmp
end function
assert M < D;
public static double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if ((D * M) <= 1e-148) {
		tmp = w0;
	} else if ((D * M) <= 2e+119) {
		tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h))))));
	} else {
		tmp = w0 * Math.sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * M))))));
	}
	return tmp;
}
[M, D] = sort([M, D])
def code(w0, M, D, h, l, d):
	tmp = 0
	if (D * M) <= 1e-148:
		tmp = w0
	elif (D * M) <= 2e+119:
		tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h))))))
	else:
		tmp = w0 * math.sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * M))))))
	return tmp
M, D = sort([M, D])
function code(w0, M, D, h, l, d)
	tmp = 0.0
	if (Float64(D * M) <= 1e-148)
		tmp = w0;
	elseif (Float64(D * M) <= 2e+119)
		tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) / Float64(d * Float64(d * Float64(l / h)))))));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(-0.25 * Float64(Float64(Float64(D / l) * Float64(D / Float64(d * d))) * Float64(h * Float64(M * M)))))));
	end
	return tmp
end
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(w0, M, D, h, l, d)
	tmp = 0.0;
	if ((D * M) <= 1e-148)
		tmp = w0;
	elseif ((D * M) <= 2e+119)
		tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h))))));
	else
		tmp = w0 * sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * M))))));
	end
	tmp_2 = tmp;
end
NOTE: M and D should be sorted in increasing order before calling this function.
code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(D * M), $MachinePrecision], 1e-148], w0, If[LessEqual[N[(D * M), $MachinePrecision], 2e+119], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 + N[(-0.25 * N[(N[(N[(D / l), $MachinePrecision] * N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \cdot M \leq 10^{-148}:\\
\;\;\;\;w0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 M D) < 9.99999999999999936e-149

    1. Initial program 87.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. associate-/l*85.4%

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

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

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

    if 9.99999999999999936e-149 < (*.f64 M D) < 1.99999999999999989e119

    1. Initial program 77.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. associate-/l*75.1%

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

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

      \[\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. *-commutative47.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.99999999999999989e119 < (*.f64 M D)

    1. Initial program 68.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 5: 70.7% accurate, 1.7× speedup?

    \[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq 1.1 \cdot 10^{-105}:\\ \;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \frac{D \cdot D}{\frac{\ell}{h} \cdot \left(\frac{d}{M} \cdot \frac{d}{M}\right)}}\\ \mathbf{elif}\;d \leq 1.35 \cdot 10^{+111}:\\ \;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \left(\left(\frac{D}{\ell} \cdot \frac{D}{d \cdot d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
    NOTE: M and D should be sorted in increasing order before calling this function.
    (FPCore (w0 M D h l d)
     :precision binary64
     (if (<= d 1.1e-105)
       (* w0 (sqrt (+ 1.0 (* -0.25 (/ (* D D) (* (/ l h) (* (/ d M) (/ d M))))))))
       (if (<= d 1.35e+111)
         (*
          w0
          (sqrt (+ 1.0 (* -0.25 (* (* (/ D l) (/ D (* d d))) (* h (* M M)))))))
         w0)))
    assert(M < D);
    double code(double w0, double M, double D, double h, double l, double d) {
    	double tmp;
    	if (d <= 1.1e-105) {
    		tmp = w0 * sqrt((1.0 + (-0.25 * ((D * D) / ((l / h) * ((d / M) * (d / M)))))));
    	} else if (d <= 1.35e+111) {
    		tmp = w0 * sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * M))))));
    	} else {
    		tmp = w0;
    	}
    	return tmp;
    }
    
    NOTE: M and D should be sorted in increasing order before calling this function.
    real(8) function code(w0, m, d, h, l, d_1)
        real(8), intent (in) :: w0
        real(8), intent (in) :: m
        real(8), intent (in) :: d
        real(8), intent (in) :: h
        real(8), intent (in) :: l
        real(8), intent (in) :: d_1
        real(8) :: tmp
        if (d_1 <= 1.1d-105) then
            tmp = w0 * sqrt((1.0d0 + ((-0.25d0) * ((d * d) / ((l / h) * ((d_1 / m) * (d_1 / m)))))))
        else if (d_1 <= 1.35d+111) then
            tmp = w0 * sqrt((1.0d0 + ((-0.25d0) * (((d / l) * (d / (d_1 * d_1))) * (h * (m * m))))))
        else
            tmp = w0
        end if
        code = tmp
    end function
    
    assert M < D;
    public static double code(double w0, double M, double D, double h, double l, double d) {
    	double tmp;
    	if (d <= 1.1e-105) {
    		tmp = w0 * Math.sqrt((1.0 + (-0.25 * ((D * D) / ((l / h) * ((d / M) * (d / M)))))));
    	} else if (d <= 1.35e+111) {
    		tmp = w0 * Math.sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * M))))));
    	} else {
    		tmp = w0;
    	}
    	return tmp;
    }
    
    [M, D] = sort([M, D])
    def code(w0, M, D, h, l, d):
    	tmp = 0
    	if d <= 1.1e-105:
    		tmp = w0 * math.sqrt((1.0 + (-0.25 * ((D * D) / ((l / h) * ((d / M) * (d / M)))))))
    	elif d <= 1.35e+111:
    		tmp = w0 * math.sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * M))))))
    	else:
    		tmp = w0
    	return tmp
    
    M, D = sort([M, D])
    function code(w0, M, D, h, l, d)
    	tmp = 0.0
    	if (d <= 1.1e-105)
    		tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(-0.25 * Float64(Float64(D * D) / Float64(Float64(l / h) * Float64(Float64(d / M) * Float64(d / M))))))));
    	elseif (d <= 1.35e+111)
    		tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(-0.25 * Float64(Float64(Float64(D / l) * Float64(D / Float64(d * d))) * Float64(h * Float64(M * M)))))));
    	else
    		tmp = w0;
    	end
    	return tmp
    end
    
    M, D = num2cell(sort([M, D])){:}
    function tmp_2 = code(w0, M, D, h, l, d)
    	tmp = 0.0;
    	if (d <= 1.1e-105)
    		tmp = w0 * sqrt((1.0 + (-0.25 * ((D * D) / ((l / h) * ((d / M) * (d / M)))))));
    	elseif (d <= 1.35e+111)
    		tmp = w0 * sqrt((1.0 + (-0.25 * (((D / l) * (D / (d * d))) * (h * (M * M))))));
    	else
    		tmp = w0;
    	end
    	tmp_2 = tmp;
    end
    
    NOTE: M and D should be sorted in increasing order before calling this function.
    code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[d, 1.1e-105], N[(w0 * N[Sqrt[N[(1.0 + N[(-0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(l / h), $MachinePrecision] * N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.35e+111], N[(w0 * N[Sqrt[N[(1.0 + N[(-0.25 * N[(N[(N[(D / l), $MachinePrecision] * N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]
    
    \begin{array}{l}
    [M, D] = \mathsf{sort}([M, D])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;d \leq 1.1 \cdot 10^{-105}:\\
    \;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \frac{D \cdot D}{\frac{\ell}{h} \cdot \left(\frac{d}{M} \cdot \frac{d}{M}\right)}}\\
    
    \mathbf{elif}\;d \leq 1.35 \cdot 10^{+111}:\\
    \;\;\;\;w0 \cdot \sqrt{1 + -0.25 \cdot \left(\left(\frac{D}{\ell} \cdot \frac{D}{d \cdot d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;w0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if d < 1.10000000000000002e-105

      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. associate-/l*78.4%

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

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

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

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

          \[\leadsto \sqrt{1 + -0.25 \cdot \frac{D \cdot D}{\color{blue}{\frac{\ell \cdot {d}^{2}}{{M}^{2} \cdot h}}}} \cdot w0 \]
        3. Step-by-step derivation
          1. unpow253.7%

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

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

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

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

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

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

        if 1.10000000000000002e-105 < d < 1.3499999999999999e111

        1. Initial program 86.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. associate-/l*83.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 1.3499999999999999e111 < d

          1. Initial program 93.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. associate-/l*93.6%

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

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

            \[\leadsto \color{blue}{w0} \]
        6. Recombined 3 regimes into one program.
        7. Final simplification72.5%

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

        Alternative 6: 72.6% accurate, 7.4× speedup?

        \[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;D \cdot M \leq 10^{-148}:\\ \;\;\;\;w0\\ \mathbf{elif}\;D \cdot M \leq 5 \cdot 10^{+154}:\\ \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d \cdot \left(d \cdot \frac{\ell}{h}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(1 + \left(\left(\frac{D}{\ell} \cdot \frac{D}{d \cdot d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right) \cdot -0.125\right)\\ \end{array} \end{array} \]
        NOTE: M and D should be sorted in increasing order before calling this function.
        (FPCore (w0 M D h l d)
         :precision binary64
         (if (<= (* D M) 1e-148)
           w0
           (if (<= (* D M) 5e+154)
             (* w0 (+ 1.0 (* -0.125 (/ (* (* D M) (* D M)) (* d (* d (/ l h)))))))
             (* w0 (+ 1.0 (* (* (* (/ D l) (/ D (* d d))) (* h (* M M))) -0.125))))))
        assert(M < D);
        double code(double w0, double M, double D, double h, double l, double d) {
        	double tmp;
        	if ((D * M) <= 1e-148) {
        		tmp = w0;
        	} else if ((D * M) <= 5e+154) {
        		tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h))))));
        	} else {
        		tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -0.125));
        	}
        	return tmp;
        }
        
        NOTE: M and D should be sorted in increasing order before calling this function.
        real(8) function code(w0, m, d, h, l, d_1)
            real(8), intent (in) :: w0
            real(8), intent (in) :: m
            real(8), intent (in) :: d
            real(8), intent (in) :: h
            real(8), intent (in) :: l
            real(8), intent (in) :: d_1
            real(8) :: tmp
            if ((d * m) <= 1d-148) then
                tmp = w0
            else if ((d * m) <= 5d+154) then
                tmp = w0 * (1.0d0 + ((-0.125d0) * (((d * m) * (d * m)) / (d_1 * (d_1 * (l / h))))))
            else
                tmp = w0 * (1.0d0 + ((((d / l) * (d / (d_1 * d_1))) * (h * (m * m))) * (-0.125d0)))
            end if
            code = tmp
        end function
        
        assert M < D;
        public static double code(double w0, double M, double D, double h, double l, double d) {
        	double tmp;
        	if ((D * M) <= 1e-148) {
        		tmp = w0;
        	} else if ((D * M) <= 5e+154) {
        		tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h))))));
        	} else {
        		tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -0.125));
        	}
        	return tmp;
        }
        
        [M, D] = sort([M, D])
        def code(w0, M, D, h, l, d):
        	tmp = 0
        	if (D * M) <= 1e-148:
        		tmp = w0
        	elif (D * M) <= 5e+154:
        		tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h))))))
        	else:
        		tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -0.125))
        	return tmp
        
        M, D = sort([M, D])
        function code(w0, M, D, h, l, d)
        	tmp = 0.0
        	if (Float64(D * M) <= 1e-148)
        		tmp = w0;
        	elseif (Float64(D * M) <= 5e+154)
        		tmp = Float64(w0 * Float64(1.0 + Float64(-0.125 * Float64(Float64(Float64(D * M) * Float64(D * M)) / Float64(d * Float64(d * Float64(l / h)))))));
        	else
        		tmp = Float64(w0 * Float64(1.0 + Float64(Float64(Float64(Float64(D / l) * Float64(D / Float64(d * d))) * Float64(h * Float64(M * M))) * -0.125)));
        	end
        	return tmp
        end
        
        M, D = num2cell(sort([M, D])){:}
        function tmp_2 = code(w0, M, D, h, l, d)
        	tmp = 0.0;
        	if ((D * M) <= 1e-148)
        		tmp = w0;
        	elseif ((D * M) <= 5e+154)
        		tmp = w0 * (1.0 + (-0.125 * (((D * M) * (D * M)) / (d * (d * (l / h))))));
        	else
        		tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -0.125));
        	end
        	tmp_2 = tmp;
        end
        
        NOTE: M and D should be sorted in increasing order before calling this function.
        code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(D * M), $MachinePrecision], 1e-148], w0, If[LessEqual[N[(D * M), $MachinePrecision], 5e+154], N[(w0 * N[(1.0 + N[(-0.125 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[(1.0 + N[(N[(N[(N[(D / l), $MachinePrecision] * N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        [M, D] = \mathsf{sort}([M, D])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;D \cdot M \leq 10^{-148}:\\
        \;\;\;\;w0\\
        
        \mathbf{elif}\;D \cdot M \leq 5 \cdot 10^{+154}:\\
        \;\;\;\;w0 \cdot \left(1 + -0.125 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d \cdot \left(d \cdot \frac{\ell}{h}\right)}\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;w0 \cdot \left(1 + \left(\left(\frac{D}{\ell} \cdot \frac{D}{d \cdot d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right) \cdot -0.125\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (*.f64 M D) < 9.99999999999999936e-149

          1. Initial program 87.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. associate-/l*85.4%

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

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

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

          if 9.99999999999999936e-149 < (*.f64 M D) < 5.00000000000000004e154

          1. Initial program 75.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. associate-/l*73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 5.00000000000000004e154 < (*.f64 M D)

          1. Initial program 70.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. associate-/l*77.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 7: 70.2% accurate, 9.4× speedup?

        \[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;M \leq 3.1 \cdot 10^{-111}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(1 + \left(\left(\frac{D}{\ell} \cdot \frac{D}{d \cdot d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right) \cdot -0.125\right)\\ \end{array} \end{array} \]
        NOTE: M and D should be sorted in increasing order before calling this function.
        (FPCore (w0 M D h l d)
         :precision binary64
         (if (<= M 3.1e-111)
           w0
           (* w0 (+ 1.0 (* (* (* (/ D l) (/ D (* d d))) (* h (* M M))) -0.125)))))
        assert(M < D);
        double code(double w0, double M, double D, double h, double l, double d) {
        	double tmp;
        	if (M <= 3.1e-111) {
        		tmp = w0;
        	} else {
        		tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -0.125));
        	}
        	return tmp;
        }
        
        NOTE: M and D should be sorted in increasing order before calling this function.
        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 <= 3.1d-111) then
                tmp = w0
            else
                tmp = w0 * (1.0d0 + ((((d / l) * (d / (d_1 * d_1))) * (h * (m * m))) * (-0.125d0)))
            end if
            code = tmp
        end function
        
        assert M < D;
        public static double code(double w0, double M, double D, double h, double l, double d) {
        	double tmp;
        	if (M <= 3.1e-111) {
        		tmp = w0;
        	} else {
        		tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -0.125));
        	}
        	return tmp;
        }
        
        [M, D] = sort([M, D])
        def code(w0, M, D, h, l, d):
        	tmp = 0
        	if M <= 3.1e-111:
        		tmp = w0
        	else:
        		tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -0.125))
        	return tmp
        
        M, D = sort([M, D])
        function code(w0, M, D, h, l, d)
        	tmp = 0.0
        	if (M <= 3.1e-111)
        		tmp = w0;
        	else
        		tmp = Float64(w0 * Float64(1.0 + Float64(Float64(Float64(Float64(D / l) * Float64(D / Float64(d * d))) * Float64(h * Float64(M * M))) * -0.125)));
        	end
        	return tmp
        end
        
        M, D = num2cell(sort([M, D])){:}
        function tmp_2 = code(w0, M, D, h, l, d)
        	tmp = 0.0;
        	if (M <= 3.1e-111)
        		tmp = w0;
        	else
        		tmp = w0 * (1.0 + ((((D / l) * (D / (d * d))) * (h * (M * M))) * -0.125));
        	end
        	tmp_2 = tmp;
        end
        
        NOTE: M and D should be sorted in increasing order before calling this function.
        code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 3.1e-111], w0, N[(w0 * N[(1.0 + N[(N[(N[(N[(D / l), $MachinePrecision] * N[(D / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        [M, D] = \mathsf{sort}([M, D])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;M \leq 3.1 \cdot 10^{-111}:\\
        \;\;\;\;w0\\
        
        \mathbf{else}:\\
        \;\;\;\;w0 \cdot \left(1 + \left(\left(\frac{D}{\ell} \cdot \frac{D}{d \cdot d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right) \cdot -0.125\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if M < 3.10000000000000014e-111

          1. Initial program 84.9%

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

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

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

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

          if 3.10000000000000014e-111 < M

          1. Initial program 79.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. associate-/l*79.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 8: 68.6% accurate, 9.4× speedup?

        \[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq 6.2 \cdot 10^{-62}:\\ \;\;\;\;w0 \cdot \left(1 + \frac{D \cdot D}{\frac{\ell}{h} \cdot \left(\frac{d}{M} \cdot \frac{d}{M}\right)} \cdot -0.125\right)\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \end{array} \]
        NOTE: M and D should be sorted in increasing order before calling this function.
        (FPCore (w0 M D h l d)
         :precision binary64
         (if (<= d 6.2e-62)
           (* w0 (+ 1.0 (* (/ (* D D) (* (/ l h) (* (/ d M) (/ d M)))) -0.125)))
           w0))
        assert(M < D);
        double code(double w0, double M, double D, double h, double l, double d) {
        	double tmp;
        	if (d <= 6.2e-62) {
        		tmp = w0 * (1.0 + (((D * D) / ((l / h) * ((d / M) * (d / M)))) * -0.125));
        	} else {
        		tmp = w0;
        	}
        	return tmp;
        }
        
        NOTE: M and D should be sorted in increasing order before calling this function.
        real(8) function code(w0, m, d, h, l, d_1)
            real(8), intent (in) :: w0
            real(8), intent (in) :: m
            real(8), intent (in) :: d
            real(8), intent (in) :: h
            real(8), intent (in) :: l
            real(8), intent (in) :: d_1
            real(8) :: tmp
            if (d_1 <= 6.2d-62) then
                tmp = w0 * (1.0d0 + (((d * d) / ((l / h) * ((d_1 / m) * (d_1 / m)))) * (-0.125d0)))
            else
                tmp = w0
            end if
            code = tmp
        end function
        
        assert M < D;
        public static double code(double w0, double M, double D, double h, double l, double d) {
        	double tmp;
        	if (d <= 6.2e-62) {
        		tmp = w0 * (1.0 + (((D * D) / ((l / h) * ((d / M) * (d / M)))) * -0.125));
        	} else {
        		tmp = w0;
        	}
        	return tmp;
        }
        
        [M, D] = sort([M, D])
        def code(w0, M, D, h, l, d):
        	tmp = 0
        	if d <= 6.2e-62:
        		tmp = w0 * (1.0 + (((D * D) / ((l / h) * ((d / M) * (d / M)))) * -0.125))
        	else:
        		tmp = w0
        	return tmp
        
        M, D = sort([M, D])
        function code(w0, M, D, h, l, d)
        	tmp = 0.0
        	if (d <= 6.2e-62)
        		tmp = Float64(w0 * Float64(1.0 + Float64(Float64(Float64(D * D) / Float64(Float64(l / h) * Float64(Float64(d / M) * Float64(d / M)))) * -0.125)));
        	else
        		tmp = w0;
        	end
        	return tmp
        end
        
        M, D = num2cell(sort([M, D])){:}
        function tmp_2 = code(w0, M, D, h, l, d)
        	tmp = 0.0;
        	if (d <= 6.2e-62)
        		tmp = w0 * (1.0 + (((D * D) / ((l / h) * ((d / M) * (d / M)))) * -0.125));
        	else
        		tmp = w0;
        	end
        	tmp_2 = tmp;
        end
        
        NOTE: M and D should be sorted in increasing order before calling this function.
        code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[d, 6.2e-62], N[(w0 * N[(1.0 + N[(N[(N[(D * D), $MachinePrecision] / N[(N[(l / h), $MachinePrecision] * N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], w0]
        
        \begin{array}{l}
        [M, D] = \mathsf{sort}([M, D])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;d \leq 6.2 \cdot 10^{-62}:\\
        \;\;\;\;w0 \cdot \left(1 + \frac{D \cdot D}{\frac{\ell}{h} \cdot \left(\frac{d}{M} \cdot \frac{d}{M}\right)} \cdot -0.125\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;w0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if d < 6.1999999999999999e-62

          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. associate-/l*77.9%

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

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

            \[\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. *-commutative53.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 6.1999999999999999e-62 < d

          1. Initial program 91.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. associate-/l*91.3%

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

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

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

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

        Alternative 9: 69.1% accurate, 10.3× speedup?

        \[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;M \leq 1.35 \cdot 10^{+40}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \frac{w0 \cdot \left(h \cdot \left(M \cdot M\right)\right)}{d \cdot d}\right)\\ \end{array} \end{array} \]
        NOTE: M and D should be sorted in increasing order before calling this function.
        (FPCore (w0 M D h l d)
         :precision binary64
         (if (<= M 1.35e+40)
           w0
           (* -0.125 (* (* D (/ D l)) (/ (* w0 (* h (* M M))) (* d d))))))
        assert(M < D);
        double code(double w0, double M, double D, double h, double l, double d) {
        	double tmp;
        	if (M <= 1.35e+40) {
        		tmp = w0;
        	} else {
        		tmp = -0.125 * ((D * (D / l)) * ((w0 * (h * (M * M))) / (d * d)));
        	}
        	return tmp;
        }
        
        NOTE: M and D should be sorted in increasing order before calling this function.
        real(8) function code(w0, m, d, h, l, d_1)
            real(8), intent (in) :: w0
            real(8), intent (in) :: m
            real(8), intent (in) :: d
            real(8), intent (in) :: h
            real(8), intent (in) :: l
            real(8), intent (in) :: d_1
            real(8) :: tmp
            if (m <= 1.35d+40) then
                tmp = w0
            else
                tmp = (-0.125d0) * ((d * (d / l)) * ((w0 * (h * (m * m))) / (d_1 * d_1)))
            end if
            code = tmp
        end function
        
        assert M < D;
        public static double code(double w0, double M, double D, double h, double l, double d) {
        	double tmp;
        	if (M <= 1.35e+40) {
        		tmp = w0;
        	} else {
        		tmp = -0.125 * ((D * (D / l)) * ((w0 * (h * (M * M))) / (d * d)));
        	}
        	return tmp;
        }
        
        [M, D] = sort([M, D])
        def code(w0, M, D, h, l, d):
        	tmp = 0
        	if M <= 1.35e+40:
        		tmp = w0
        	else:
        		tmp = -0.125 * ((D * (D / l)) * ((w0 * (h * (M * M))) / (d * d)))
        	return tmp
        
        M, D = sort([M, D])
        function code(w0, M, D, h, l, d)
        	tmp = 0.0
        	if (M <= 1.35e+40)
        		tmp = w0;
        	else
        		tmp = Float64(-0.125 * Float64(Float64(D * Float64(D / l)) * Float64(Float64(w0 * Float64(h * Float64(M * M))) / Float64(d * d))));
        	end
        	return tmp
        end
        
        M, D = num2cell(sort([M, D])){:}
        function tmp_2 = code(w0, M, D, h, l, d)
        	tmp = 0.0;
        	if (M <= 1.35e+40)
        		tmp = w0;
        	else
        		tmp = -0.125 * ((D * (D / l)) * ((w0 * (h * (M * M))) / (d * d)));
        	end
        	tmp_2 = tmp;
        end
        
        NOTE: M and D should be sorted in increasing order before calling this function.
        code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 1.35e+40], w0, N[(-0.125 * N[(N[(D * N[(D / l), $MachinePrecision]), $MachinePrecision] * N[(N[(w0 * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        [M, D] = \mathsf{sort}([M, D])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;M \leq 1.35 \cdot 10^{+40}:\\
        \;\;\;\;w0\\
        
        \mathbf{else}:\\
        \;\;\;\;-0.125 \cdot \left(\left(D \cdot \frac{D}{\ell}\right) \cdot \frac{w0 \cdot \left(h \cdot \left(M \cdot M\right)\right)}{d \cdot d}\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if M < 1.35000000000000005e40

          1. Initial program 84.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. associate-/l*83.0%

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

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

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

          if 1.35000000000000005e40 < M

          1. Initial program 78.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. associate-/l*77.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 10: 69.2% accurate, 10.3× speedup?

        \[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;M \leq 7.5 \cdot 10^{+17}:\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\ell} \cdot \left(\frac{w0}{d} \cdot \frac{h \cdot M}{\frac{d}{M}}\right)\right)\\ \end{array} \end{array} \]
        NOTE: M and D should be sorted in increasing order before calling this function.
        (FPCore (w0 M D h l d)
         :precision binary64
         (if (<= M 7.5e+17)
           w0
           (* -0.125 (* (/ (* D D) l) (* (/ w0 d) (/ (* h M) (/ d M)))))))
        assert(M < D);
        double code(double w0, double M, double D, double h, double l, double d) {
        	double tmp;
        	if (M <= 7.5e+17) {
        		tmp = w0;
        	} else {
        		tmp = -0.125 * (((D * D) / l) * ((w0 / d) * ((h * M) / (d / M))));
        	}
        	return tmp;
        }
        
        NOTE: M and D should be sorted in increasing order before calling this function.
        real(8) function code(w0, m, d, h, l, d_1)
            real(8), intent (in) :: w0
            real(8), intent (in) :: m
            real(8), intent (in) :: d
            real(8), intent (in) :: h
            real(8), intent (in) :: l
            real(8), intent (in) :: d_1
            real(8) :: tmp
            if (m <= 7.5d+17) then
                tmp = w0
            else
                tmp = (-0.125d0) * (((d * d) / l) * ((w0 / d_1) * ((h * m) / (d_1 / m))))
            end if
            code = tmp
        end function
        
        assert M < D;
        public static double code(double w0, double M, double D, double h, double l, double d) {
        	double tmp;
        	if (M <= 7.5e+17) {
        		tmp = w0;
        	} else {
        		tmp = -0.125 * (((D * D) / l) * ((w0 / d) * ((h * M) / (d / M))));
        	}
        	return tmp;
        }
        
        [M, D] = sort([M, D])
        def code(w0, M, D, h, l, d):
        	tmp = 0
        	if M <= 7.5e+17:
        		tmp = w0
        	else:
        		tmp = -0.125 * (((D * D) / l) * ((w0 / d) * ((h * M) / (d / M))))
        	return tmp
        
        M, D = sort([M, D])
        function code(w0, M, D, h, l, d)
        	tmp = 0.0
        	if (M <= 7.5e+17)
        		tmp = w0;
        	else
        		tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) / l) * Float64(Float64(w0 / d) * Float64(Float64(h * M) / Float64(d / M)))));
        	end
        	return tmp
        end
        
        M, D = num2cell(sort([M, D])){:}
        function tmp_2 = code(w0, M, D, h, l, d)
        	tmp = 0.0;
        	if (M <= 7.5e+17)
        		tmp = w0;
        	else
        		tmp = -0.125 * (((D * D) / l) * ((w0 / d) * ((h * M) / (d / M))));
        	end
        	tmp_2 = tmp;
        end
        
        NOTE: M and D should be sorted in increasing order before calling this function.
        code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[M, 7.5e+17], w0, N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] / l), $MachinePrecision] * N[(N[(w0 / d), $MachinePrecision] * N[(N[(h * M), $MachinePrecision] / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        [M, D] = \mathsf{sort}([M, D])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;M \leq 7.5 \cdot 10^{+17}:\\
        \;\;\;\;w0\\
        
        \mathbf{else}:\\
        \;\;\;\;-0.125 \cdot \left(\frac{D \cdot D}{\ell} \cdot \left(\frac{w0}{d} \cdot \frac{h \cdot M}{\frac{d}{M}}\right)\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if M < 7.5e17

          1. Initial program 85.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. associate-/l*84.0%

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

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

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

          if 7.5e17 < M

          1. Initial program 74.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. associate-/l*74.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 11: 68.1% accurate, 216.0× speedup?

        \[\begin{array}{l} [M, D] = \mathsf{sort}([M, D])\\ \\ w0 \end{array} \]
        NOTE: M and D should be sorted in increasing order before calling this function.
        (FPCore (w0 M D h l d) :precision binary64 w0)
        assert(M < D);
        double code(double w0, double M, double D, double h, double l, double d) {
        	return w0;
        }
        
        NOTE: M and D should be sorted in increasing order before calling this function.
        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
        
        assert M < D;
        public static double code(double w0, double M, double D, double h, double l, double d) {
        	return w0;
        }
        
        [M, D] = sort([M, D])
        def code(w0, M, D, h, l, d):
        	return w0
        
        M, D = sort([M, D])
        function code(w0, M, D, h, l, d)
        	return w0
        end
        
        M, D = num2cell(sort([M, D])){:}
        function tmp = code(w0, M, D, h, l, d)
        	tmp = w0;
        end
        
        NOTE: M and D should be sorted in increasing order before calling this function.
        code[w0_, M_, D_, h_, l_, d_] := w0
        
        \begin{array}{l}
        [M, D] = \mathsf{sort}([M, D])\\
        \\
        w0
        \end{array}
        
        Derivation
        1. Initial program 83.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. associate-/l*82.1%

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

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

          \[\leadsto \color{blue}{w0} \]
        5. Final simplification68.2%

          \[\leadsto w0 \]

        Reproduce

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