Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 80.7% → 88.2%
Time: 19.1s
Alternatives: 12
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 12 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: 80.7% 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: 88.2% accurate, 0.7× speedup?

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

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


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

    1. Initial program 99.9%

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

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

    1. Initial program 44.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 86.8% accurate, 1.0× speedup?

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

      1. Initial program 88.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. clear-num88.1%

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

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

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

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

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

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

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

          \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{{\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}}{\ell} \cdot h}} \]
        2. *-commutative90.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. *-commutative90.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}} \]
        4. associate-*r*91.5%

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

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

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

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

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

      if 2.00000000000000003e-155 < M

      1. Initial program 69.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 75.4% accurate, 1.8× speedup?

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

        1. Initial program 79.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 4.49999999999999997e36 < d

          1. Initial program 85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 4: 75.2% accurate, 1.8× speedup?

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

          1. Initial program 79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if 3.15000000000000003e40 < d

            1. Initial program 85.1%

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

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

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

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

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

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

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

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

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

            Alternative 5: 77.5% accurate, 1.8× speedup?

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

              1. Initial program 81.1%

                \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
              2. Taylor expanded in w0 around 0 53.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} \]
              3. Step-by-step derivation
                1. Simplified50.8%

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

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

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

                    \[\leadsto w0 \cdot \left(1 + -0.125 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\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}}{d \cdot d} \cdot \frac{{M}^{2} \cdot h}{\ell}\right)}\right) \]
                  4. unpow250.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if 4.20000000000000019e-100 < d

                1. Initial program 81.2%

                  \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
                2. Taylor expanded in w0 around 0 60.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} \]
                3. Step-by-step derivation
                  1. Simplified61.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 6: 78.7% accurate, 1.8× speedup?

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

                  1. Initial program 83.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    if 5.99999999999999992e-131 < d

                    1. Initial program 78.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 7: 75.5% accurate, 1.8× speedup?

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

                      1. Initial program 79.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      if 8.40000000000000018e36 < d

                      1. Initial program 85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 8: 72.6% accurate, 9.4× speedup?

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

                      1. Initial program 80.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      if 4.49999999999999996e57 < d

                      1. Initial program 83.8%

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

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

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

                    Alternative 9: 71.2% accurate, 9.4× speedup?

                    \[\begin{array}{l} D = |D|\\ [M, D] = \mathsf{sort}([M, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq 6.7 \cdot 10^{+36}:\\ \;\;\;\;w0 \cdot \left(1 + \left(h \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)\right)\right) \cdot -0.125\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left(1 + \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right) \cdot -0.125\right)\\ \end{array} \end{array} \]
                    NOTE: D should be positive before calling this function
                    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.7e+36)
                       (* w0 (+ 1.0 (* (* h (* (/ D (/ l D)) (* (/ M d) (/ M d)))) -0.125)))
                       (* w0 (+ 1.0 (* (* (* (/ D d) (/ D d)) (/ (* h (* M M)) l)) -0.125)))))
                    D = abs(D);
                    assert(M < D);
                    double code(double w0, double M, double D, double h, double l, double d) {
                    	double tmp;
                    	if (d <= 6.7e+36) {
                    		tmp = w0 * (1.0 + ((h * ((D / (l / D)) * ((M / d) * (M / d)))) * -0.125));
                    	} else {
                    		tmp = w0 * (1.0 + ((((D / d) * (D / d)) * ((h * (M * M)) / l)) * -0.125));
                    	}
                    	return tmp;
                    }
                    
                    NOTE: D should be positive before calling this function
                    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.7d+36) then
                            tmp = w0 * (1.0d0 + ((h * ((d / (l / d)) * ((m / d_1) * (m / d_1)))) * (-0.125d0)))
                        else
                            tmp = w0 * (1.0d0 + ((((d / d_1) * (d / d_1)) * ((h * (m * m)) / l)) * (-0.125d0)))
                        end if
                        code = tmp
                    end function
                    
                    D = Math.abs(D);
                    assert M < D;
                    public static double code(double w0, double M, double D, double h, double l, double d) {
                    	double tmp;
                    	if (d <= 6.7e+36) {
                    		tmp = w0 * (1.0 + ((h * ((D / (l / D)) * ((M / d) * (M / d)))) * -0.125));
                    	} else {
                    		tmp = w0 * (1.0 + ((((D / d) * (D / d)) * ((h * (M * M)) / l)) * -0.125));
                    	}
                    	return tmp;
                    }
                    
                    D = abs(D)
                    [M, D] = sort([M, D])
                    def code(w0, M, D, h, l, d):
                    	tmp = 0
                    	if d <= 6.7e+36:
                    		tmp = w0 * (1.0 + ((h * ((D / (l / D)) * ((M / d) * (M / d)))) * -0.125))
                    	else:
                    		tmp = w0 * (1.0 + ((((D / d) * (D / d)) * ((h * (M * M)) / l)) * -0.125))
                    	return tmp
                    
                    D = abs(D)
                    M, D = sort([M, D])
                    function code(w0, M, D, h, l, d)
                    	tmp = 0.0
                    	if (d <= 6.7e+36)
                    		tmp = Float64(w0 * Float64(1.0 + Float64(Float64(h * Float64(Float64(D / Float64(l / D)) * Float64(Float64(M / d) * Float64(M / d)))) * -0.125)));
                    	else
                    		tmp = Float64(w0 * Float64(1.0 + Float64(Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(h * Float64(M * M)) / l)) * -0.125)));
                    	end
                    	return tmp
                    end
                    
                    D = abs(D)
                    M, D = num2cell(sort([M, D])){:}
                    function tmp_2 = code(w0, M, D, h, l, d)
                    	tmp = 0.0;
                    	if (d <= 6.7e+36)
                    		tmp = w0 * (1.0 + ((h * ((D / (l / D)) * ((M / d) * (M / d)))) * -0.125));
                    	else
                    		tmp = w0 * (1.0 + ((((D / d) * (D / d)) * ((h * (M * M)) / l)) * -0.125));
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    NOTE: D should be positive before calling this function
                    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.7e+36], N[(w0 * N[(1.0 + N[(N[(h * N[(N[(D / N[(l / D), $MachinePrecision]), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[(1.0 + N[(N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                    
                    \begin{array}{l}
                    D = |D|\\
                    [M, D] = \mathsf{sort}([M, D])\\
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;d \leq 6.7 \cdot 10^{+36}:\\
                    \;\;\;\;w0 \cdot \left(1 + \left(h \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{M}{d} \cdot \frac{M}{d}\right)\right)\right) \cdot -0.125\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;w0 \cdot \left(1 + \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{h \cdot \left(M \cdot M\right)}{\ell}\right) \cdot -0.125\right)\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if d < 6.6999999999999997e36

                      1. Initial program 79.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      if 6.6999999999999997e36 < d

                      1. Initial program 85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 10: 72.1% accurate, 9.4× speedup?

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

                      1. Initial program 79.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      if 5.4000000000000002e36 < d

                      1. Initial program 85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 11: 69.5% accurate, 10.3× speedup?

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

                      1. Initial program 86.7%

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

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

                      if 1.36e-4 < M

                      1. Initial program 62.5%

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

                        \[\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)} \]
                      3. Step-by-step derivation
                        1. associate-/l*43.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 12: 67.5% accurate, 216.0× speedup?

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

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

                      \[\leadsto \color{blue}{w0} \]
                    3. Final simplification67.6%

                      \[\leadsto w0 \]

                    Reproduce

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