Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 82.2% → 88.8%
Time: 17.8s
Alternatives: 22
Speedup: 1.9×

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 22 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: 82.2% 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.8% accurate, 0.7× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d}\\ \mathbf{if}\;{t\_0}^{2} \cdot \frac{h}{\ell} \leq 5 \cdot 10^{-10}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0, \frac{h}{\ell} \cdot \frac{M\_m \cdot D\_m}{d \cdot -2}, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \frac{\frac{D\_m}{d} \cdot \left(\left(M\_m \cdot M\_m\right) \cdot 0.25\right)}{\ell} \cdot \frac{\frac{D\_m}{d}}{\frac{-1}{h}}}\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
 :precision binary64
 (let* ((t_0 (/ (* M_m D_m) (* 2.0 d))))
   (if (<= (* (pow t_0 2.0) (/ h l)) 5e-10)
     (* w0 (sqrt (fma t_0 (* (/ h l) (/ (* M_m D_m) (* d -2.0))) 1.0)))
     (*
      w0
      (sqrt
       (+
        1.0
        (*
         (/ (* (/ D_m d) (* (* M_m M_m) 0.25)) l)
         (/ (/ D_m d) (/ -1.0 h)))))))))
D_m = fabs(D);
M_m = fabs(M);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
	double t_0 = (M_m * D_m) / (2.0 * d);
	double tmp;
	if ((pow(t_0, 2.0) * (h / l)) <= 5e-10) {
		tmp = w0 * sqrt(fma(t_0, ((h / l) * ((M_m * D_m) / (d * -2.0))), 1.0));
	} else {
		tmp = w0 * sqrt((1.0 + ((((D_m / d) * ((M_m * M_m) * 0.25)) / l) * ((D_m / d) / (-1.0 / h)))));
	}
	return tmp;
}
D_m = abs(D)
M_m = abs(M)
w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
function code(w0, M_m, D_m, h, l, d)
	t_0 = Float64(Float64(M_m * D_m) / Float64(2.0 * d))
	tmp = 0.0
	if (Float64((t_0 ^ 2.0) * Float64(h / l)) <= 5e-10)
		tmp = Float64(w0 * sqrt(fma(t_0, Float64(Float64(h / l) * Float64(Float64(M_m * D_m) / Float64(d * -2.0))), 1.0)));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(Float64(Float64(D_m / d) * Float64(Float64(M_m * M_m) * 0.25)) / l) * Float64(Float64(D_m / d) / Float64(-1.0 / h))))));
	end
	return tmp
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], 5e-10], N[(w0 * N[Sqrt[N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(N[(N[(D$95$m / d), $MachinePrecision] * N[(N[(M$95$m * M$95$m), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] / N[(-1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d}\\
\mathbf{if}\;{t\_0}^{2} \cdot \frac{h}{\ell} \leq 5 \cdot 10^{-10}:\\
\;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0, \frac{h}{\ell} \cdot \frac{M\_m \cdot D\_m}{d \cdot -2}, 1\right)}\\

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


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

    1. Initial program 87.2%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

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

        \[\leadsto w0 \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
      3. +-commutativeN/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) + 1}} \]
      4. lift-*.f64N/A

        \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\right)\right) + 1} \]
      5. distribute-lft-neg-inN/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)\right) \cdot \frac{h}{\ell}} + 1} \]
      6. lift-pow.f64N/A

        \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
      7. unpow2N/A

        \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
      8. distribute-rgt-neg-inN/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right)\right)} \cdot \frac{h}{\ell} + 1} \]
      9. associate-*l*N/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}\right)} + 1} \]
      10. lower-fma.f64N/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}, 1\right)}} \]
    4. Applied rewrites88.0%

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

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

    1. Initial program 0.0%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\frac{\ell}{h}}}} \]
      5. lift-pow.f64N/A

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}} \]
      7. lift-/.f64N/A

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \color{blue}{\frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}} \]
      8. lift-*.f64N/A

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{\color{blue}{M \cdot D}}{2 \cdot d}}{\frac{\ell}{h}}} \]
      9. lift-*.f64N/A

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{\color{blue}{2 \cdot d}}}{\frac{\ell}{h}}} \]
      10. times-fracN/A

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

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M}{2}\right) \cdot \frac{D}{d}}}{\frac{\ell}{h}}} \]
      12. div-invN/A

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M}{2}\right) \cdot \frac{D}{d}}{\color{blue}{\ell \cdot \frac{1}{h}}}} \]
      13. times-fracN/A

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M}{2}}{\ell} \cdot \frac{\frac{D}{d}}{\frac{1}{h}}}} \]
      14. lower-*.f64N/A

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M}{2}}{\ell} \cdot \frac{\frac{D}{d}}{\frac{1}{h}}}} \]
    4. Applied rewrites67.6%

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

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

Alternative 2: 81.9% accurate, 0.4× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} t_0 := {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\frac{\frac{\left(-0.125 \cdot \left(D\_m \cdot D\_m\right)\right) \cdot \left(h \cdot \frac{M\_m \cdot \left(M\_m \cdot w0\right)}{\ell}\right)}{d}}{d}\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+54}:\\ \;\;\;\;w0 \cdot \sqrt{\frac{\left(D\_m \cdot -0.25\right) \cdot \left(M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot h\right)\right)\right)}{\ell \cdot \left(d \cdot d\right)}}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
(FPCore (w0 M_m D_m h l d)
 :precision binary64
 (let* ((t_0 (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l))))
   (if (<= t_0 (- INFINITY))
     (/ (/ (* (* -0.125 (* D_m D_m)) (* h (/ (* M_m (* M_m w0)) l))) d) d)
     (if (<= t_0 -1e+54)
       (*
        w0
        (sqrt (/ (* (* D_m -0.25) (* M_m (* D_m (* M_m h)))) (* l (* d d)))))
       (* w0 1.0)))))
D_m = fabs(D);
M_m = fabs(M);
assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
double code(double w0, double M_m, double D_m, double h, double l, double d) {
	double t_0 = pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l);
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = (((-0.125 * (D_m * D_m)) * (h * ((M_m * (M_m * w0)) / l))) / d) / d;
	} else if (t_0 <= -1e+54) {
		tmp = w0 * sqrt((((D_m * -0.25) * (M_m * (D_m * (M_m * h)))) / (l * (d * d))));
	} else {
		tmp = w0 * 1.0;
	}
	return tmp;
}
D_m = Math.abs(D);
M_m = Math.abs(M);
assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
	double t_0 = Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l);
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = (((-0.125 * (D_m * D_m)) * (h * ((M_m * (M_m * w0)) / l))) / d) / d;
	} else if (t_0 <= -1e+54) {
		tmp = w0 * Math.sqrt((((D_m * -0.25) * (M_m * (D_m * (M_m * h)))) / (l * (d * d))));
	} else {
		tmp = w0 * 1.0;
	}
	return tmp;
}
D_m = math.fabs(D)
M_m = math.fabs(M)
[w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d])
def code(w0, M_m, D_m, h, l, d):
	t_0 = math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)
	tmp = 0
	if t_0 <= -math.inf:
		tmp = (((-0.125 * (D_m * D_m)) * (h * ((M_m * (M_m * w0)) / l))) / d) / d
	elif t_0 <= -1e+54:
		tmp = w0 * math.sqrt((((D_m * -0.25) * (M_m * (D_m * (M_m * h)))) / (l * (d * d))))
	else:
		tmp = w0 * 1.0
	return tmp
D_m = abs(D)
M_m = abs(M)
w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
function code(w0, M_m, D_m, h, l, d)
	t_0 = Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(Float64(Float64(Float64(-0.125 * Float64(D_m * D_m)) * Float64(h * Float64(Float64(M_m * Float64(M_m * w0)) / l))) / d) / d);
	elseif (t_0 <= -1e+54)
		tmp = Float64(w0 * sqrt(Float64(Float64(Float64(D_m * -0.25) * Float64(M_m * Float64(D_m * Float64(M_m * h)))) / Float64(l * Float64(d * d)))));
	else
		tmp = Float64(w0 * 1.0);
	end
	return tmp
end
D_m = abs(D);
M_m = abs(M);
w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
function tmp_2 = code(w0, M_m, D_m, h, l, d)
	t_0 = (((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l);
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = (((-0.125 * (D_m * D_m)) * (h * ((M_m * (M_m * w0)) / l))) / d) / d;
	elseif (t_0 <= -1e+54)
		tmp = w0 * sqrt((((D_m * -0.25) * (M_m * (D_m * (M_m * h)))) / (l * (d * d))));
	else
		tmp = w0 * 1.0;
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M$95$m * N[(M$95$m * w0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[t$95$0, -1e+54], N[(w0 * N[Sqrt[N[(N[(N[(D$95$m * -0.25), $MachinePrecision] * N[(M$95$m * N[(D$95$m * N[(M$95$m * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\frac{\frac{\left(-0.125 \cdot \left(D\_m \cdot D\_m\right)\right) \cdot \left(h \cdot \frac{M\_m \cdot \left(M\_m \cdot w0\right)}{\ell}\right)}{d}}{d}\\

\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+54}:\\
\;\;\;\;w0 \cdot \sqrt{\frac{\left(D\_m \cdot -0.25\right) \cdot \left(M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot h\right)\right)\right)}{\ell \cdot \left(d \cdot d\right)}}\\

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


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

    1. Initial program 57.8%

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

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

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

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

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

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

        \[\leadsto {D}^{2} \cdot \color{blue}{\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}\right)} + w0 \]
      6. lower-fma.f64N/A

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

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

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

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

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

        if -inf.0 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -1.0000000000000001e54

        1. Initial program 99.1%

          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
        2. Add Preprocessing
        3. Taylor expanded in M around inf

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

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

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

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

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

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

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

            \[\leadsto w0 \cdot \sqrt{\frac{\left(\frac{-1}{4} \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}} \]
          8. lower-*.f64N/A

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

            \[\leadsto w0 \cdot \sqrt{\frac{\left(\frac{-1}{4} \cdot \left(D \cdot D\right)\right) \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)}{{d}^{2} \cdot \ell}} \]
          10. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{\frac{\left(\frac{-1}{4} \cdot \left(D \cdot D\right)\right) \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)}{{d}^{2} \cdot \ell}} \]
          11. lower-*.f64N/A

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

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

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

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

            \[\leadsto w0 \cdot \sqrt{\frac{-0.25}{d \cdot d} \cdot \color{blue}{\frac{D \cdot \left(D \cdot \left(M \cdot \left(M \cdot h\right)\right)\right)}{\ell}}} \]
          2. Step-by-step derivation
            1. lift-*.f64N/A

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

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

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

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

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

          1. Initial program 89.4%

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

            \[\leadsto w0 \cdot \color{blue}{1} \]
          4. Step-by-step derivation
            1. Applied rewrites94.9%

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

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

          Alternative 3: 89.0% accurate, 0.7× speedup?

          \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d}\\ \mathbf{if}\;{t\_0}^{2} \cdot \frac{h}{\ell} \leq 5 \cdot 10^{-10}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0, \frac{h}{\ell} \cdot \frac{M\_m \cdot D\_m}{d \cdot -2}, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot \left(M\_m \cdot \left(M\_m \cdot \left(D\_m \cdot \frac{-0.25}{d \cdot \ell}\right)\right)\right), \frac{D\_m}{d}, 1\right)}\\ \end{array} \end{array} \]
          D_m = (fabs.f64 D)
          M_m = (fabs.f64 M)
          NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
          (FPCore (w0 M_m D_m h l d)
           :precision binary64
           (let* ((t_0 (/ (* M_m D_m) (* 2.0 d))))
             (if (<= (* (pow t_0 2.0) (/ h l)) 5e-10)
               (* w0 (sqrt (fma t_0 (* (/ h l) (/ (* M_m D_m) (* d -2.0))) 1.0)))
               (*
                w0
                (sqrt
                 (fma (* h (* M_m (* M_m (* D_m (/ -0.25 (* d l)))))) (/ D_m d) 1.0))))))
          D_m = fabs(D);
          M_m = fabs(M);
          assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
          double code(double w0, double M_m, double D_m, double h, double l, double d) {
          	double t_0 = (M_m * D_m) / (2.0 * d);
          	double tmp;
          	if ((pow(t_0, 2.0) * (h / l)) <= 5e-10) {
          		tmp = w0 * sqrt(fma(t_0, ((h / l) * ((M_m * D_m) / (d * -2.0))), 1.0));
          	} else {
          		tmp = w0 * sqrt(fma((h * (M_m * (M_m * (D_m * (-0.25 / (d * l)))))), (D_m / d), 1.0));
          	}
          	return tmp;
          }
          
          D_m = abs(D)
          M_m = abs(M)
          w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
          function code(w0, M_m, D_m, h, l, d)
          	t_0 = Float64(Float64(M_m * D_m) / Float64(2.0 * d))
          	tmp = 0.0
          	if (Float64((t_0 ^ 2.0) * Float64(h / l)) <= 5e-10)
          		tmp = Float64(w0 * sqrt(fma(t_0, Float64(Float64(h / l) * Float64(Float64(M_m * D_m) / Float64(d * -2.0))), 1.0)));
          	else
          		tmp = Float64(w0 * sqrt(fma(Float64(h * Float64(M_m * Float64(M_m * Float64(D_m * Float64(-0.25 / Float64(d * l)))))), Float64(D_m / d), 1.0)));
          	end
          	return tmp
          end
          
          D_m = N[Abs[D], $MachinePrecision]
          M_m = N[Abs[M], $MachinePrecision]
          NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
          code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], 5e-10], N[(w0 * N[Sqrt[N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(h * N[(M$95$m * N[(M$95$m * N[(D$95$m * N[(-0.25 / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
          
          \begin{array}{l}
          D_m = \left|D\right|
          \\
          M_m = \left|M\right|
          \\
          [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
          \\
          \begin{array}{l}
          t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d}\\
          \mathbf{if}\;{t\_0}^{2} \cdot \frac{h}{\ell} \leq 5 \cdot 10^{-10}:\\
          \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0, \frac{h}{\ell} \cdot \frac{M\_m \cdot D\_m}{d \cdot -2}, 1\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot \left(M\_m \cdot \left(M\_m \cdot \left(D\_m \cdot \frac{-0.25}{d \cdot \ell}\right)\right)\right), \frac{D\_m}{d}, 1\right)}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < 5.00000000000000031e-10

            1. Initial program 87.2%

              \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift--.f64N/A

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

                \[\leadsto w0 \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
              3. +-commutativeN/A

                \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) + 1}} \]
              4. lift-*.f64N/A

                \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\right)\right) + 1} \]
              5. distribute-lft-neg-inN/A

                \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)\right) \cdot \frac{h}{\ell}} + 1} \]
              6. lift-pow.f64N/A

                \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
              7. unpow2N/A

                \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
              8. distribute-rgt-neg-inN/A

                \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right)\right)} \cdot \frac{h}{\ell} + 1} \]
              9. associate-*l*N/A

                \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}\right)} + 1} \]
              10. lower-fma.f64N/A

                \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}, 1\right)}} \]
            4. Applied rewrites88.0%

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

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

            1. Initial program 0.0%

              \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-*.f64N/A

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

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

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

                \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\frac{\ell}{h}}}} \]
              5. lift-pow.f64N/A

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

                \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}} \]
              7. lift-/.f64N/A

                \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}}{\frac{\ell}{h}}} \]
              8. lift-/.f64N/A

                \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \color{blue}{\frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}} \]
              9. lift-*.f64N/A

                \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{\color{blue}{2 \cdot d}}}{\frac{\ell}{h}}} \]
              10. associate-/r*N/A

                \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \color{blue}{\frac{\frac{M \cdot D}{2}}{d}}}{\frac{\ell}{h}}} \]
              11. frac-timesN/A

                \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{\left(M \cdot D\right) \cdot \frac{M \cdot D}{2}}{\left(2 \cdot d\right) \cdot d}}}{\frac{\ell}{h}}} \]
              12. *-commutativeN/A

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

                \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M \cdot D}{2} \cdot \left(M \cdot D\right)}{\frac{\ell}{h} \cdot \left(\left(2 \cdot d\right) \cdot d\right)}}} \]
              14. lower-/.f64N/A

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

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

              \[\leadsto w0 \cdot \sqrt{\color{blue}{{M}^{2} \cdot \left(\frac{1}{{M}^{2}} - \frac{1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right)}} \]
            6. Step-by-step derivation
              1. cancel-sign-sub-invN/A

                \[\leadsto w0 \cdot \sqrt{{M}^{2} \cdot \color{blue}{\left(\frac{1}{{M}^{2}} + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right)}} \]
              2. metadata-evalN/A

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

                \[\leadsto w0 \cdot \sqrt{{M}^{2} \cdot \color{blue}{\left(\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}} \]
              4. distribute-lft-inN/A

                \[\leadsto w0 \cdot \sqrt{\color{blue}{{M}^{2} \cdot \left(\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) + {M}^{2} \cdot \frac{1}{{M}^{2}}}} \]
              5. rgt-mult-inverseN/A

                \[\leadsto w0 \cdot \sqrt{{M}^{2} \cdot \left(\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) + \color{blue}{1}} \]
              6. lower-fma.f64N/A

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

              \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(M \cdot M, \frac{-0.25 \cdot \left(D \cdot \left(D \cdot h\right)\right)}{\ell \cdot \left(d \cdot d\right)}, 1\right)}} \]
            8. Step-by-step derivation
              1. Applied rewrites62.1%

                \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(M \cdot M, \frac{D \cdot -0.25}{\ell \cdot d} \cdot \color{blue}{\frac{h \cdot D}{d}}, 1\right)} \]
              2. Step-by-step derivation
                1. Applied rewrites78.4%

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

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

              Alternative 4: 88.0% accurate, 0.7× speedup?

              \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} t_0 := M\_m \cdot \frac{D\_m}{d}\\ \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 5 \cdot 10^{-10}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0 \cdot -0.5, \frac{h}{\ell} \cdot \left(0.5 \cdot t\_0\right), 1\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot \left(M\_m \cdot \left(M\_m \cdot \left(D\_m \cdot \frac{-0.25}{d \cdot \ell}\right)\right)\right), \frac{D\_m}{d}, 1\right)}\\ \end{array} \end{array} \]
              D_m = (fabs.f64 D)
              M_m = (fabs.f64 M)
              NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
              (FPCore (w0 M_m D_m h l d)
               :precision binary64
               (let* ((t_0 (* M_m (/ D_m d))))
                 (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) 5e-10)
                   (* w0 (sqrt (fma (* t_0 -0.5) (* (/ h l) (* 0.5 t_0)) 1.0)))
                   (*
                    w0
                    (sqrt
                     (fma (* h (* M_m (* M_m (* D_m (/ -0.25 (* d l)))))) (/ D_m d) 1.0))))))
              D_m = fabs(D);
              M_m = fabs(M);
              assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
              double code(double w0, double M_m, double D_m, double h, double l, double d) {
              	double t_0 = M_m * (D_m / d);
              	double tmp;
              	if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= 5e-10) {
              		tmp = w0 * sqrt(fma((t_0 * -0.5), ((h / l) * (0.5 * t_0)), 1.0));
              	} else {
              		tmp = w0 * sqrt(fma((h * (M_m * (M_m * (D_m * (-0.25 / (d * l)))))), (D_m / d), 1.0));
              	}
              	return tmp;
              }
              
              D_m = abs(D)
              M_m = abs(M)
              w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
              function code(w0, M_m, D_m, h, l, d)
              	t_0 = Float64(M_m * Float64(D_m / d))
              	tmp = 0.0
              	if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= 5e-10)
              		tmp = Float64(w0 * sqrt(fma(Float64(t_0 * -0.5), Float64(Float64(h / l) * Float64(0.5 * t_0)), 1.0)));
              	else
              		tmp = Float64(w0 * sqrt(fma(Float64(h * Float64(M_m * Float64(M_m * Float64(D_m * Float64(-0.25 / Float64(d * l)))))), Float64(D_m / d), 1.0)));
              	end
              	return tmp
              end
              
              D_m = N[Abs[D], $MachinePrecision]
              M_m = N[Abs[M], $MachinePrecision]
              NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
              code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(M$95$m * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], 5e-10], N[(w0 * N[Sqrt[N[(N[(t$95$0 * -0.5), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(h * N[(M$95$m * N[(M$95$m * N[(D$95$m * N[(-0.25 / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
              
              \begin{array}{l}
              D_m = \left|D\right|
              \\
              M_m = \left|M\right|
              \\
              [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
              \\
              \begin{array}{l}
              t_0 := M\_m \cdot \frac{D\_m}{d}\\
              \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq 5 \cdot 10^{-10}:\\
              \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0 \cdot -0.5, \frac{h}{\ell} \cdot \left(0.5 \cdot t\_0\right), 1\right)}\\
              
              \mathbf{else}:\\
              \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot \left(M\_m \cdot \left(M\_m \cdot \left(D\_m \cdot \frac{-0.25}{d \cdot \ell}\right)\right)\right), \frac{D\_m}{d}, 1\right)}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < 5.00000000000000031e-10

                1. Initial program 87.2%

                  \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift--.f64N/A

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

                    \[\leadsto w0 \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
                  3. +-commutativeN/A

                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) + 1}} \]
                  4. lift-*.f64N/A

                    \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\right)\right) + 1} \]
                  5. distribute-lft-neg-inN/A

                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)\right) \cdot \frac{h}{\ell}} + 1} \]
                  6. lift-pow.f64N/A

                    \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
                  7. unpow2N/A

                    \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
                  8. distribute-rgt-neg-inN/A

                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right)\right)} \cdot \frac{h}{\ell} + 1} \]
                  9. associate-*l*N/A

                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}\right)} + 1} \]
                  10. lower-fma.f64N/A

                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}, 1\right)}} \]
                4. Applied rewrites88.0%

                  \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \frac{M \cdot D}{d \cdot -2} \cdot \frac{h}{\ell}, 1\right)}} \]
                5. Step-by-step derivation
                  1. lift-fma.f64N/A

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

                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\frac{M \cdot D}{d \cdot -2} \cdot \frac{h}{\ell}\right) \cdot \frac{M \cdot D}{2 \cdot d}} + 1} \]
                  3. lift-*.f64N/A

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

                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{M \cdot D}{d \cdot -2} \cdot \left(\frac{h}{\ell} \cdot \frac{M \cdot D}{2 \cdot d}\right)} + 1} \]
                  5. lower-fma.f64N/A

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

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

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

                1. Initial program 0.0%

                  \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-*.f64N/A

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

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

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

                    \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\frac{\ell}{h}}}} \]
                  5. lift-pow.f64N/A

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

                    \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}} \]
                  7. lift-/.f64N/A

                    \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}}{\frac{\ell}{h}}} \]
                  8. lift-/.f64N/A

                    \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \color{blue}{\frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}} \]
                  9. lift-*.f64N/A

                    \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{\color{blue}{2 \cdot d}}}{\frac{\ell}{h}}} \]
                  10. associate-/r*N/A

                    \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \color{blue}{\frac{\frac{M \cdot D}{2}}{d}}}{\frac{\ell}{h}}} \]
                  11. frac-timesN/A

                    \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{\left(M \cdot D\right) \cdot \frac{M \cdot D}{2}}{\left(2 \cdot d\right) \cdot d}}}{\frac{\ell}{h}}} \]
                  12. *-commutativeN/A

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

                    \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M \cdot D}{2} \cdot \left(M \cdot D\right)}{\frac{\ell}{h} \cdot \left(\left(2 \cdot d\right) \cdot d\right)}}} \]
                  14. lower-/.f64N/A

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

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

                  \[\leadsto w0 \cdot \sqrt{\color{blue}{{M}^{2} \cdot \left(\frac{1}{{M}^{2}} - \frac{1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right)}} \]
                6. Step-by-step derivation
                  1. cancel-sign-sub-invN/A

                    \[\leadsto w0 \cdot \sqrt{{M}^{2} \cdot \color{blue}{\left(\frac{1}{{M}^{2}} + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right)}} \]
                  2. metadata-evalN/A

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

                    \[\leadsto w0 \cdot \sqrt{{M}^{2} \cdot \color{blue}{\left(\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}} \]
                  4. distribute-lft-inN/A

                    \[\leadsto w0 \cdot \sqrt{\color{blue}{{M}^{2} \cdot \left(\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) + {M}^{2} \cdot \frac{1}{{M}^{2}}}} \]
                  5. rgt-mult-inverseN/A

                    \[\leadsto w0 \cdot \sqrt{{M}^{2} \cdot \left(\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) + \color{blue}{1}} \]
                  6. lower-fma.f64N/A

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

                  \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(M \cdot M, \frac{-0.25 \cdot \left(D \cdot \left(D \cdot h\right)\right)}{\ell \cdot \left(d \cdot d\right)}, 1\right)}} \]
                8. Step-by-step derivation
                  1. Applied rewrites62.1%

                    \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(M \cdot M, \frac{D \cdot -0.25}{\ell \cdot d} \cdot \color{blue}{\frac{h \cdot D}{d}}, 1\right)} \]
                  2. Step-by-step derivation
                    1. Applied rewrites78.4%

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

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

                  Alternative 5: 87.1% accurate, 0.7× speedup?

                  \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d}\\ \mathbf{if}\;{t\_0}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{-11}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0, \left(M\_m \cdot D\_m\right) \cdot \frac{h}{-2 \cdot \left(d \cdot \ell\right)}, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
                  D_m = (fabs.f64 D)
                  M_m = (fabs.f64 M)
                  NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                  (FPCore (w0 M_m D_m h l d)
                   :precision binary64
                   (let* ((t_0 (/ (* M_m D_m) (* 2.0 d))))
                     (if (<= (* (pow t_0 2.0) (/ h l)) -4e-11)
                       (* w0 (sqrt (fma t_0 (* (* M_m D_m) (/ h (* -2.0 (* d l)))) 1.0)))
                       (* w0 1.0))))
                  D_m = fabs(D);
                  M_m = fabs(M);
                  assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                  double code(double w0, double M_m, double D_m, double h, double l, double d) {
                  	double t_0 = (M_m * D_m) / (2.0 * d);
                  	double tmp;
                  	if ((pow(t_0, 2.0) * (h / l)) <= -4e-11) {
                  		tmp = w0 * sqrt(fma(t_0, ((M_m * D_m) * (h / (-2.0 * (d * l)))), 1.0));
                  	} else {
                  		tmp = w0 * 1.0;
                  	}
                  	return tmp;
                  }
                  
                  D_m = abs(D)
                  M_m = abs(M)
                  w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                  function code(w0, M_m, D_m, h, l, d)
                  	t_0 = Float64(Float64(M_m * D_m) / Float64(2.0 * d))
                  	tmp = 0.0
                  	if (Float64((t_0 ^ 2.0) * Float64(h / l)) <= -4e-11)
                  		tmp = Float64(w0 * sqrt(fma(t_0, Float64(Float64(M_m * D_m) * Float64(h / Float64(-2.0 * Float64(d * l)))), 1.0)));
                  	else
                  		tmp = Float64(w0 * 1.0);
                  	end
                  	return tmp
                  end
                  
                  D_m = N[Abs[D], $MachinePrecision]
                  M_m = N[Abs[M], $MachinePrecision]
                  NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                  code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := Block[{t$95$0 = N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -4e-11], N[(w0 * N[Sqrt[N[(t$95$0 * N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(h / N[(-2.0 * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]]
                  
                  \begin{array}{l}
                  D_m = \left|D\right|
                  \\
                  M_m = \left|M\right|
                  \\
                  [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                  \\
                  \begin{array}{l}
                  t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d}\\
                  \mathbf{if}\;{t\_0}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{-11}:\\
                  \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(t\_0, \left(M\_m \cdot D\_m\right) \cdot \frac{h}{-2 \cdot \left(d \cdot \ell\right)}, 1\right)}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;w0 \cdot 1\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -3.99999999999999976e-11

                    1. Initial program 67.5%

                      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. lift--.f64N/A

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

                        \[\leadsto w0 \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
                      3. +-commutativeN/A

                        \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) + 1}} \]
                      4. lift-*.f64N/A

                        \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\right)\right) + 1} \]
                      5. distribute-lft-neg-inN/A

                        \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)\right) \cdot \frac{h}{\ell}} + 1} \]
                      6. lift-pow.f64N/A

                        \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
                      7. unpow2N/A

                        \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
                      8. distribute-rgt-neg-inN/A

                        \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right)\right)} \cdot \frac{h}{\ell} + 1} \]
                      9. associate-*l*N/A

                        \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}\right)} + 1} \]
                      10. lower-fma.f64N/A

                        \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}, 1\right)}} \]
                    4. Applied rewrites69.5%

                      \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \frac{M \cdot D}{d \cdot -2} \cdot \frac{h}{\ell}, 1\right)}} \]
                    5. Step-by-step derivation
                      1. lift-*.f64N/A

                        \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \color{blue}{\frac{M \cdot D}{d \cdot -2} \cdot \frac{h}{\ell}}, 1\right)} \]
                      2. lift-/.f64N/A

                        \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \color{blue}{\frac{M \cdot D}{d \cdot -2}} \cdot \frac{h}{\ell}, 1\right)} \]
                      3. lift-/.f64N/A

                        \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \frac{M \cdot D}{d \cdot -2} \cdot \color{blue}{\frac{h}{\ell}}, 1\right)} \]
                      4. frac-timesN/A

                        \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \color{blue}{\frac{\left(M \cdot D\right) \cdot h}{\left(d \cdot -2\right) \cdot \ell}}, 1\right)} \]
                      5. associate-/l*N/A

                        \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \color{blue}{\left(M \cdot D\right) \cdot \frac{h}{\left(d \cdot -2\right) \cdot \ell}}, 1\right)} \]
                      6. lower-*.f64N/A

                        \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \color{blue}{\left(M \cdot D\right) \cdot \frac{h}{\left(d \cdot -2\right) \cdot \ell}}, 1\right)} \]
                      7. lower-/.f64N/A

                        \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(M \cdot D\right) \cdot \color{blue}{\frac{h}{\left(d \cdot -2\right) \cdot \ell}}, 1\right)} \]
                      8. lift-*.f64N/A

                        \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(M \cdot D\right) \cdot \frac{h}{\color{blue}{\left(d \cdot -2\right)} \cdot \ell}, 1\right)} \]
                      9. *-commutativeN/A

                        \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(M \cdot D\right) \cdot \frac{h}{\color{blue}{\left(-2 \cdot d\right)} \cdot \ell}, 1\right)} \]
                      10. associate-*l*N/A

                        \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(M \cdot D\right) \cdot \frac{h}{\color{blue}{-2 \cdot \left(d \cdot \ell\right)}}, 1\right)} \]
                      11. lower-*.f64N/A

                        \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(M \cdot D\right) \cdot \frac{h}{\color{blue}{-2 \cdot \left(d \cdot \ell\right)}}, 1\right)} \]
                      12. lower-*.f6462.2

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

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

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

                    1. Initial program 88.9%

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

                      \[\leadsto w0 \cdot \color{blue}{1} \]
                    4. Step-by-step derivation
                      1. Applied rewrites98.1%

                        \[\leadsto w0 \cdot \color{blue}{1} \]
                    5. Recombined 2 regimes into one program.
                    6. Add Preprocessing

                    Alternative 6: 85.5% accurate, 0.7× speedup?

                    \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{-11}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M\_m \cdot D\_m}{d \cdot \left(2 \cdot \left(\ell \cdot \left(d \cdot -2\right)\right)\right)}, \left(M\_m \cdot D\_m\right) \cdot h, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
                    D_m = (fabs.f64 D)
                    M_m = (fabs.f64 M)
                    NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                    (FPCore (w0 M_m D_m h l d)
                     :precision binary64
                     (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -4e-11)
                       (*
                        w0
                        (sqrt
                         (fma
                          (/ (* M_m D_m) (* d (* 2.0 (* l (* d -2.0)))))
                          (* (* M_m D_m) h)
                          1.0)))
                       (* w0 1.0)))
                    D_m = fabs(D);
                    M_m = fabs(M);
                    assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                    double code(double w0, double M_m, double D_m, double h, double l, double d) {
                    	double tmp;
                    	if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e-11) {
                    		tmp = w0 * sqrt(fma(((M_m * D_m) / (d * (2.0 * (l * (d * -2.0))))), ((M_m * D_m) * h), 1.0));
                    	} else {
                    		tmp = w0 * 1.0;
                    	}
                    	return tmp;
                    }
                    
                    D_m = abs(D)
                    M_m = abs(M)
                    w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                    function code(w0, M_m, D_m, h, l, d)
                    	tmp = 0.0
                    	if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -4e-11)
                    		tmp = Float64(w0 * sqrt(fma(Float64(Float64(M_m * D_m) / Float64(d * Float64(2.0 * Float64(l * Float64(d * -2.0))))), Float64(Float64(M_m * D_m) * h), 1.0)));
                    	else
                    		tmp = Float64(w0 * 1.0);
                    	end
                    	return tmp
                    end
                    
                    D_m = N[Abs[D], $MachinePrecision]
                    M_m = N[Abs[M], $MachinePrecision]
                    NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                    code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -4e-11], N[(w0 * N[Sqrt[N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * N[(2.0 * N[(l * N[(d * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m * D$95$m), $MachinePrecision] * h), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
                    
                    \begin{array}{l}
                    D_m = \left|D\right|
                    \\
                    M_m = \left|M\right|
                    \\
                    [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{-11}:\\
                    \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M\_m \cdot D\_m}{d \cdot \left(2 \cdot \left(\ell \cdot \left(d \cdot -2\right)\right)\right)}, \left(M\_m \cdot D\_m\right) \cdot h, 1\right)}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;w0 \cdot 1\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -3.99999999999999976e-11

                      1. Initial program 67.5%

                        \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
                      2. Add Preprocessing
                      3. Step-by-step derivation
                        1. lift--.f64N/A

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

                          \[\leadsto w0 \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
                        3. +-commutativeN/A

                          \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) + 1}} \]
                        4. lift-*.f64N/A

                          \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\right)\right) + 1} \]
                        5. distribute-lft-neg-inN/A

                          \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)\right) \cdot \frac{h}{\ell}} + 1} \]
                        6. lift-pow.f64N/A

                          \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
                        7. unpow2N/A

                          \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
                        8. distribute-rgt-neg-inN/A

                          \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right)\right)} \cdot \frac{h}{\ell} + 1} \]
                        9. associate-*l*N/A

                          \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}\right)} + 1} \]
                        10. lower-fma.f64N/A

                          \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}, 1\right)}} \]
                      4. Applied rewrites69.5%

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

                        \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{\left(D \cdot \left(M \cdot h\right)\right) \cdot \left(M \cdot D\right)}{\left(-2 \cdot \left(d \cdot \ell\right)\right) \cdot \left(d \cdot 2\right)} + 1}} \]
                      6. Step-by-step derivation
                        1. lift-+.f64N/A

                          \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{\left(D \cdot \left(M \cdot h\right)\right) \cdot \left(M \cdot D\right)}{\left(-2 \cdot \left(d \cdot \ell\right)\right) \cdot \left(d \cdot 2\right)} + 1}} \]
                        2. lift-/.f64N/A

                          \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{\left(D \cdot \left(M \cdot h\right)\right) \cdot \left(M \cdot D\right)}{\left(-2 \cdot \left(d \cdot \ell\right)\right) \cdot \left(d \cdot 2\right)}} + 1} \]
                        3. lift-*.f64N/A

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

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

                          \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{M \cdot D}{\left(-2 \cdot \left(d \cdot \ell\right)\right) \cdot \left(d \cdot 2\right)} \cdot \left(D \cdot \left(M \cdot h\right)\right)} + 1} \]
                        6. lower-fma.f64N/A

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

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

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

                      1. Initial program 88.9%

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

                        \[\leadsto w0 \cdot \color{blue}{1} \]
                      4. Step-by-step derivation
                        1. Applied rewrites98.1%

                          \[\leadsto w0 \cdot \color{blue}{1} \]
                      5. Recombined 2 regimes into one program.
                      6. Final simplification83.9%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{-11}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{d \cdot \left(2 \cdot \left(\ell \cdot \left(d \cdot -2\right)\right)\right)}, \left(M \cdot D\right) \cdot h, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \]
                      7. Add Preprocessing

                      Alternative 7: 84.1% accurate, 0.7× speedup?

                      \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -1 \cdot 10^{+54}:\\ \;\;\;\;w0 \cdot \sqrt{\frac{\frac{\left(D\_m \cdot -0.25\right) \cdot \left(M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot h\right)\right)\right)}{d \cdot \ell}}{d}}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
                      D_m = (fabs.f64 D)
                      M_m = (fabs.f64 M)
                      NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                      (FPCore (w0 M_m D_m h l d)
                       :precision binary64
                       (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -1e+54)
                         (* w0 (sqrt (/ (/ (* (* D_m -0.25) (* M_m (* D_m (* M_m h)))) (* d l)) d)))
                         (* w0 1.0)))
                      D_m = fabs(D);
                      M_m = fabs(M);
                      assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                      double code(double w0, double M_m, double D_m, double h, double l, double d) {
                      	double tmp;
                      	if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -1e+54) {
                      		tmp = w0 * sqrt(((((D_m * -0.25) * (M_m * (D_m * (M_m * h)))) / (d * l)) / d));
                      	} else {
                      		tmp = w0 * 1.0;
                      	}
                      	return tmp;
                      }
                      
                      D_m = abs(d)
                      M_m = abs(m)
                      NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                      real(8) function code(w0, m_m, d_m, h, l, d)
                          real(8), intent (in) :: w0
                          real(8), intent (in) :: m_m
                          real(8), intent (in) :: d_m
                          real(8), intent (in) :: h
                          real(8), intent (in) :: l
                          real(8), intent (in) :: d
                          real(8) :: tmp
                          if (((((m_m * d_m) / (2.0d0 * d)) ** 2.0d0) * (h / l)) <= (-1d+54)) then
                              tmp = w0 * sqrt(((((d_m * (-0.25d0)) * (m_m * (d_m * (m_m * h)))) / (d * l)) / d))
                          else
                              tmp = w0 * 1.0d0
                          end if
                          code = tmp
                      end function
                      
                      D_m = Math.abs(D);
                      M_m = Math.abs(M);
                      assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
                      public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
                      	double tmp;
                      	if ((Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -1e+54) {
                      		tmp = w0 * Math.sqrt(((((D_m * -0.25) * (M_m * (D_m * (M_m * h)))) / (d * l)) / d));
                      	} else {
                      		tmp = w0 * 1.0;
                      	}
                      	return tmp;
                      }
                      
                      D_m = math.fabs(D)
                      M_m = math.fabs(M)
                      [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d])
                      def code(w0, M_m, D_m, h, l, d):
                      	tmp = 0
                      	if (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -1e+54:
                      		tmp = w0 * math.sqrt(((((D_m * -0.25) * (M_m * (D_m * (M_m * h)))) / (d * l)) / d))
                      	else:
                      		tmp = w0 * 1.0
                      	return tmp
                      
                      D_m = abs(D)
                      M_m = abs(M)
                      w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                      function code(w0, M_m, D_m, h, l, d)
                      	tmp = 0.0
                      	if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -1e+54)
                      		tmp = Float64(w0 * sqrt(Float64(Float64(Float64(Float64(D_m * -0.25) * Float64(M_m * Float64(D_m * Float64(M_m * h)))) / Float64(d * l)) / d)));
                      	else
                      		tmp = Float64(w0 * 1.0);
                      	end
                      	return tmp
                      end
                      
                      D_m = abs(D);
                      M_m = abs(M);
                      w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
                      function tmp_2 = code(w0, M_m, D_m, h, l, d)
                      	tmp = 0.0;
                      	if (((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l)) <= -1e+54)
                      		tmp = w0 * sqrt(((((D_m * -0.25) * (M_m * (D_m * (M_m * h)))) / (d * l)) / d));
                      	else
                      		tmp = w0 * 1.0;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      D_m = N[Abs[D], $MachinePrecision]
                      M_m = N[Abs[M], $MachinePrecision]
                      NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                      code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -1e+54], N[(w0 * N[Sqrt[N[(N[(N[(N[(D$95$m * -0.25), $MachinePrecision] * N[(M$95$m * N[(D$95$m * N[(M$95$m * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
                      
                      \begin{array}{l}
                      D_m = \left|D\right|
                      \\
                      M_m = \left|M\right|
                      \\
                      [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -1 \cdot 10^{+54}:\\
                      \;\;\;\;w0 \cdot \sqrt{\frac{\frac{\left(D\_m \cdot -0.25\right) \cdot \left(M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot h\right)\right)\right)}{d \cdot \ell}}{d}}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;w0 \cdot 1\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -1.0000000000000001e54

                        1. Initial program 64.5%

                          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
                        2. Add Preprocessing
                        3. Taylor expanded in M around inf

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

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

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

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

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

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

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

                            \[\leadsto w0 \cdot \sqrt{\frac{\left(\frac{-1}{4} \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}} \]
                          8. lower-*.f64N/A

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

                            \[\leadsto w0 \cdot \sqrt{\frac{\left(\frac{-1}{4} \cdot \left(D \cdot D\right)\right) \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)}{{d}^{2} \cdot \ell}} \]
                          10. lower-*.f64N/A

                            \[\leadsto w0 \cdot \sqrt{\frac{\left(\frac{-1}{4} \cdot \left(D \cdot D\right)\right) \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)}{{d}^{2} \cdot \ell}} \]
                          11. lower-*.f64N/A

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

                            \[\leadsto w0 \cdot \sqrt{\frac{\left(\frac{-1}{4} \cdot \left(D \cdot D\right)\right) \cdot \left(\left(M \cdot M\right) \cdot h\right)}{\color{blue}{\left(d \cdot d\right)} \cdot \ell}} \]
                          13. lower-*.f6440.9

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

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

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

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

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

                            1. Initial program 89.4%

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

                              \[\leadsto w0 \cdot \color{blue}{1} \]
                            4. Step-by-step derivation
                              1. Applied rewrites94.9%

                                \[\leadsto w0 \cdot \color{blue}{1} \]
                            5. Recombined 2 regimes into one program.
                            6. Add Preprocessing

                            Alternative 8: 83.1% accurate, 0.7× speedup?

                            \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+28}:\\ \;\;\;\;w0 \cdot \sqrt{\left(D\_m \cdot \frac{-0.25}{d \cdot d}\right) \cdot \frac{M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot h\right)\right)}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
                            D_m = (fabs.f64 D)
                            M_m = (fabs.f64 M)
                            NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                            (FPCore (w0 M_m D_m h l d)
                             :precision binary64
                             (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -2e+28)
                               (* w0 (sqrt (* (* D_m (/ -0.25 (* d d))) (/ (* M_m (* D_m (* M_m h))) l))))
                               (* w0 1.0)))
                            D_m = fabs(D);
                            M_m = fabs(M);
                            assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                            double code(double w0, double M_m, double D_m, double h, double l, double d) {
                            	double tmp;
                            	if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -2e+28) {
                            		tmp = w0 * sqrt(((D_m * (-0.25 / (d * d))) * ((M_m * (D_m * (M_m * h))) / l)));
                            	} else {
                            		tmp = w0 * 1.0;
                            	}
                            	return tmp;
                            }
                            
                            D_m = abs(d)
                            M_m = abs(m)
                            NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                            real(8) function code(w0, m_m, d_m, h, l, d)
                                real(8), intent (in) :: w0
                                real(8), intent (in) :: m_m
                                real(8), intent (in) :: d_m
                                real(8), intent (in) :: h
                                real(8), intent (in) :: l
                                real(8), intent (in) :: d
                                real(8) :: tmp
                                if (((((m_m * d_m) / (2.0d0 * d)) ** 2.0d0) * (h / l)) <= (-2d+28)) then
                                    tmp = w0 * sqrt(((d_m * ((-0.25d0) / (d * d))) * ((m_m * (d_m * (m_m * h))) / l)))
                                else
                                    tmp = w0 * 1.0d0
                                end if
                                code = tmp
                            end function
                            
                            D_m = Math.abs(D);
                            M_m = Math.abs(M);
                            assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
                            public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
                            	double tmp;
                            	if ((Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -2e+28) {
                            		tmp = w0 * Math.sqrt(((D_m * (-0.25 / (d * d))) * ((M_m * (D_m * (M_m * h))) / l)));
                            	} else {
                            		tmp = w0 * 1.0;
                            	}
                            	return tmp;
                            }
                            
                            D_m = math.fabs(D)
                            M_m = math.fabs(M)
                            [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d])
                            def code(w0, M_m, D_m, h, l, d):
                            	tmp = 0
                            	if (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -2e+28:
                            		tmp = w0 * math.sqrt(((D_m * (-0.25 / (d * d))) * ((M_m * (D_m * (M_m * h))) / l)))
                            	else:
                            		tmp = w0 * 1.0
                            	return tmp
                            
                            D_m = abs(D)
                            M_m = abs(M)
                            w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                            function code(w0, M_m, D_m, h, l, d)
                            	tmp = 0.0
                            	if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -2e+28)
                            		tmp = Float64(w0 * sqrt(Float64(Float64(D_m * Float64(-0.25 / Float64(d * d))) * Float64(Float64(M_m * Float64(D_m * Float64(M_m * h))) / l))));
                            	else
                            		tmp = Float64(w0 * 1.0);
                            	end
                            	return tmp
                            end
                            
                            D_m = abs(D);
                            M_m = abs(M);
                            w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
                            function tmp_2 = code(w0, M_m, D_m, h, l, d)
                            	tmp = 0.0;
                            	if (((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l)) <= -2e+28)
                            		tmp = w0 * sqrt(((D_m * (-0.25 / (d * d))) * ((M_m * (D_m * (M_m * h))) / l)));
                            	else
                            		tmp = w0 * 1.0;
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            D_m = N[Abs[D], $MachinePrecision]
                            M_m = N[Abs[M], $MachinePrecision]
                            NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                            code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e+28], N[(w0 * N[Sqrt[N[(N[(D$95$m * N[(-0.25 / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m * N[(D$95$m * N[(M$95$m * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
                            
                            \begin{array}{l}
                            D_m = \left|D\right|
                            \\
                            M_m = \left|M\right|
                            \\
                            [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                            \\
                            \begin{array}{l}
                            \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+28}:\\
                            \;\;\;\;w0 \cdot \sqrt{\left(D\_m \cdot \frac{-0.25}{d \cdot d}\right) \cdot \frac{M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot h\right)\right)}{\ell}}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;w0 \cdot 1\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -1.99999999999999992e28

                              1. Initial program 65.7%

                                \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
                              2. Add Preprocessing
                              3. Taylor expanded in M around inf

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

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

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

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

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

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

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

                                  \[\leadsto w0 \cdot \sqrt{\frac{\left(\frac{-1}{4} \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}} \]
                                8. lower-*.f64N/A

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

                                  \[\leadsto w0 \cdot \sqrt{\frac{\left(\frac{-1}{4} \cdot \left(D \cdot D\right)\right) \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)}{{d}^{2} \cdot \ell}} \]
                                10. lower-*.f64N/A

                                  \[\leadsto w0 \cdot \sqrt{\frac{\left(\frac{-1}{4} \cdot \left(D \cdot D\right)\right) \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)}{{d}^{2} \cdot \ell}} \]
                                11. lower-*.f64N/A

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

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

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

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

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

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

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

                                  1. Initial program 89.2%

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

                                    \[\leadsto w0 \cdot \color{blue}{1} \]
                                  4. Step-by-step derivation
                                    1. Applied rewrites96.4%

                                      \[\leadsto w0 \cdot \color{blue}{1} \]
                                  5. Recombined 2 regimes into one program.
                                  6. Final simplification80.6%

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

                                  Alternative 9: 82.4% accurate, 0.8× speedup?

                                  \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -1 \cdot 10^{+54}:\\ \;\;\;\;w0 \cdot \sqrt{\left(D\_m \cdot -0.25\right) \cdot \left(D\_m \cdot \frac{M\_m \cdot \left(M\_m \cdot h\right)}{d \cdot \left(d \cdot \ell\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
                                  D_m = (fabs.f64 D)
                                  M_m = (fabs.f64 M)
                                  NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                  (FPCore (w0 M_m D_m h l d)
                                   :precision binary64
                                   (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -1e+54)
                                     (* w0 (sqrt (* (* D_m -0.25) (* D_m (/ (* M_m (* M_m h)) (* d (* d l)))))))
                                     (* w0 1.0)))
                                  D_m = fabs(D);
                                  M_m = fabs(M);
                                  assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                                  double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                  	double tmp;
                                  	if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -1e+54) {
                                  		tmp = w0 * sqrt(((D_m * -0.25) * (D_m * ((M_m * (M_m * h)) / (d * (d * l))))));
                                  	} else {
                                  		tmp = w0 * 1.0;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  D_m = abs(d)
                                  M_m = abs(m)
                                  NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                  real(8) function code(w0, m_m, d_m, h, l, d)
                                      real(8), intent (in) :: w0
                                      real(8), intent (in) :: m_m
                                      real(8), intent (in) :: d_m
                                      real(8), intent (in) :: h
                                      real(8), intent (in) :: l
                                      real(8), intent (in) :: d
                                      real(8) :: tmp
                                      if (((((m_m * d_m) / (2.0d0 * d)) ** 2.0d0) * (h / l)) <= (-1d+54)) then
                                          tmp = w0 * sqrt(((d_m * (-0.25d0)) * (d_m * ((m_m * (m_m * h)) / (d * (d * l))))))
                                      else
                                          tmp = w0 * 1.0d0
                                      end if
                                      code = tmp
                                  end function
                                  
                                  D_m = Math.abs(D);
                                  M_m = Math.abs(M);
                                  assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
                                  public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                  	double tmp;
                                  	if ((Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -1e+54) {
                                  		tmp = w0 * Math.sqrt(((D_m * -0.25) * (D_m * ((M_m * (M_m * h)) / (d * (d * l))))));
                                  	} else {
                                  		tmp = w0 * 1.0;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  D_m = math.fabs(D)
                                  M_m = math.fabs(M)
                                  [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d])
                                  def code(w0, M_m, D_m, h, l, d):
                                  	tmp = 0
                                  	if (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -1e+54:
                                  		tmp = w0 * math.sqrt(((D_m * -0.25) * (D_m * ((M_m * (M_m * h)) / (d * (d * l))))))
                                  	else:
                                  		tmp = w0 * 1.0
                                  	return tmp
                                  
                                  D_m = abs(D)
                                  M_m = abs(M)
                                  w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                                  function code(w0, M_m, D_m, h, l, d)
                                  	tmp = 0.0
                                  	if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -1e+54)
                                  		tmp = Float64(w0 * sqrt(Float64(Float64(D_m * -0.25) * Float64(D_m * Float64(Float64(M_m * Float64(M_m * h)) / Float64(d * Float64(d * l)))))));
                                  	else
                                  		tmp = Float64(w0 * 1.0);
                                  	end
                                  	return tmp
                                  end
                                  
                                  D_m = abs(D);
                                  M_m = abs(M);
                                  w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
                                  function tmp_2 = code(w0, M_m, D_m, h, l, d)
                                  	tmp = 0.0;
                                  	if (((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l)) <= -1e+54)
                                  		tmp = w0 * sqrt(((D_m * -0.25) * (D_m * ((M_m * (M_m * h)) / (d * (d * l))))));
                                  	else
                                  		tmp = w0 * 1.0;
                                  	end
                                  	tmp_2 = tmp;
                                  end
                                  
                                  D_m = N[Abs[D], $MachinePrecision]
                                  M_m = N[Abs[M], $MachinePrecision]
                                  NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                  code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -1e+54], N[(w0 * N[Sqrt[N[(N[(D$95$m * -0.25), $MachinePrecision] * N[(D$95$m * N[(N[(M$95$m * N[(M$95$m * h), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
                                  
                                  \begin{array}{l}
                                  D_m = \left|D\right|
                                  \\
                                  M_m = \left|M\right|
                                  \\
                                  [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                                  \\
                                  \begin{array}{l}
                                  \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -1 \cdot 10^{+54}:\\
                                  \;\;\;\;w0 \cdot \sqrt{\left(D\_m \cdot -0.25\right) \cdot \left(D\_m \cdot \frac{M\_m \cdot \left(M\_m \cdot h\right)}{d \cdot \left(d \cdot \ell\right)}\right)}\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;w0 \cdot 1\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -1.0000000000000001e54

                                    1. Initial program 64.5%

                                      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in M around inf

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

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

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

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

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

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

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

                                        \[\leadsto w0 \cdot \sqrt{\frac{\left(\frac{-1}{4} \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}} \]
                                      8. lower-*.f64N/A

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

                                        \[\leadsto w0 \cdot \sqrt{\frac{\left(\frac{-1}{4} \cdot \left(D \cdot D\right)\right) \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)}{{d}^{2} \cdot \ell}} \]
                                      10. lower-*.f64N/A

                                        \[\leadsto w0 \cdot \sqrt{\frac{\left(\frac{-1}{4} \cdot \left(D \cdot D\right)\right) \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)}{{d}^{2} \cdot \ell}} \]
                                      11. lower-*.f64N/A

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

                                        \[\leadsto w0 \cdot \sqrt{\frac{\left(\frac{-1}{4} \cdot \left(D \cdot D\right)\right) \cdot \left(\left(M \cdot M\right) \cdot h\right)}{\color{blue}{\left(d \cdot d\right)} \cdot \ell}} \]
                                      13. lower-*.f6440.9

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

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

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

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

                                      1. Initial program 89.4%

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

                                        \[\leadsto w0 \cdot \color{blue}{1} \]
                                      4. Step-by-step derivation
                                        1. Applied rewrites94.9%

                                          \[\leadsto w0 \cdot \color{blue}{1} \]
                                      5. Recombined 2 regimes into one program.
                                      6. Add Preprocessing

                                      Alternative 10: 81.1% accurate, 0.8× speedup?

                                      \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{+188}:\\ \;\;\;\;\mathsf{fma}\left(D\_m \cdot D\_m, M\_m \cdot \left(\frac{M\_m \cdot w0}{d} \cdot \left(-0.125 \cdot \frac{h}{d \cdot \ell}\right)\right), w0\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
                                      D_m = (fabs.f64 D)
                                      M_m = (fabs.f64 M)
                                      NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                      (FPCore (w0 M_m D_m h l d)
                                       :precision binary64
                                       (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -4e+188)
                                         (fma (* D_m D_m) (* M_m (* (/ (* M_m w0) d) (* -0.125 (/ h (* d l))))) w0)
                                         (* w0 1.0)))
                                      D_m = fabs(D);
                                      M_m = fabs(M);
                                      assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                                      double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                      	double tmp;
                                      	if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188) {
                                      		tmp = fma((D_m * D_m), (M_m * (((M_m * w0) / d) * (-0.125 * (h / (d * l))))), w0);
                                      	} else {
                                      		tmp = w0 * 1.0;
                                      	}
                                      	return tmp;
                                      }
                                      
                                      D_m = abs(D)
                                      M_m = abs(M)
                                      w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                                      function code(w0, M_m, D_m, h, l, d)
                                      	tmp = 0.0
                                      	if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -4e+188)
                                      		tmp = fma(Float64(D_m * D_m), Float64(M_m * Float64(Float64(Float64(M_m * w0) / d) * Float64(-0.125 * Float64(h / Float64(d * l))))), w0);
                                      	else
                                      		tmp = Float64(w0 * 1.0);
                                      	end
                                      	return tmp
                                      end
                                      
                                      D_m = N[Abs[D], $MachinePrecision]
                                      M_m = N[Abs[M], $MachinePrecision]
                                      NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                      code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -4e+188], N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(M$95$m * N[(N[(N[(M$95$m * w0), $MachinePrecision] / d), $MachinePrecision] * N[(-0.125 * N[(h / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
                                      
                                      \begin{array}{l}
                                      D_m = \left|D\right|
                                      \\
                                      M_m = \left|M\right|
                                      \\
                                      [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{+188}:\\
                                      \;\;\;\;\mathsf{fma}\left(D\_m \cdot D\_m, M\_m \cdot \left(\frac{M\_m \cdot w0}{d} \cdot \left(-0.125 \cdot \frac{h}{d \cdot \ell}\right)\right), w0\right)\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;w0 \cdot 1\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 2 regimes
                                      2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.0000000000000001e188

                                        1. Initial program 61.0%

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

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

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

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

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

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

                                            \[\leadsto {D}^{2} \cdot \color{blue}{\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}\right)} + w0 \]
                                          6. lower-fma.f64N/A

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

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

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

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

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

                                            1. Initial program 89.8%

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

                                              \[\leadsto w0 \cdot \color{blue}{1} \]
                                            4. Step-by-step derivation
                                              1. Applied rewrites91.0%

                                                \[\leadsto w0 \cdot \color{blue}{1} \]
                                            5. Recombined 2 regimes into one program.
                                            6. Add Preprocessing

                                            Alternative 11: 81.0% accurate, 0.8× speedup?

                                            \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{+188}:\\ \;\;\;\;\frac{\frac{\left(M\_m \cdot \left(-0.125 \cdot \left(D\_m \cdot D\_m\right)\right)\right) \cdot \left(M\_m \cdot \left(h \cdot w0\right)\right)}{d \cdot \ell}}{d}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
                                            D_m = (fabs.f64 D)
                                            M_m = (fabs.f64 M)
                                            NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                            (FPCore (w0 M_m D_m h l d)
                                             :precision binary64
                                             (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -4e+188)
                                               (/ (/ (* (* M_m (* -0.125 (* D_m D_m))) (* M_m (* h w0))) (* d l)) d)
                                               (* w0 1.0)))
                                            D_m = fabs(D);
                                            M_m = fabs(M);
                                            assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                                            double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                            	double tmp;
                                            	if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188) {
                                            		tmp = (((M_m * (-0.125 * (D_m * D_m))) * (M_m * (h * w0))) / (d * l)) / d;
                                            	} else {
                                            		tmp = w0 * 1.0;
                                            	}
                                            	return tmp;
                                            }
                                            
                                            D_m = abs(d)
                                            M_m = abs(m)
                                            NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                            real(8) function code(w0, m_m, d_m, h, l, d)
                                                real(8), intent (in) :: w0
                                                real(8), intent (in) :: m_m
                                                real(8), intent (in) :: d_m
                                                real(8), intent (in) :: h
                                                real(8), intent (in) :: l
                                                real(8), intent (in) :: d
                                                real(8) :: tmp
                                                if (((((m_m * d_m) / (2.0d0 * d)) ** 2.0d0) * (h / l)) <= (-4d+188)) then
                                                    tmp = (((m_m * ((-0.125d0) * (d_m * d_m))) * (m_m * (h * w0))) / (d * l)) / d
                                                else
                                                    tmp = w0 * 1.0d0
                                                end if
                                                code = tmp
                                            end function
                                            
                                            D_m = Math.abs(D);
                                            M_m = Math.abs(M);
                                            assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
                                            public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                            	double tmp;
                                            	if ((Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188) {
                                            		tmp = (((M_m * (-0.125 * (D_m * D_m))) * (M_m * (h * w0))) / (d * l)) / d;
                                            	} else {
                                            		tmp = w0 * 1.0;
                                            	}
                                            	return tmp;
                                            }
                                            
                                            D_m = math.fabs(D)
                                            M_m = math.fabs(M)
                                            [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d])
                                            def code(w0, M_m, D_m, h, l, d):
                                            	tmp = 0
                                            	if (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188:
                                            		tmp = (((M_m * (-0.125 * (D_m * D_m))) * (M_m * (h * w0))) / (d * l)) / d
                                            	else:
                                            		tmp = w0 * 1.0
                                            	return tmp
                                            
                                            D_m = abs(D)
                                            M_m = abs(M)
                                            w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                                            function code(w0, M_m, D_m, h, l, d)
                                            	tmp = 0.0
                                            	if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -4e+188)
                                            		tmp = Float64(Float64(Float64(Float64(M_m * Float64(-0.125 * Float64(D_m * D_m))) * Float64(M_m * Float64(h * w0))) / Float64(d * l)) / d);
                                            	else
                                            		tmp = Float64(w0 * 1.0);
                                            	end
                                            	return tmp
                                            end
                                            
                                            D_m = abs(D);
                                            M_m = abs(M);
                                            w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
                                            function tmp_2 = code(w0, M_m, D_m, h, l, d)
                                            	tmp = 0.0;
                                            	if (((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l)) <= -4e+188)
                                            		tmp = (((M_m * (-0.125 * (D_m * D_m))) * (M_m * (h * w0))) / (d * l)) / d;
                                            	else
                                            		tmp = w0 * 1.0;
                                            	end
                                            	tmp_2 = tmp;
                                            end
                                            
                                            D_m = N[Abs[D], $MachinePrecision]
                                            M_m = N[Abs[M], $MachinePrecision]
                                            NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                            code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -4e+188], N[(N[(N[(N[(M$95$m * N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(M$95$m * N[(h * w0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
                                            
                                            \begin{array}{l}
                                            D_m = \left|D\right|
                                            \\
                                            M_m = \left|M\right|
                                            \\
                                            [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                                            \\
                                            \begin{array}{l}
                                            \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{+188}:\\
                                            \;\;\;\;\frac{\frac{\left(M\_m \cdot \left(-0.125 \cdot \left(D\_m \cdot D\_m\right)\right)\right) \cdot \left(M\_m \cdot \left(h \cdot w0\right)\right)}{d \cdot \ell}}{d}\\
                                            
                                            \mathbf{else}:\\
                                            \;\;\;\;w0 \cdot 1\\
                                            
                                            
                                            \end{array}
                                            \end{array}
                                            
                                            Derivation
                                            1. Split input into 2 regimes
                                            2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.0000000000000001e188

                                              1. Initial program 61.0%

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

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

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

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

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

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

                                                  \[\leadsto {D}^{2} \cdot \color{blue}{\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}\right)} + w0 \]
                                                6. lower-fma.f64N/A

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

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

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

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

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

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

                                                  1. Initial program 89.8%

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

                                                    \[\leadsto w0 \cdot \color{blue}{1} \]
                                                  4. Step-by-step derivation
                                                    1. Applied rewrites91.0%

                                                      \[\leadsto w0 \cdot \color{blue}{1} \]
                                                  5. Recombined 2 regimes into one program.
                                                  6. Add Preprocessing

                                                  Alternative 12: 80.7% accurate, 0.8× speedup?

                                                  \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -1.5 \cdot 10^{+297}:\\ \;\;\;\;\frac{h \cdot w0}{d} \cdot \frac{M\_m \cdot \left(M\_m \cdot \left(-0.125 \cdot \left(D\_m \cdot D\_m\right)\right)\right)}{d \cdot \ell}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
                                                  D_m = (fabs.f64 D)
                                                  M_m = (fabs.f64 M)
                                                  NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                  (FPCore (w0 M_m D_m h l d)
                                                   :precision binary64
                                                   (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -1.5e+297)
                                                     (* (/ (* h w0) d) (/ (* M_m (* M_m (* -0.125 (* D_m D_m)))) (* d l)))
                                                     (* w0 1.0)))
                                                  D_m = fabs(D);
                                                  M_m = fabs(M);
                                                  assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                                                  double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                  	double tmp;
                                                  	if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -1.5e+297) {
                                                  		tmp = ((h * w0) / d) * ((M_m * (M_m * (-0.125 * (D_m * D_m)))) / (d * l));
                                                  	} else {
                                                  		tmp = w0 * 1.0;
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  D_m = abs(d)
                                                  M_m = abs(m)
                                                  NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                  real(8) function code(w0, m_m, d_m, h, l, d)
                                                      real(8), intent (in) :: w0
                                                      real(8), intent (in) :: m_m
                                                      real(8), intent (in) :: d_m
                                                      real(8), intent (in) :: h
                                                      real(8), intent (in) :: l
                                                      real(8), intent (in) :: d
                                                      real(8) :: tmp
                                                      if (((((m_m * d_m) / (2.0d0 * d)) ** 2.0d0) * (h / l)) <= (-1.5d+297)) then
                                                          tmp = ((h * w0) / d) * ((m_m * (m_m * ((-0.125d0) * (d_m * d_m)))) / (d * l))
                                                      else
                                                          tmp = w0 * 1.0d0
                                                      end if
                                                      code = tmp
                                                  end function
                                                  
                                                  D_m = Math.abs(D);
                                                  M_m = Math.abs(M);
                                                  assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
                                                  public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                  	double tmp;
                                                  	if ((Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -1.5e+297) {
                                                  		tmp = ((h * w0) / d) * ((M_m * (M_m * (-0.125 * (D_m * D_m)))) / (d * l));
                                                  	} else {
                                                  		tmp = w0 * 1.0;
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  D_m = math.fabs(D)
                                                  M_m = math.fabs(M)
                                                  [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d])
                                                  def code(w0, M_m, D_m, h, l, d):
                                                  	tmp = 0
                                                  	if (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -1.5e+297:
                                                  		tmp = ((h * w0) / d) * ((M_m * (M_m * (-0.125 * (D_m * D_m)))) / (d * l))
                                                  	else:
                                                  		tmp = w0 * 1.0
                                                  	return tmp
                                                  
                                                  D_m = abs(D)
                                                  M_m = abs(M)
                                                  w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                                                  function code(w0, M_m, D_m, h, l, d)
                                                  	tmp = 0.0
                                                  	if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -1.5e+297)
                                                  		tmp = Float64(Float64(Float64(h * w0) / d) * Float64(Float64(M_m * Float64(M_m * Float64(-0.125 * Float64(D_m * D_m)))) / Float64(d * l)));
                                                  	else
                                                  		tmp = Float64(w0 * 1.0);
                                                  	end
                                                  	return tmp
                                                  end
                                                  
                                                  D_m = abs(D);
                                                  M_m = abs(M);
                                                  w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
                                                  function tmp_2 = code(w0, M_m, D_m, h, l, d)
                                                  	tmp = 0.0;
                                                  	if (((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l)) <= -1.5e+297)
                                                  		tmp = ((h * w0) / d) * ((M_m * (M_m * (-0.125 * (D_m * D_m)))) / (d * l));
                                                  	else
                                                  		tmp = w0 * 1.0;
                                                  	end
                                                  	tmp_2 = tmp;
                                                  end
                                                  
                                                  D_m = N[Abs[D], $MachinePrecision]
                                                  M_m = N[Abs[M], $MachinePrecision]
                                                  NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                  code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -1.5e+297], N[(N[(N[(h * w0), $MachinePrecision] / d), $MachinePrecision] * N[(N[(M$95$m * N[(M$95$m * N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
                                                  
                                                  \begin{array}{l}
                                                  D_m = \left|D\right|
                                                  \\
                                                  M_m = \left|M\right|
                                                  \\
                                                  [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                                                  \\
                                                  \begin{array}{l}
                                                  \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -1.5 \cdot 10^{+297}:\\
                                                  \;\;\;\;\frac{h \cdot w0}{d} \cdot \frac{M\_m \cdot \left(M\_m \cdot \left(-0.125 \cdot \left(D\_m \cdot D\_m\right)\right)\right)}{d \cdot \ell}\\
                                                  
                                                  \mathbf{else}:\\
                                                  \;\;\;\;w0 \cdot 1\\
                                                  
                                                  
                                                  \end{array}
                                                  \end{array}
                                                  
                                                  Derivation
                                                  1. Split input into 2 regimes
                                                  2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -1.49999999999999988e297

                                                    1. Initial program 58.9%

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

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

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

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

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

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

                                                        \[\leadsto {D}^{2} \cdot \color{blue}{\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}\right)} + w0 \]
                                                      6. lower-fma.f64N/A

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

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

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

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

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

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

                                                        1. Initial program 90.0%

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

                                                          \[\leadsto w0 \cdot \color{blue}{1} \]
                                                        4. Step-by-step derivation
                                                          1. Applied rewrites89.1%

                                                            \[\leadsto w0 \cdot \color{blue}{1} \]
                                                        5. Recombined 2 regimes into one program.
                                                        6. Add Preprocessing

                                                        Alternative 13: 80.3% accurate, 0.8× speedup?

                                                        \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{+188}:\\ \;\;\;\;\frac{M\_m \cdot \left(M\_m \cdot w0\right)}{d} \cdot \left(D\_m \cdot \left(D\_m \cdot \left(-0.125 \cdot \frac{h}{d \cdot \ell}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
                                                        D_m = (fabs.f64 D)
                                                        M_m = (fabs.f64 M)
                                                        NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                        (FPCore (w0 M_m D_m h l d)
                                                         :precision binary64
                                                         (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -4e+188)
                                                           (* (/ (* M_m (* M_m w0)) d) (* D_m (* D_m (* -0.125 (/ h (* d l))))))
                                                           (* w0 1.0)))
                                                        D_m = fabs(D);
                                                        M_m = fabs(M);
                                                        assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                                                        double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                        	double tmp;
                                                        	if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188) {
                                                        		tmp = ((M_m * (M_m * w0)) / d) * (D_m * (D_m * (-0.125 * (h / (d * l)))));
                                                        	} else {
                                                        		tmp = w0 * 1.0;
                                                        	}
                                                        	return tmp;
                                                        }
                                                        
                                                        D_m = abs(d)
                                                        M_m = abs(m)
                                                        NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                        real(8) function code(w0, m_m, d_m, h, l, d)
                                                            real(8), intent (in) :: w0
                                                            real(8), intent (in) :: m_m
                                                            real(8), intent (in) :: d_m
                                                            real(8), intent (in) :: h
                                                            real(8), intent (in) :: l
                                                            real(8), intent (in) :: d
                                                            real(8) :: tmp
                                                            if (((((m_m * d_m) / (2.0d0 * d)) ** 2.0d0) * (h / l)) <= (-4d+188)) then
                                                                tmp = ((m_m * (m_m * w0)) / d) * (d_m * (d_m * ((-0.125d0) * (h / (d * l)))))
                                                            else
                                                                tmp = w0 * 1.0d0
                                                            end if
                                                            code = tmp
                                                        end function
                                                        
                                                        D_m = Math.abs(D);
                                                        M_m = Math.abs(M);
                                                        assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
                                                        public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                        	double tmp;
                                                        	if ((Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188) {
                                                        		tmp = ((M_m * (M_m * w0)) / d) * (D_m * (D_m * (-0.125 * (h / (d * l)))));
                                                        	} else {
                                                        		tmp = w0 * 1.0;
                                                        	}
                                                        	return tmp;
                                                        }
                                                        
                                                        D_m = math.fabs(D)
                                                        M_m = math.fabs(M)
                                                        [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d])
                                                        def code(w0, M_m, D_m, h, l, d):
                                                        	tmp = 0
                                                        	if (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188:
                                                        		tmp = ((M_m * (M_m * w0)) / d) * (D_m * (D_m * (-0.125 * (h / (d * l)))))
                                                        	else:
                                                        		tmp = w0 * 1.0
                                                        	return tmp
                                                        
                                                        D_m = abs(D)
                                                        M_m = abs(M)
                                                        w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                                                        function code(w0, M_m, D_m, h, l, d)
                                                        	tmp = 0.0
                                                        	if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -4e+188)
                                                        		tmp = Float64(Float64(Float64(M_m * Float64(M_m * w0)) / d) * Float64(D_m * Float64(D_m * Float64(-0.125 * Float64(h / Float64(d * l))))));
                                                        	else
                                                        		tmp = Float64(w0 * 1.0);
                                                        	end
                                                        	return tmp
                                                        end
                                                        
                                                        D_m = abs(D);
                                                        M_m = abs(M);
                                                        w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
                                                        function tmp_2 = code(w0, M_m, D_m, h, l, d)
                                                        	tmp = 0.0;
                                                        	if (((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l)) <= -4e+188)
                                                        		tmp = ((M_m * (M_m * w0)) / d) * (D_m * (D_m * (-0.125 * (h / (d * l)))));
                                                        	else
                                                        		tmp = w0 * 1.0;
                                                        	end
                                                        	tmp_2 = tmp;
                                                        end
                                                        
                                                        D_m = N[Abs[D], $MachinePrecision]
                                                        M_m = N[Abs[M], $MachinePrecision]
                                                        NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                        code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -4e+188], N[(N[(N[(M$95$m * N[(M$95$m * w0), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(D$95$m * N[(D$95$m * N[(-0.125 * N[(h / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
                                                        
                                                        \begin{array}{l}
                                                        D_m = \left|D\right|
                                                        \\
                                                        M_m = \left|M\right|
                                                        \\
                                                        [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                                                        \\
                                                        \begin{array}{l}
                                                        \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{+188}:\\
                                                        \;\;\;\;\frac{M\_m \cdot \left(M\_m \cdot w0\right)}{d} \cdot \left(D\_m \cdot \left(D\_m \cdot \left(-0.125 \cdot \frac{h}{d \cdot \ell}\right)\right)\right)\\
                                                        
                                                        \mathbf{else}:\\
                                                        \;\;\;\;w0 \cdot 1\\
                                                        
                                                        
                                                        \end{array}
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Split input into 2 regimes
                                                        2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.0000000000000001e188

                                                          1. Initial program 61.0%

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

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

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

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

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

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

                                                              \[\leadsto {D}^{2} \cdot \color{blue}{\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}\right)} + w0 \]
                                                            6. lower-fma.f64N/A

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

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

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

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

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

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

                                                            1. Initial program 89.8%

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

                                                              \[\leadsto w0 \cdot \color{blue}{1} \]
                                                            4. Step-by-step derivation
                                                              1. Applied rewrites91.0%

                                                                \[\leadsto w0 \cdot \color{blue}{1} \]
                                                            5. Recombined 2 regimes into one program.
                                                            6. Add Preprocessing

                                                            Alternative 14: 80.4% accurate, 0.8× speedup?

                                                            \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{+188}:\\ \;\;\;\;\frac{D\_m \cdot D\_m}{d \cdot \ell} \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot w0\right)}{d} \cdot \left(h \cdot -0.125\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
                                                            D_m = (fabs.f64 D)
                                                            M_m = (fabs.f64 M)
                                                            NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                            (FPCore (w0 M_m D_m h l d)
                                                             :precision binary64
                                                             (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -4e+188)
                                                               (* (/ (* D_m D_m) (* d l)) (* (/ (* M_m (* M_m w0)) d) (* h -0.125)))
                                                               (* w0 1.0)))
                                                            D_m = fabs(D);
                                                            M_m = fabs(M);
                                                            assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                                                            double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                            	double tmp;
                                                            	if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188) {
                                                            		tmp = ((D_m * D_m) / (d * l)) * (((M_m * (M_m * w0)) / d) * (h * -0.125));
                                                            	} else {
                                                            		tmp = w0 * 1.0;
                                                            	}
                                                            	return tmp;
                                                            }
                                                            
                                                            D_m = abs(d)
                                                            M_m = abs(m)
                                                            NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                            real(8) function code(w0, m_m, d_m, h, l, d)
                                                                real(8), intent (in) :: w0
                                                                real(8), intent (in) :: m_m
                                                                real(8), intent (in) :: d_m
                                                                real(8), intent (in) :: h
                                                                real(8), intent (in) :: l
                                                                real(8), intent (in) :: d
                                                                real(8) :: tmp
                                                                if (((((m_m * d_m) / (2.0d0 * d)) ** 2.0d0) * (h / l)) <= (-4d+188)) then
                                                                    tmp = ((d_m * d_m) / (d * l)) * (((m_m * (m_m * w0)) / d) * (h * (-0.125d0)))
                                                                else
                                                                    tmp = w0 * 1.0d0
                                                                end if
                                                                code = tmp
                                                            end function
                                                            
                                                            D_m = Math.abs(D);
                                                            M_m = Math.abs(M);
                                                            assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
                                                            public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                            	double tmp;
                                                            	if ((Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188) {
                                                            		tmp = ((D_m * D_m) / (d * l)) * (((M_m * (M_m * w0)) / d) * (h * -0.125));
                                                            	} else {
                                                            		tmp = w0 * 1.0;
                                                            	}
                                                            	return tmp;
                                                            }
                                                            
                                                            D_m = math.fabs(D)
                                                            M_m = math.fabs(M)
                                                            [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d])
                                                            def code(w0, M_m, D_m, h, l, d):
                                                            	tmp = 0
                                                            	if (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188:
                                                            		tmp = ((D_m * D_m) / (d * l)) * (((M_m * (M_m * w0)) / d) * (h * -0.125))
                                                            	else:
                                                            		tmp = w0 * 1.0
                                                            	return tmp
                                                            
                                                            D_m = abs(D)
                                                            M_m = abs(M)
                                                            w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                                                            function code(w0, M_m, D_m, h, l, d)
                                                            	tmp = 0.0
                                                            	if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -4e+188)
                                                            		tmp = Float64(Float64(Float64(D_m * D_m) / Float64(d * l)) * Float64(Float64(Float64(M_m * Float64(M_m * w0)) / d) * Float64(h * -0.125)));
                                                            	else
                                                            		tmp = Float64(w0 * 1.0);
                                                            	end
                                                            	return tmp
                                                            end
                                                            
                                                            D_m = abs(D);
                                                            M_m = abs(M);
                                                            w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
                                                            function tmp_2 = code(w0, M_m, D_m, h, l, d)
                                                            	tmp = 0.0;
                                                            	if (((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l)) <= -4e+188)
                                                            		tmp = ((D_m * D_m) / (d * l)) * (((M_m * (M_m * w0)) / d) * (h * -0.125));
                                                            	else
                                                            		tmp = w0 * 1.0;
                                                            	end
                                                            	tmp_2 = tmp;
                                                            end
                                                            
                                                            D_m = N[Abs[D], $MachinePrecision]
                                                            M_m = N[Abs[M], $MachinePrecision]
                                                            NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                            code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -4e+188], N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * N[(M$95$m * w0), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(h * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
                                                            
                                                            \begin{array}{l}
                                                            D_m = \left|D\right|
                                                            \\
                                                            M_m = \left|M\right|
                                                            \\
                                                            [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                                                            \\
                                                            \begin{array}{l}
                                                            \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{+188}:\\
                                                            \;\;\;\;\frac{D\_m \cdot D\_m}{d \cdot \ell} \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot w0\right)}{d} \cdot \left(h \cdot -0.125\right)\right)\\
                                                            
                                                            \mathbf{else}:\\
                                                            \;\;\;\;w0 \cdot 1\\
                                                            
                                                            
                                                            \end{array}
                                                            \end{array}
                                                            
                                                            Derivation
                                                            1. Split input into 2 regimes
                                                            2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.0000000000000001e188

                                                              1. Initial program 61.0%

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

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

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

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

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

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

                                                                  \[\leadsto {D}^{2} \cdot \color{blue}{\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}\right)} + w0 \]
                                                                6. lower-fma.f64N/A

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

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

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

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

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

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

                                                                  1. Initial program 89.8%

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

                                                                    \[\leadsto w0 \cdot \color{blue}{1} \]
                                                                  4. Step-by-step derivation
                                                                    1. Applied rewrites91.0%

                                                                      \[\leadsto w0 \cdot \color{blue}{1} \]
                                                                  5. Recombined 2 regimes into one program.
                                                                  6. Final simplification78.2%

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

                                                                  Alternative 15: 80.6% accurate, 0.8× speedup?

                                                                  \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{+188}:\\ \;\;\;\;\frac{-0.125 \cdot \left(D\_m \cdot D\_m\right)}{d} \cdot \frac{M\_m \cdot \left(h \cdot \left(M\_m \cdot w0\right)\right)}{d \cdot \ell}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
                                                                  D_m = (fabs.f64 D)
                                                                  M_m = (fabs.f64 M)
                                                                  NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                  (FPCore (w0 M_m D_m h l d)
                                                                   :precision binary64
                                                                   (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -4e+188)
                                                                     (* (/ (* -0.125 (* D_m D_m)) d) (/ (* M_m (* h (* M_m w0))) (* d l)))
                                                                     (* w0 1.0)))
                                                                  D_m = fabs(D);
                                                                  M_m = fabs(M);
                                                                  assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                                                                  double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                                  	double tmp;
                                                                  	if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188) {
                                                                  		tmp = ((-0.125 * (D_m * D_m)) / d) * ((M_m * (h * (M_m * w0))) / (d * l));
                                                                  	} else {
                                                                  		tmp = w0 * 1.0;
                                                                  	}
                                                                  	return tmp;
                                                                  }
                                                                  
                                                                  D_m = abs(d)
                                                                  M_m = abs(m)
                                                                  NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                  real(8) function code(w0, m_m, d_m, h, l, d)
                                                                      real(8), intent (in) :: w0
                                                                      real(8), intent (in) :: m_m
                                                                      real(8), intent (in) :: d_m
                                                                      real(8), intent (in) :: h
                                                                      real(8), intent (in) :: l
                                                                      real(8), intent (in) :: d
                                                                      real(8) :: tmp
                                                                      if (((((m_m * d_m) / (2.0d0 * d)) ** 2.0d0) * (h / l)) <= (-4d+188)) then
                                                                          tmp = (((-0.125d0) * (d_m * d_m)) / d) * ((m_m * (h * (m_m * w0))) / (d * l))
                                                                      else
                                                                          tmp = w0 * 1.0d0
                                                                      end if
                                                                      code = tmp
                                                                  end function
                                                                  
                                                                  D_m = Math.abs(D);
                                                                  M_m = Math.abs(M);
                                                                  assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
                                                                  public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                                  	double tmp;
                                                                  	if ((Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188) {
                                                                  		tmp = ((-0.125 * (D_m * D_m)) / d) * ((M_m * (h * (M_m * w0))) / (d * l));
                                                                  	} else {
                                                                  		tmp = w0 * 1.0;
                                                                  	}
                                                                  	return tmp;
                                                                  }
                                                                  
                                                                  D_m = math.fabs(D)
                                                                  M_m = math.fabs(M)
                                                                  [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d])
                                                                  def code(w0, M_m, D_m, h, l, d):
                                                                  	tmp = 0
                                                                  	if (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188:
                                                                  		tmp = ((-0.125 * (D_m * D_m)) / d) * ((M_m * (h * (M_m * w0))) / (d * l))
                                                                  	else:
                                                                  		tmp = w0 * 1.0
                                                                  	return tmp
                                                                  
                                                                  D_m = abs(D)
                                                                  M_m = abs(M)
                                                                  w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                                                                  function code(w0, M_m, D_m, h, l, d)
                                                                  	tmp = 0.0
                                                                  	if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -4e+188)
                                                                  		tmp = Float64(Float64(Float64(-0.125 * Float64(D_m * D_m)) / d) * Float64(Float64(M_m * Float64(h * Float64(M_m * w0))) / Float64(d * l)));
                                                                  	else
                                                                  		tmp = Float64(w0 * 1.0);
                                                                  	end
                                                                  	return tmp
                                                                  end
                                                                  
                                                                  D_m = abs(D);
                                                                  M_m = abs(M);
                                                                  w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
                                                                  function tmp_2 = code(w0, M_m, D_m, h, l, d)
                                                                  	tmp = 0.0;
                                                                  	if (((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l)) <= -4e+188)
                                                                  		tmp = ((-0.125 * (D_m * D_m)) / d) * ((M_m * (h * (M_m * w0))) / (d * l));
                                                                  	else
                                                                  		tmp = w0 * 1.0;
                                                                  	end
                                                                  	tmp_2 = tmp;
                                                                  end
                                                                  
                                                                  D_m = N[Abs[D], $MachinePrecision]
                                                                  M_m = N[Abs[M], $MachinePrecision]
                                                                  NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                  code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -4e+188], N[(N[(N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(M$95$m * N[(h * N[(M$95$m * w0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
                                                                  
                                                                  \begin{array}{l}
                                                                  D_m = \left|D\right|
                                                                  \\
                                                                  M_m = \left|M\right|
                                                                  \\
                                                                  [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                                                                  \\
                                                                  \begin{array}{l}
                                                                  \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{+188}:\\
                                                                  \;\;\;\;\frac{-0.125 \cdot \left(D\_m \cdot D\_m\right)}{d} \cdot \frac{M\_m \cdot \left(h \cdot \left(M\_m \cdot w0\right)\right)}{d \cdot \ell}\\
                                                                  
                                                                  \mathbf{else}:\\
                                                                  \;\;\;\;w0 \cdot 1\\
                                                                  
                                                                  
                                                                  \end{array}
                                                                  \end{array}
                                                                  
                                                                  Derivation
                                                                  1. Split input into 2 regimes
                                                                  2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.0000000000000001e188

                                                                    1. Initial program 61.0%

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

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

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

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

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

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

                                                                        \[\leadsto {D}^{2} \cdot \color{blue}{\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}\right)} + w0 \]
                                                                      6. lower-fma.f64N/A

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

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

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

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

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

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

                                                                        1. Initial program 89.8%

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

                                                                          \[\leadsto w0 \cdot \color{blue}{1} \]
                                                                        4. Step-by-step derivation
                                                                          1. Applied rewrites91.0%

                                                                            \[\leadsto w0 \cdot \color{blue}{1} \]
                                                                        5. Recombined 2 regimes into one program.
                                                                        6. Add Preprocessing

                                                                        Alternative 16: 79.7% accurate, 0.8× speedup?

                                                                        \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{+188}:\\ \;\;\;\;\mathsf{fma}\left(D\_m \cdot D\_m, \frac{-0.125 \cdot \left(h \cdot \left(M\_m \cdot \left(M\_m \cdot w0\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)}, w0\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
                                                                        D_m = (fabs.f64 D)
                                                                        M_m = (fabs.f64 M)
                                                                        NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                        (FPCore (w0 M_m D_m h l d)
                                                                         :precision binary64
                                                                         (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -4e+188)
                                                                           (fma (* D_m D_m) (/ (* -0.125 (* h (* M_m (* M_m w0)))) (* d (* d l))) w0)
                                                                           (* w0 1.0)))
                                                                        D_m = fabs(D);
                                                                        M_m = fabs(M);
                                                                        assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                                                                        double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                                        	double tmp;
                                                                        	if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188) {
                                                                        		tmp = fma((D_m * D_m), ((-0.125 * (h * (M_m * (M_m * w0)))) / (d * (d * l))), w0);
                                                                        	} else {
                                                                        		tmp = w0 * 1.0;
                                                                        	}
                                                                        	return tmp;
                                                                        }
                                                                        
                                                                        D_m = abs(D)
                                                                        M_m = abs(M)
                                                                        w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                                                                        function code(w0, M_m, D_m, h, l, d)
                                                                        	tmp = 0.0
                                                                        	if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -4e+188)
                                                                        		tmp = fma(Float64(D_m * D_m), Float64(Float64(-0.125 * Float64(h * Float64(M_m * Float64(M_m * w0)))) / Float64(d * Float64(d * l))), w0);
                                                                        	else
                                                                        		tmp = Float64(w0 * 1.0);
                                                                        	end
                                                                        	return tmp
                                                                        end
                                                                        
                                                                        D_m = N[Abs[D], $MachinePrecision]
                                                                        M_m = N[Abs[M], $MachinePrecision]
                                                                        NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                        code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -4e+188], N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(-0.125 * N[(h * N[(M$95$m * N[(M$95$m * w0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + w0), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
                                                                        
                                                                        \begin{array}{l}
                                                                        D_m = \left|D\right|
                                                                        \\
                                                                        M_m = \left|M\right|
                                                                        \\
                                                                        [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                                                                        \\
                                                                        \begin{array}{l}
                                                                        \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{+188}:\\
                                                                        \;\;\;\;\mathsf{fma}\left(D\_m \cdot D\_m, \frac{-0.125 \cdot \left(h \cdot \left(M\_m \cdot \left(M\_m \cdot w0\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)}, w0\right)\\
                                                                        
                                                                        \mathbf{else}:\\
                                                                        \;\;\;\;w0 \cdot 1\\
                                                                        
                                                                        
                                                                        \end{array}
                                                                        \end{array}
                                                                        
                                                                        Derivation
                                                                        1. Split input into 2 regimes
                                                                        2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.0000000000000001e188

                                                                          1. Initial program 61.0%

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

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

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

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

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

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

                                                                              \[\leadsto {D}^{2} \cdot \color{blue}{\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}\right)} + w0 \]
                                                                            6. lower-fma.f64N/A

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

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

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

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

                                                                            1. Initial program 89.8%

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

                                                                              \[\leadsto w0 \cdot \color{blue}{1} \]
                                                                            4. Step-by-step derivation
                                                                              1. Applied rewrites91.0%

                                                                                \[\leadsto w0 \cdot \color{blue}{1} \]
                                                                            5. Recombined 2 regimes into one program.
                                                                            6. Final simplification77.8%

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

                                                                            Alternative 17: 80.1% accurate, 0.8× speedup?

                                                                            \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -1.5 \cdot 10^{+297}:\\ \;\;\;\;\frac{h \cdot \left(w0 \cdot \left(M\_m \cdot \left(M\_m \cdot \left(-0.125 \cdot \left(D\_m \cdot D\_m\right)\right)\right)\right)\right)}{\ell \cdot \left(d \cdot d\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
                                                                            D_m = (fabs.f64 D)
                                                                            M_m = (fabs.f64 M)
                                                                            NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                            (FPCore (w0 M_m D_m h l d)
                                                                             :precision binary64
                                                                             (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -1.5e+297)
                                                                               (/ (* h (* w0 (* M_m (* M_m (* -0.125 (* D_m D_m)))))) (* l (* d d)))
                                                                               (* w0 1.0)))
                                                                            D_m = fabs(D);
                                                                            M_m = fabs(M);
                                                                            assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                                                                            double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                                            	double tmp;
                                                                            	if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -1.5e+297) {
                                                                            		tmp = (h * (w0 * (M_m * (M_m * (-0.125 * (D_m * D_m)))))) / (l * (d * d));
                                                                            	} else {
                                                                            		tmp = w0 * 1.0;
                                                                            	}
                                                                            	return tmp;
                                                                            }
                                                                            
                                                                            D_m = abs(d)
                                                                            M_m = abs(m)
                                                                            NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                            real(8) function code(w0, m_m, d_m, h, l, d)
                                                                                real(8), intent (in) :: w0
                                                                                real(8), intent (in) :: m_m
                                                                                real(8), intent (in) :: d_m
                                                                                real(8), intent (in) :: h
                                                                                real(8), intent (in) :: l
                                                                                real(8), intent (in) :: d
                                                                                real(8) :: tmp
                                                                                if (((((m_m * d_m) / (2.0d0 * d)) ** 2.0d0) * (h / l)) <= (-1.5d+297)) then
                                                                                    tmp = (h * (w0 * (m_m * (m_m * ((-0.125d0) * (d_m * d_m)))))) / (l * (d * d))
                                                                                else
                                                                                    tmp = w0 * 1.0d0
                                                                                end if
                                                                                code = tmp
                                                                            end function
                                                                            
                                                                            D_m = Math.abs(D);
                                                                            M_m = Math.abs(M);
                                                                            assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
                                                                            public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                                            	double tmp;
                                                                            	if ((Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -1.5e+297) {
                                                                            		tmp = (h * (w0 * (M_m * (M_m * (-0.125 * (D_m * D_m)))))) / (l * (d * d));
                                                                            	} else {
                                                                            		tmp = w0 * 1.0;
                                                                            	}
                                                                            	return tmp;
                                                                            }
                                                                            
                                                                            D_m = math.fabs(D)
                                                                            M_m = math.fabs(M)
                                                                            [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d])
                                                                            def code(w0, M_m, D_m, h, l, d):
                                                                            	tmp = 0
                                                                            	if (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -1.5e+297:
                                                                            		tmp = (h * (w0 * (M_m * (M_m * (-0.125 * (D_m * D_m)))))) / (l * (d * d))
                                                                            	else:
                                                                            		tmp = w0 * 1.0
                                                                            	return tmp
                                                                            
                                                                            D_m = abs(D)
                                                                            M_m = abs(M)
                                                                            w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                                                                            function code(w0, M_m, D_m, h, l, d)
                                                                            	tmp = 0.0
                                                                            	if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -1.5e+297)
                                                                            		tmp = Float64(Float64(h * Float64(w0 * Float64(M_m * Float64(M_m * Float64(-0.125 * Float64(D_m * D_m)))))) / Float64(l * Float64(d * d)));
                                                                            	else
                                                                            		tmp = Float64(w0 * 1.0);
                                                                            	end
                                                                            	return tmp
                                                                            end
                                                                            
                                                                            D_m = abs(D);
                                                                            M_m = abs(M);
                                                                            w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
                                                                            function tmp_2 = code(w0, M_m, D_m, h, l, d)
                                                                            	tmp = 0.0;
                                                                            	if (((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l)) <= -1.5e+297)
                                                                            		tmp = (h * (w0 * (M_m * (M_m * (-0.125 * (D_m * D_m)))))) / (l * (d * d));
                                                                            	else
                                                                            		tmp = w0 * 1.0;
                                                                            	end
                                                                            	tmp_2 = tmp;
                                                                            end
                                                                            
                                                                            D_m = N[Abs[D], $MachinePrecision]
                                                                            M_m = N[Abs[M], $MachinePrecision]
                                                                            NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                            code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -1.5e+297], N[(N[(h * N[(w0 * N[(M$95$m * N[(M$95$m * N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
                                                                            
                                                                            \begin{array}{l}
                                                                            D_m = \left|D\right|
                                                                            \\
                                                                            M_m = \left|M\right|
                                                                            \\
                                                                            [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                                                                            \\
                                                                            \begin{array}{l}
                                                                            \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -1.5 \cdot 10^{+297}:\\
                                                                            \;\;\;\;\frac{h \cdot \left(w0 \cdot \left(M\_m \cdot \left(M\_m \cdot \left(-0.125 \cdot \left(D\_m \cdot D\_m\right)\right)\right)\right)\right)}{\ell \cdot \left(d \cdot d\right)}\\
                                                                            
                                                                            \mathbf{else}:\\
                                                                            \;\;\;\;w0 \cdot 1\\
                                                                            
                                                                            
                                                                            \end{array}
                                                                            \end{array}
                                                                            
                                                                            Derivation
                                                                            1. Split input into 2 regimes
                                                                            2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -1.49999999999999988e297

                                                                              1. Initial program 58.9%

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

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

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

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

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

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

                                                                                  \[\leadsto {D}^{2} \cdot \color{blue}{\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}\right)} + w0 \]
                                                                                6. lower-fma.f64N/A

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

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

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

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

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

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

                                                                                  1. Initial program 90.0%

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

                                                                                    \[\leadsto w0 \cdot \color{blue}{1} \]
                                                                                  4. Step-by-step derivation
                                                                                    1. Applied rewrites89.1%

                                                                                      \[\leadsto w0 \cdot \color{blue}{1} \]
                                                                                  5. Recombined 2 regimes into one program.
                                                                                  6. Final simplification77.4%

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

                                                                                  Alternative 18: 79.9% accurate, 0.8× speedup?

                                                                                  \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{+188}:\\ \;\;\;\;D\_m \cdot \left(D\_m \cdot \left(\left(M\_m \cdot \left(h \cdot \left(M\_m \cdot w0\right)\right)\right) \cdot \frac{-0.125}{\ell \cdot \left(d \cdot d\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \end{array} \]
                                                                                  D_m = (fabs.f64 D)
                                                                                  M_m = (fabs.f64 M)
                                                                                  NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                                  (FPCore (w0 M_m D_m h l d)
                                                                                   :precision binary64
                                                                                   (if (<= (* (pow (/ (* M_m D_m) (* 2.0 d)) 2.0) (/ h l)) -4e+188)
                                                                                     (* D_m (* D_m (* (* M_m (* h (* M_m w0))) (/ -0.125 (* l (* d d))))))
                                                                                     (* w0 1.0)))
                                                                                  D_m = fabs(D);
                                                                                  M_m = fabs(M);
                                                                                  assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                                                                                  double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                                                  	double tmp;
                                                                                  	if ((pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188) {
                                                                                  		tmp = D_m * (D_m * ((M_m * (h * (M_m * w0))) * (-0.125 / (l * (d * d)))));
                                                                                  	} else {
                                                                                  		tmp = w0 * 1.0;
                                                                                  	}
                                                                                  	return tmp;
                                                                                  }
                                                                                  
                                                                                  D_m = abs(d)
                                                                                  M_m = abs(m)
                                                                                  NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                                  real(8) function code(w0, m_m, d_m, h, l, d)
                                                                                      real(8), intent (in) :: w0
                                                                                      real(8), intent (in) :: m_m
                                                                                      real(8), intent (in) :: d_m
                                                                                      real(8), intent (in) :: h
                                                                                      real(8), intent (in) :: l
                                                                                      real(8), intent (in) :: d
                                                                                      real(8) :: tmp
                                                                                      if (((((m_m * d_m) / (2.0d0 * d)) ** 2.0d0) * (h / l)) <= (-4d+188)) then
                                                                                          tmp = d_m * (d_m * ((m_m * (h * (m_m * w0))) * ((-0.125d0) / (l * (d * d)))))
                                                                                      else
                                                                                          tmp = w0 * 1.0d0
                                                                                      end if
                                                                                      code = tmp
                                                                                  end function
                                                                                  
                                                                                  D_m = Math.abs(D);
                                                                                  M_m = Math.abs(M);
                                                                                  assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
                                                                                  public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                                                  	double tmp;
                                                                                  	if ((Math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188) {
                                                                                  		tmp = D_m * (D_m * ((M_m * (h * (M_m * w0))) * (-0.125 / (l * (d * d)))));
                                                                                  	} else {
                                                                                  		tmp = w0 * 1.0;
                                                                                  	}
                                                                                  	return tmp;
                                                                                  }
                                                                                  
                                                                                  D_m = math.fabs(D)
                                                                                  M_m = math.fabs(M)
                                                                                  [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d])
                                                                                  def code(w0, M_m, D_m, h, l, d):
                                                                                  	tmp = 0
                                                                                  	if (math.pow(((M_m * D_m) / (2.0 * d)), 2.0) * (h / l)) <= -4e+188:
                                                                                  		tmp = D_m * (D_m * ((M_m * (h * (M_m * w0))) * (-0.125 / (l * (d * d)))))
                                                                                  	else:
                                                                                  		tmp = w0 * 1.0
                                                                                  	return tmp
                                                                                  
                                                                                  D_m = abs(D)
                                                                                  M_m = abs(M)
                                                                                  w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                                                                                  function code(w0, M_m, D_m, h, l, d)
                                                                                  	tmp = 0.0
                                                                                  	if (Float64((Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)) <= -4e+188)
                                                                                  		tmp = Float64(D_m * Float64(D_m * Float64(Float64(M_m * Float64(h * Float64(M_m * w0))) * Float64(-0.125 / Float64(l * Float64(d * d))))));
                                                                                  	else
                                                                                  		tmp = Float64(w0 * 1.0);
                                                                                  	end
                                                                                  	return tmp
                                                                                  end
                                                                                  
                                                                                  D_m = abs(D);
                                                                                  M_m = abs(M);
                                                                                  w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
                                                                                  function tmp_2 = code(w0, M_m, D_m, h, l, d)
                                                                                  	tmp = 0.0;
                                                                                  	if (((((M_m * D_m) / (2.0 * d)) ^ 2.0) * (h / l)) <= -4e+188)
                                                                                  		tmp = D_m * (D_m * ((M_m * (h * (M_m * w0))) * (-0.125 / (l * (d * d)))));
                                                                                  	else
                                                                                  		tmp = w0 * 1.0;
                                                                                  	end
                                                                                  	tmp_2 = tmp;
                                                                                  end
                                                                                  
                                                                                  D_m = N[Abs[D], $MachinePrecision]
                                                                                  M_m = N[Abs[M], $MachinePrecision]
                                                                                  NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                                  code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -4e+188], N[(D$95$m * N[(D$95$m * N[(N[(M$95$m * N[(h * N[(M$95$m * w0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.125 / N[(l * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
                                                                                  
                                                                                  \begin{array}{l}
                                                                                  D_m = \left|D\right|
                                                                                  \\
                                                                                  M_m = \left|M\right|
                                                                                  \\
                                                                                  [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                                                                                  \\
                                                                                  \begin{array}{l}
                                                                                  \mathbf{if}\;{\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \leq -4 \cdot 10^{+188}:\\
                                                                                  \;\;\;\;D\_m \cdot \left(D\_m \cdot \left(\left(M\_m \cdot \left(h \cdot \left(M\_m \cdot w0\right)\right)\right) \cdot \frac{-0.125}{\ell \cdot \left(d \cdot d\right)}\right)\right)\\
                                                                                  
                                                                                  \mathbf{else}:\\
                                                                                  \;\;\;\;w0 \cdot 1\\
                                                                                  
                                                                                  
                                                                                  \end{array}
                                                                                  \end{array}
                                                                                  
                                                                                  Derivation
                                                                                  1. Split input into 2 regimes
                                                                                  2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -4.0000000000000001e188

                                                                                    1. Initial program 61.0%

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

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

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

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

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

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

                                                                                        \[\leadsto {D}^{2} \cdot \color{blue}{\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot \left(h \cdot w0\right)}{{d}^{2} \cdot \ell}\right)} + w0 \]
                                                                                      6. lower-fma.f64N/A

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

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

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

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

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

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

                                                                                      1. Initial program 89.8%

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

                                                                                        \[\leadsto w0 \cdot \color{blue}{1} \]
                                                                                      4. Step-by-step derivation
                                                                                        1. Applied rewrites91.0%

                                                                                          \[\leadsto w0 \cdot \color{blue}{1} \]
                                                                                      5. Recombined 2 regimes into one program.
                                                                                      6. Final simplification77.9%

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

                                                                                      Alternative 19: 83.5% accurate, 1.9× speedup?

                                                                                      \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;M\_m \leq 2 \cdot 10^{-140}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{D\_m \cdot \left(M\_m \cdot h\right)}{-2 \cdot \left(d \cdot \ell\right)}, 0.5 \cdot \left(M\_m \cdot \frac{D\_m}{d}\right), 1\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\frac{D\_m}{d} \cdot \left(0.25 \cdot \left(M\_m \cdot \left(-M\_m\right)\right)\right)\right), \frac{D\_m}{d}, 1\right)}\\ \end{array} \end{array} \]
                                                                                      D_m = (fabs.f64 D)
                                                                                      M_m = (fabs.f64 M)
                                                                                      NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                                      (FPCore (w0 M_m D_m h l d)
                                                                                       :precision binary64
                                                                                       (if (<= M_m 2e-140)
                                                                                         (*
                                                                                          w0
                                                                                          (sqrt
                                                                                           (fma
                                                                                            (/ (* D_m (* M_m h)) (* -2.0 (* d l)))
                                                                                            (* 0.5 (* M_m (/ D_m d)))
                                                                                            1.0)))
                                                                                         (*
                                                                                          w0
                                                                                          (sqrt
                                                                                           (fma (* (/ h l) (* (/ D_m d) (* 0.25 (* M_m (- M_m))))) (/ D_m d) 1.0)))))
                                                                                      D_m = fabs(D);
                                                                                      M_m = fabs(M);
                                                                                      assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                                                                                      double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                                                      	double tmp;
                                                                                      	if (M_m <= 2e-140) {
                                                                                      		tmp = w0 * sqrt(fma(((D_m * (M_m * h)) / (-2.0 * (d * l))), (0.5 * (M_m * (D_m / d))), 1.0));
                                                                                      	} else {
                                                                                      		tmp = w0 * sqrt(fma(((h / l) * ((D_m / d) * (0.25 * (M_m * -M_m)))), (D_m / d), 1.0));
                                                                                      	}
                                                                                      	return tmp;
                                                                                      }
                                                                                      
                                                                                      D_m = abs(D)
                                                                                      M_m = abs(M)
                                                                                      w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                                                                                      function code(w0, M_m, D_m, h, l, d)
                                                                                      	tmp = 0.0
                                                                                      	if (M_m <= 2e-140)
                                                                                      		tmp = Float64(w0 * sqrt(fma(Float64(Float64(D_m * Float64(M_m * h)) / Float64(-2.0 * Float64(d * l))), Float64(0.5 * Float64(M_m * Float64(D_m / d))), 1.0)));
                                                                                      	else
                                                                                      		tmp = Float64(w0 * sqrt(fma(Float64(Float64(h / l) * Float64(Float64(D_m / d) * Float64(0.25 * Float64(M_m * Float64(-M_m))))), Float64(D_m / d), 1.0)));
                                                                                      	end
                                                                                      	return tmp
                                                                                      end
                                                                                      
                                                                                      D_m = N[Abs[D], $MachinePrecision]
                                                                                      M_m = N[Abs[M], $MachinePrecision]
                                                                                      NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                                      code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[M$95$m, 2e-140], N[(w0 * N[Sqrt[N[(N[(N[(D$95$m * N[(M$95$m * h), $MachinePrecision]), $MachinePrecision] / N[(-2.0 * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 * N[(M$95$m * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(N[(h / l), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * N[(0.25 * N[(M$95$m * (-M$95$m)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
                                                                                      
                                                                                      \begin{array}{l}
                                                                                      D_m = \left|D\right|
                                                                                      \\
                                                                                      M_m = \left|M\right|
                                                                                      \\
                                                                                      [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                                                                                      \\
                                                                                      \begin{array}{l}
                                                                                      \mathbf{if}\;M\_m \leq 2 \cdot 10^{-140}:\\
                                                                                      \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{D\_m \cdot \left(M\_m \cdot h\right)}{-2 \cdot \left(d \cdot \ell\right)}, 0.5 \cdot \left(M\_m \cdot \frac{D\_m}{d}\right), 1\right)}\\
                                                                                      
                                                                                      \mathbf{else}:\\
                                                                                      \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\frac{D\_m}{d} \cdot \left(0.25 \cdot \left(M\_m \cdot \left(-M\_m\right)\right)\right)\right), \frac{D\_m}{d}, 1\right)}\\
                                                                                      
                                                                                      
                                                                                      \end{array}
                                                                                      \end{array}
                                                                                      
                                                                                      Derivation
                                                                                      1. Split input into 2 regimes
                                                                                      2. if M < 2e-140

                                                                                        1. Initial program 82.5%

                                                                                          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
                                                                                        2. Add Preprocessing
                                                                                        3. Step-by-step derivation
                                                                                          1. lift--.f64N/A

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

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
                                                                                          3. +-commutativeN/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) + 1}} \]
                                                                                          4. lift-*.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\right)\right) + 1} \]
                                                                                          5. distribute-lft-neg-inN/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)\right) \cdot \frac{h}{\ell}} + 1} \]
                                                                                          6. lift-pow.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
                                                                                          7. unpow2N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
                                                                                          8. distribute-rgt-neg-inN/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right)\right)} \cdot \frac{h}{\ell} + 1} \]
                                                                                          9. associate-*l*N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}\right)} + 1} \]
                                                                                          10. lower-fma.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}, 1\right)}} \]
                                                                                        4. Applied rewrites84.3%

                                                                                          \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \frac{M \cdot D}{d \cdot -2} \cdot \frac{h}{\ell}, 1\right)}} \]
                                                                                        5. Step-by-step derivation
                                                                                          1. lift-fma.f64N/A

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

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\frac{M \cdot D}{d \cdot -2} \cdot \frac{h}{\ell}\right) \cdot \frac{M \cdot D}{2 \cdot d}} + 1} \]
                                                                                          3. lower-fma.f6484.3

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

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

                                                                                        if 2e-140 < M

                                                                                        1. Initial program 78.3%

                                                                                          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
                                                                                        2. Add Preprocessing
                                                                                        3. Step-by-step derivation
                                                                                          1. lift--.f64N/A

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

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
                                                                                          3. +-commutativeN/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) + 1}} \]
                                                                                        4. Applied rewrites71.7%

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

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

                                                                                      Alternative 20: 84.3% accurate, 1.9× speedup?

                                                                                      \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;M\_m \leq 3.4 \cdot 10^{+39}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M\_m \cdot D\_m}{2 \cdot d}, \left(M\_m \cdot D\_m\right) \cdot \frac{h}{-2 \cdot \left(d \cdot \ell\right)}, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(M\_m \cdot M\_m, \frac{\frac{D\_m \cdot -0.25}{\ell} \cdot \left(D\_m \cdot \frac{h}{d}\right)}{d}, 1\right)}\\ \end{array} \end{array} \]
                                                                                      D_m = (fabs.f64 D)
                                                                                      M_m = (fabs.f64 M)
                                                                                      NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                                      (FPCore (w0 M_m D_m h l d)
                                                                                       :precision binary64
                                                                                       (if (<= M_m 3.4e+39)
                                                                                         (*
                                                                                          w0
                                                                                          (sqrt
                                                                                           (fma
                                                                                            (/ (* M_m D_m) (* 2.0 d))
                                                                                            (* (* M_m D_m) (/ h (* -2.0 (* d l))))
                                                                                            1.0)))
                                                                                         (*
                                                                                          w0
                                                                                          (sqrt
                                                                                           (fma (* M_m M_m) (/ (* (/ (* D_m -0.25) l) (* D_m (/ h d))) d) 1.0)))))
                                                                                      D_m = fabs(D);
                                                                                      M_m = fabs(M);
                                                                                      assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                                                                                      double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                                                      	double tmp;
                                                                                      	if (M_m <= 3.4e+39) {
                                                                                      		tmp = w0 * sqrt(fma(((M_m * D_m) / (2.0 * d)), ((M_m * D_m) * (h / (-2.0 * (d * l)))), 1.0));
                                                                                      	} else {
                                                                                      		tmp = w0 * sqrt(fma((M_m * M_m), ((((D_m * -0.25) / l) * (D_m * (h / d))) / d), 1.0));
                                                                                      	}
                                                                                      	return tmp;
                                                                                      }
                                                                                      
                                                                                      D_m = abs(D)
                                                                                      M_m = abs(M)
                                                                                      w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                                                                                      function code(w0, M_m, D_m, h, l, d)
                                                                                      	tmp = 0.0
                                                                                      	if (M_m <= 3.4e+39)
                                                                                      		tmp = Float64(w0 * sqrt(fma(Float64(Float64(M_m * D_m) / Float64(2.0 * d)), Float64(Float64(M_m * D_m) * Float64(h / Float64(-2.0 * Float64(d * l)))), 1.0)));
                                                                                      	else
                                                                                      		tmp = Float64(w0 * sqrt(fma(Float64(M_m * M_m), Float64(Float64(Float64(Float64(D_m * -0.25) / l) * Float64(D_m * Float64(h / d))) / d), 1.0)));
                                                                                      	end
                                                                                      	return tmp
                                                                                      end
                                                                                      
                                                                                      D_m = N[Abs[D], $MachinePrecision]
                                                                                      M_m = N[Abs[M], $MachinePrecision]
                                                                                      NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                                      code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[M$95$m, 3.4e+39], N[(w0 * N[Sqrt[N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m * D$95$m), $MachinePrecision] * N[(h / N[(-2.0 * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(M$95$m * M$95$m), $MachinePrecision] * N[(N[(N[(N[(D$95$m * -0.25), $MachinePrecision] / l), $MachinePrecision] * N[(D$95$m * N[(h / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
                                                                                      
                                                                                      \begin{array}{l}
                                                                                      D_m = \left|D\right|
                                                                                      \\
                                                                                      M_m = \left|M\right|
                                                                                      \\
                                                                                      [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                                                                                      \\
                                                                                      \begin{array}{l}
                                                                                      \mathbf{if}\;M\_m \leq 3.4 \cdot 10^{+39}:\\
                                                                                      \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M\_m \cdot D\_m}{2 \cdot d}, \left(M\_m \cdot D\_m\right) \cdot \frac{h}{-2 \cdot \left(d \cdot \ell\right)}, 1\right)}\\
                                                                                      
                                                                                      \mathbf{else}:\\
                                                                                      \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(M\_m \cdot M\_m, \frac{\frac{D\_m \cdot -0.25}{\ell} \cdot \left(D\_m \cdot \frac{h}{d}\right)}{d}, 1\right)}\\
                                                                                      
                                                                                      
                                                                                      \end{array}
                                                                                      \end{array}
                                                                                      
                                                                                      Derivation
                                                                                      1. Split input into 2 regimes
                                                                                      2. if M < 3.3999999999999999e39

                                                                                        1. Initial program 83.2%

                                                                                          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
                                                                                        2. Add Preprocessing
                                                                                        3. Step-by-step derivation
                                                                                          1. lift--.f64N/A

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

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
                                                                                          3. +-commutativeN/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) + 1}} \]
                                                                                          4. lift-*.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\right)\right) + 1} \]
                                                                                          5. distribute-lft-neg-inN/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)\right) \cdot \frac{h}{\ell}} + 1} \]
                                                                                          6. lift-pow.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
                                                                                          7. unpow2N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
                                                                                          8. distribute-rgt-neg-inN/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right)\right)} \cdot \frac{h}{\ell} + 1} \]
                                                                                          9. associate-*l*N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}\right)} + 1} \]
                                                                                          10. lower-fma.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}, 1\right)}} \]
                                                                                        4. Applied rewrites85.1%

                                                                                          \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \frac{M \cdot D}{d \cdot -2} \cdot \frac{h}{\ell}, 1\right)}} \]
                                                                                        5. Step-by-step derivation
                                                                                          1. lift-*.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \color{blue}{\frac{M \cdot D}{d \cdot -2} \cdot \frac{h}{\ell}}, 1\right)} \]
                                                                                          2. lift-/.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \color{blue}{\frac{M \cdot D}{d \cdot -2}} \cdot \frac{h}{\ell}, 1\right)} \]
                                                                                          3. lift-/.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \frac{M \cdot D}{d \cdot -2} \cdot \color{blue}{\frac{h}{\ell}}, 1\right)} \]
                                                                                          4. frac-timesN/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \color{blue}{\frac{\left(M \cdot D\right) \cdot h}{\left(d \cdot -2\right) \cdot \ell}}, 1\right)} \]
                                                                                          5. associate-/l*N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \color{blue}{\left(M \cdot D\right) \cdot \frac{h}{\left(d \cdot -2\right) \cdot \ell}}, 1\right)} \]
                                                                                          6. lower-*.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \color{blue}{\left(M \cdot D\right) \cdot \frac{h}{\left(d \cdot -2\right) \cdot \ell}}, 1\right)} \]
                                                                                          7. lower-/.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(M \cdot D\right) \cdot \color{blue}{\frac{h}{\left(d \cdot -2\right) \cdot \ell}}, 1\right)} \]
                                                                                          8. lift-*.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(M \cdot D\right) \cdot \frac{h}{\color{blue}{\left(d \cdot -2\right)} \cdot \ell}, 1\right)} \]
                                                                                          9. *-commutativeN/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(M \cdot D\right) \cdot \frac{h}{\color{blue}{\left(-2 \cdot d\right)} \cdot \ell}, 1\right)} \]
                                                                                          10. associate-*l*N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(M \cdot D\right) \cdot \frac{h}{\color{blue}{-2 \cdot \left(d \cdot \ell\right)}}, 1\right)} \]
                                                                                          11. lower-*.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(M \cdot D\right) \cdot \frac{h}{\color{blue}{-2 \cdot \left(d \cdot \ell\right)}}, 1\right)} \]
                                                                                          12. lower-*.f6485.2

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

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

                                                                                        if 3.3999999999999999e39 < M

                                                                                        1. Initial program 71.4%

                                                                                          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
                                                                                        2. Add Preprocessing
                                                                                        3. Step-by-step derivation
                                                                                          1. lift-*.f64N/A

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

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

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

                                                                                            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\frac{\ell}{h}}}} \]
                                                                                          5. lift-pow.f64N/A

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

                                                                                            \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}} \]
                                                                                          7. lift-/.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}}{\frac{\ell}{h}}} \]
                                                                                          8. lift-/.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \color{blue}{\frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}} \]
                                                                                          9. lift-*.f64N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{\color{blue}{2 \cdot d}}}{\frac{\ell}{h}}} \]
                                                                                          10. associate-/r*N/A

                                                                                            \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \color{blue}{\frac{\frac{M \cdot D}{2}}{d}}}{\frac{\ell}{h}}} \]
                                                                                          11. frac-timesN/A

                                                                                            \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{\left(M \cdot D\right) \cdot \frac{M \cdot D}{2}}{\left(2 \cdot d\right) \cdot d}}}{\frac{\ell}{h}}} \]
                                                                                          12. *-commutativeN/A

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

                                                                                            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M \cdot D}{2} \cdot \left(M \cdot D\right)}{\frac{\ell}{h} \cdot \left(\left(2 \cdot d\right) \cdot d\right)}}} \]
                                                                                          14. lower-/.f64N/A

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

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

                                                                                          \[\leadsto w0 \cdot \sqrt{\color{blue}{{M}^{2} \cdot \left(\frac{1}{{M}^{2}} - \frac{1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right)}} \]
                                                                                        6. Step-by-step derivation
                                                                                          1. cancel-sign-sub-invN/A

                                                                                            \[\leadsto w0 \cdot \sqrt{{M}^{2} \cdot \color{blue}{\left(\frac{1}{{M}^{2}} + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right)}} \]
                                                                                          2. metadata-evalN/A

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

                                                                                            \[\leadsto w0 \cdot \sqrt{{M}^{2} \cdot \color{blue}{\left(\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}} \]
                                                                                          4. distribute-lft-inN/A

                                                                                            \[\leadsto w0 \cdot \sqrt{\color{blue}{{M}^{2} \cdot \left(\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) + {M}^{2} \cdot \frac{1}{{M}^{2}}}} \]
                                                                                          5. rgt-mult-inverseN/A

                                                                                            \[\leadsto w0 \cdot \sqrt{{M}^{2} \cdot \left(\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) + \color{blue}{1}} \]
                                                                                          6. lower-fma.f64N/A

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

                                                                                          \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(M \cdot M, \frac{-0.25 \cdot \left(D \cdot \left(D \cdot h\right)\right)}{\ell \cdot \left(d \cdot d\right)}, 1\right)}} \]
                                                                                        8. Step-by-step derivation
                                                                                          1. Applied rewrites54.4%

                                                                                            \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(M \cdot M, \frac{D \cdot -0.25}{\ell \cdot d} \cdot \color{blue}{\frac{h \cdot D}{d}}, 1\right)} \]
                                                                                          2. Step-by-step derivation
                                                                                            1. Applied rewrites56.6%

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

                                                                                          Alternative 21: 81.6% accurate, 2.1× speedup?

                                                                                          \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq 1.05 \cdot 10^{+52}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot \left(M\_m \cdot \left(M\_m \cdot \left(D\_m \cdot \frac{-0.25}{d \cdot \ell}\right)\right)\right), \frac{D\_m}{d}, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M\_m \cdot D\_m}{d \cdot \left(2 \cdot \left(\ell \cdot \left(d \cdot -2\right)\right)\right)}, \left(M\_m \cdot D\_m\right) \cdot h, 1\right)}\\ \end{array} \end{array} \]
                                                                                          D_m = (fabs.f64 D)
                                                                                          M_m = (fabs.f64 M)
                                                                                          NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                                          (FPCore (w0 M_m D_m h l d)
                                                                                           :precision binary64
                                                                                           (if (<= h 1.05e+52)
                                                                                             (*
                                                                                              w0
                                                                                              (sqrt (fma (* h (* M_m (* M_m (* D_m (/ -0.25 (* d l)))))) (/ D_m d) 1.0)))
                                                                                             (*
                                                                                              w0
                                                                                              (sqrt
                                                                                               (fma
                                                                                                (/ (* M_m D_m) (* d (* 2.0 (* l (* d -2.0)))))
                                                                                                (* (* M_m D_m) h)
                                                                                                1.0)))))
                                                                                          D_m = fabs(D);
                                                                                          M_m = fabs(M);
                                                                                          assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                                                                                          double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                                                          	double tmp;
                                                                                          	if (h <= 1.05e+52) {
                                                                                          		tmp = w0 * sqrt(fma((h * (M_m * (M_m * (D_m * (-0.25 / (d * l)))))), (D_m / d), 1.0));
                                                                                          	} else {
                                                                                          		tmp = w0 * sqrt(fma(((M_m * D_m) / (d * (2.0 * (l * (d * -2.0))))), ((M_m * D_m) * h), 1.0));
                                                                                          	}
                                                                                          	return tmp;
                                                                                          }
                                                                                          
                                                                                          D_m = abs(D)
                                                                                          M_m = abs(M)
                                                                                          w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                                                                                          function code(w0, M_m, D_m, h, l, d)
                                                                                          	tmp = 0.0
                                                                                          	if (h <= 1.05e+52)
                                                                                          		tmp = Float64(w0 * sqrt(fma(Float64(h * Float64(M_m * Float64(M_m * Float64(D_m * Float64(-0.25 / Float64(d * l)))))), Float64(D_m / d), 1.0)));
                                                                                          	else
                                                                                          		tmp = Float64(w0 * sqrt(fma(Float64(Float64(M_m * D_m) / Float64(d * Float64(2.0 * Float64(l * Float64(d * -2.0))))), Float64(Float64(M_m * D_m) * h), 1.0)));
                                                                                          	end
                                                                                          	return tmp
                                                                                          end
                                                                                          
                                                                                          D_m = N[Abs[D], $MachinePrecision]
                                                                                          M_m = N[Abs[M], $MachinePrecision]
                                                                                          NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                                          code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := If[LessEqual[h, 1.05e+52], N[(w0 * N[Sqrt[N[(N[(h * N[(M$95$m * N[(M$95$m * N[(D$95$m * N[(-0.25 / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * N[(2.0 * N[(l * N[(d * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m * D$95$m), $MachinePrecision] * h), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
                                                                                          
                                                                                          \begin{array}{l}
                                                                                          D_m = \left|D\right|
                                                                                          \\
                                                                                          M_m = \left|M\right|
                                                                                          \\
                                                                                          [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                                                                                          \\
                                                                                          \begin{array}{l}
                                                                                          \mathbf{if}\;h \leq 1.05 \cdot 10^{+52}:\\
                                                                                          \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(h \cdot \left(M\_m \cdot \left(M\_m \cdot \left(D\_m \cdot \frac{-0.25}{d \cdot \ell}\right)\right)\right), \frac{D\_m}{d}, 1\right)}\\
                                                                                          
                                                                                          \mathbf{else}:\\
                                                                                          \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{M\_m \cdot D\_m}{d \cdot \left(2 \cdot \left(\ell \cdot \left(d \cdot -2\right)\right)\right)}, \left(M\_m \cdot D\_m\right) \cdot h, 1\right)}\\
                                                                                          
                                                                                          
                                                                                          \end{array}
                                                                                          \end{array}
                                                                                          
                                                                                          Derivation
                                                                                          1. Split input into 2 regimes
                                                                                          2. if h < 1.05e52

                                                                                            1. Initial program 83.3%

                                                                                              \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
                                                                                            2. Add Preprocessing
                                                                                            3. Step-by-step derivation
                                                                                              1. lift-*.f64N/A

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

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

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

                                                                                                \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}{\frac{\ell}{h}}}} \]
                                                                                              5. lift-pow.f64N/A

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

                                                                                                \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}} \]
                                                                                              7. lift-/.f64N/A

                                                                                                \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{M \cdot D}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}}{\frac{\ell}{h}}} \]
                                                                                              8. lift-/.f64N/A

                                                                                                \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \color{blue}{\frac{M \cdot D}{2 \cdot d}}}{\frac{\ell}{h}}} \]
                                                                                              9. lift-*.f64N/A

                                                                                                \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{\color{blue}{2 \cdot d}}}{\frac{\ell}{h}}} \]
                                                                                              10. associate-/r*N/A

                                                                                                \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{2 \cdot d} \cdot \color{blue}{\frac{\frac{M \cdot D}{2}}{d}}}{\frac{\ell}{h}}} \]
                                                                                              11. frac-timesN/A

                                                                                                \[\leadsto w0 \cdot \sqrt{1 - \frac{\color{blue}{\frac{\left(M \cdot D\right) \cdot \frac{M \cdot D}{2}}{\left(2 \cdot d\right) \cdot d}}}{\frac{\ell}{h}}} \]
                                                                                              12. *-commutativeN/A

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

                                                                                                \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M \cdot D}{2} \cdot \left(M \cdot D\right)}{\frac{\ell}{h} \cdot \left(\left(2 \cdot d\right) \cdot d\right)}}} \]
                                                                                              14. lower-/.f64N/A

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

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

                                                                                              \[\leadsto w0 \cdot \sqrt{\color{blue}{{M}^{2} \cdot \left(\frac{1}{{M}^{2}} - \frac{1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right)}} \]
                                                                                            6. Step-by-step derivation
                                                                                              1. cancel-sign-sub-invN/A

                                                                                                \[\leadsto w0 \cdot \sqrt{{M}^{2} \cdot \color{blue}{\left(\frac{1}{{M}^{2}} + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right)}} \]
                                                                                              2. metadata-evalN/A

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

                                                                                                \[\leadsto w0 \cdot \sqrt{{M}^{2} \cdot \color{blue}{\left(\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}} \]
                                                                                              4. distribute-lft-inN/A

                                                                                                \[\leadsto w0 \cdot \sqrt{\color{blue}{{M}^{2} \cdot \left(\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) + {M}^{2} \cdot \frac{1}{{M}^{2}}}} \]
                                                                                              5. rgt-mult-inverseN/A

                                                                                                \[\leadsto w0 \cdot \sqrt{{M}^{2} \cdot \left(\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) + \color{blue}{1}} \]
                                                                                              6. lower-fma.f64N/A

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

                                                                                              \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(M \cdot M, \frac{-0.25 \cdot \left(D \cdot \left(D \cdot h\right)\right)}{\ell \cdot \left(d \cdot d\right)}, 1\right)}} \]
                                                                                            8. Step-by-step derivation
                                                                                              1. Applied rewrites70.8%

                                                                                                \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(M \cdot M, \frac{D \cdot -0.25}{\ell \cdot d} \cdot \color{blue}{\frac{h \cdot D}{d}}, 1\right)} \]
                                                                                              2. Step-by-step derivation
                                                                                                1. Applied rewrites83.9%

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

                                                                                                if 1.05e52 < h

                                                                                                1. Initial program 73.2%

                                                                                                  \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
                                                                                                2. Add Preprocessing
                                                                                                3. Step-by-step derivation
                                                                                                  1. lift--.f64N/A

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

                                                                                                    \[\leadsto w0 \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)}} \]
                                                                                                  3. +-commutativeN/A

                                                                                                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) + 1}} \]
                                                                                                  4. lift-*.f64N/A

                                                                                                    \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\right)\right) + 1} \]
                                                                                                  5. distribute-lft-neg-inN/A

                                                                                                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)\right) \cdot \frac{h}{\ell}} + 1} \]
                                                                                                  6. lift-pow.f64N/A

                                                                                                    \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
                                                                                                  7. unpow2N/A

                                                                                                    \[\leadsto w0 \cdot \sqrt{\left(\mathsf{neg}\left(\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}}\right)\right) \cdot \frac{h}{\ell} + 1} \]
                                                                                                  8. distribute-rgt-neg-inN/A

                                                                                                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right)\right)} \cdot \frac{h}{\ell} + 1} \]
                                                                                                  9. associate-*l*N/A

                                                                                                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}\right)} + 1} \]
                                                                                                  10. lower-fma.f64N/A

                                                                                                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \left(\mathsf{neg}\left(\frac{M \cdot D}{2 \cdot d}\right)\right) \cdot \frac{h}{\ell}, 1\right)}} \]
                                                                                                4. Applied rewrites73.2%

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

                                                                                                  \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{\left(D \cdot \left(M \cdot h\right)\right) \cdot \left(M \cdot D\right)}{\left(-2 \cdot \left(d \cdot \ell\right)\right) \cdot \left(d \cdot 2\right)} + 1}} \]
                                                                                                6. Step-by-step derivation
                                                                                                  1. lift-+.f64N/A

                                                                                                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{\left(D \cdot \left(M \cdot h\right)\right) \cdot \left(M \cdot D\right)}{\left(-2 \cdot \left(d \cdot \ell\right)\right) \cdot \left(d \cdot 2\right)} + 1}} \]
                                                                                                  2. lift-/.f64N/A

                                                                                                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{\left(D \cdot \left(M \cdot h\right)\right) \cdot \left(M \cdot D\right)}{\left(-2 \cdot \left(d \cdot \ell\right)\right) \cdot \left(d \cdot 2\right)}} + 1} \]
                                                                                                  3. lift-*.f64N/A

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

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

                                                                                                    \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{M \cdot D}{\left(-2 \cdot \left(d \cdot \ell\right)\right) \cdot \left(d \cdot 2\right)} \cdot \left(D \cdot \left(M \cdot h\right)\right)} + 1} \]
                                                                                                  6. lower-fma.f64N/A

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

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

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

                                                                                              Alternative 22: 69.1% accurate, 26.2× speedup?

                                                                                              \[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\ \\ w0 \cdot 1 \end{array} \]
                                                                                              D_m = (fabs.f64 D)
                                                                                              M_m = (fabs.f64 M)
                                                                                              NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                                              (FPCore (w0 M_m D_m h l d) :precision binary64 (* w0 1.0))
                                                                                              D_m = fabs(D);
                                                                                              M_m = fabs(M);
                                                                                              assert(w0 < M_m && M_m < D_m && D_m < h && h < l && l < d);
                                                                                              double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                                                              	return w0 * 1.0;
                                                                                              }
                                                                                              
                                                                                              D_m = abs(d)
                                                                                              M_m = abs(m)
                                                                                              NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                                              real(8) function code(w0, m_m, d_m, h, l, d)
                                                                                                  real(8), intent (in) :: w0
                                                                                                  real(8), intent (in) :: m_m
                                                                                                  real(8), intent (in) :: d_m
                                                                                                  real(8), intent (in) :: h
                                                                                                  real(8), intent (in) :: l
                                                                                                  real(8), intent (in) :: d
                                                                                                  code = w0 * 1.0d0
                                                                                              end function
                                                                                              
                                                                                              D_m = Math.abs(D);
                                                                                              M_m = Math.abs(M);
                                                                                              assert w0 < M_m && M_m < D_m && D_m < h && h < l && l < d;
                                                                                              public static double code(double w0, double M_m, double D_m, double h, double l, double d) {
                                                                                              	return w0 * 1.0;
                                                                                              }
                                                                                              
                                                                                              D_m = math.fabs(D)
                                                                                              M_m = math.fabs(M)
                                                                                              [w0, M_m, D_m, h, l, d] = sort([w0, M_m, D_m, h, l, d])
                                                                                              def code(w0, M_m, D_m, h, l, d):
                                                                                              	return w0 * 1.0
                                                                                              
                                                                                              D_m = abs(D)
                                                                                              M_m = abs(M)
                                                                                              w0, M_m, D_m, h, l, d = sort([w0, M_m, D_m, h, l, d])
                                                                                              function code(w0, M_m, D_m, h, l, d)
                                                                                              	return Float64(w0 * 1.0)
                                                                                              end
                                                                                              
                                                                                              D_m = abs(D);
                                                                                              M_m = abs(M);
                                                                                              w0, M_m, D_m, h, l, d = num2cell(sort([w0, M_m, D_m, h, l, d])){:}
                                                                                              function tmp = code(w0, M_m, D_m, h, l, d)
                                                                                              	tmp = w0 * 1.0;
                                                                                              end
                                                                                              
                                                                                              D_m = N[Abs[D], $MachinePrecision]
                                                                                              M_m = N[Abs[M], $MachinePrecision]
                                                                                              NOTE: w0, M_m, D_m, h, l, and d should be sorted in increasing order before calling this function.
                                                                                              code[w0_, M$95$m_, D$95$m_, h_, l_, d_] := N[(w0 * 1.0), $MachinePrecision]
                                                                                              
                                                                                              \begin{array}{l}
                                                                                              D_m = \left|D\right|
                                                                                              \\
                                                                                              M_m = \left|M\right|
                                                                                              \\
                                                                                              [w0, M_m, D_m, h, l, d] = \mathsf{sort}([w0, M_m, D_m, h, l, d])\\
                                                                                              \\
                                                                                              w0 \cdot 1
                                                                                              \end{array}
                                                                                              
                                                                                              Derivation
                                                                                              1. Initial program 81.0%

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

                                                                                                \[\leadsto w0 \cdot \color{blue}{1} \]
                                                                                              4. Step-by-step derivation
                                                                                                1. Applied rewrites64.6%

                                                                                                  \[\leadsto w0 \cdot \color{blue}{1} \]
                                                                                                2. Add Preprocessing

                                                                                                Reproduce

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