Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 81.1% → 89.9%
Time: 16.9s
Alternatives: 17
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 17 alternatives:

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

Initial Program: 81.1% 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: 89.9% accurate, 1.6× 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])\\ \\ \sqrt{\mathsf{fma}\left(\frac{\frac{M\_m \cdot -0.5}{d} \cdot D\_m}{\ell}, \frac{\left(\frac{0.5}{d} \cdot M\_m\right) \cdot D\_m}{\frac{1}{h}}, 1\right)} \cdot w0 \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
 (*
  (sqrt
   (fma
    (/ (* (/ (* M_m -0.5) d) D_m) l)
    (/ (* (* (/ 0.5 d) M_m) D_m) (/ 1.0 h))
    1.0))
  w0))
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 sqrt(fma(((((M_m * -0.5) / d) * D_m) / l), ((((0.5 / d) * M_m) * D_m) / (1.0 / h)), 1.0)) * w0;
}
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(sqrt(fma(Float64(Float64(Float64(Float64(M_m * -0.5) / d) * D_m) / l), Float64(Float64(Float64(Float64(0.5 / d) * M_m) * D_m) / Float64(1.0 / h)), 1.0)) * w0)
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[(N[Sqrt[N[(N[(N[(N[(N[(M$95$m * -0.5), $MachinePrecision] / d), $MachinePrecision] * D$95$m), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(N[(0.5 / d), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] / N[(1.0 / h), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $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])\\
\\
\sqrt{\mathsf{fma}\left(\frac{\frac{M\_m \cdot -0.5}{d} \cdot D\_m}{\ell}, \frac{\left(\frac{0.5}{d} \cdot M\_m\right) \cdot D\_m}{\frac{1}{h}}, 1\right)} \cdot w0
\end{array}
Derivation
  1. Initial program 78.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{\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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 88.6% accurate, 0.6× 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{\left(M\_m \cdot D\_m\right) \cdot -0.5}{d}\\ \mathbf{if}\;\sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}} \cdot w0 \leq 10^{+241}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(t\_0 \cdot \frac{h}{\ell}, \left(\frac{0.5}{d} \cdot M\_m\right) \cdot D\_m, 1\right)} \cdot w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{t\_0}{\ell}, \left(\left(M\_m \cdot D\_m\right) \cdot h\right) \cdot \frac{0.5}{d}, 1\right)} \cdot w0\\ \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) -0.5) d)))
   (if (<=
        (* (sqrt (- 1.0 (* (/ h l) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)))) w0)
        1e+241)
     (* (sqrt (fma (* t_0 (/ h l)) (* (* (/ 0.5 d) M_m) D_m) 1.0)) w0)
     (* (sqrt (fma (/ t_0 l) (* (* (* M_m D_m) h) (/ 0.5 d)) 1.0)) w0))))
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) * -0.5) / d;
	double tmp;
	if ((sqrt((1.0 - ((h / l) * pow(((M_m * D_m) / (2.0 * d)), 2.0)))) * w0) <= 1e+241) {
		tmp = sqrt(fma((t_0 * (h / l)), (((0.5 / d) * M_m) * D_m), 1.0)) * w0;
	} else {
		tmp = sqrt(fma((t_0 / l), (((M_m * D_m) * h) * (0.5 / d)), 1.0)) * w0;
	}
	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) * -0.5) / d)
	tmp = 0.0
	if (Float64(sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)))) * w0) <= 1e+241)
		tmp = Float64(sqrt(fma(Float64(t_0 * Float64(h / l)), Float64(Float64(Float64(0.5 / d) * M_m) * D_m), 1.0)) * w0);
	else
		tmp = Float64(sqrt(fma(Float64(t_0 / l), Float64(Float64(Float64(M_m * D_m) * h) * Float64(0.5 / d)), 1.0)) * w0);
	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[(N[(M$95$m * D$95$m), $MachinePrecision] * -0.5), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[N[(N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], 1e+241], N[(N[Sqrt[N[(N[(t$95$0 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(0.5 / d), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(N[Sqrt[N[(N[(t$95$0 / l), $MachinePrecision] * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * h), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $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{\left(M\_m \cdot D\_m\right) \cdot -0.5}{d}\\
\mathbf{if}\;\sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}} \cdot w0 \leq 10^{+241}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(t\_0 \cdot \frac{h}{\ell}, \left(\frac{0.5}{d} \cdot M\_m\right) \cdot D\_m, 1\right)} \cdot w0\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\frac{t\_0}{\ell}, \left(\left(M\_m \cdot D\_m\right) \cdot h\right) \cdot \frac{0.5}{d}, 1\right)} \cdot w0\\


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

    1. Initial program 92.1%

      \[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. *-commutativeN/A

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

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

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

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

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

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

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

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

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

    1. Initial program 34.8%

      \[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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 88.7% accurate, 0.6× 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}\;\sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}} \cdot w0 \leq 2 \cdot 10^{+301}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\left(M\_m \cdot D\_m\right) \cdot -0.5}{d} \cdot \frac{h}{\ell}, \left(\frac{0.5}{d} \cdot M\_m\right) \cdot D\_m, 1\right)} \cdot w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\frac{M\_m \cdot -0.5}{d} \cdot D\_m}{\ell}, \left(\left(h \cdot D\_m\right) \cdot M\_m\right) \cdot \frac{0.5}{d}, 1\right)} \cdot w0\\ \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 (<=
      (* (sqrt (- 1.0 (* (/ h l) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)))) w0)
      2e+301)
   (*
    (sqrt
     (fma
      (* (/ (* (* M_m D_m) -0.5) d) (/ h l))
      (* (* (/ 0.5 d) M_m) D_m)
      1.0))
    w0)
   (*
    (sqrt
     (fma
      (/ (* (/ (* M_m -0.5) d) D_m) l)
      (* (* (* h D_m) M_m) (/ 0.5 d))
      1.0))
    w0)))
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 ((sqrt((1.0 - ((h / l) * pow(((M_m * D_m) / (2.0 * d)), 2.0)))) * w0) <= 2e+301) {
		tmp = sqrt(fma(((((M_m * D_m) * -0.5) / d) * (h / l)), (((0.5 / d) * M_m) * D_m), 1.0)) * w0;
	} else {
		tmp = sqrt(fma(((((M_m * -0.5) / d) * D_m) / l), (((h * D_m) * M_m) * (0.5 / d)), 1.0)) * w0;
	}
	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(sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)))) * w0) <= 2e+301)
		tmp = Float64(sqrt(fma(Float64(Float64(Float64(Float64(M_m * D_m) * -0.5) / d) * Float64(h / l)), Float64(Float64(Float64(0.5 / d) * M_m) * D_m), 1.0)) * w0);
	else
		tmp = Float64(sqrt(fma(Float64(Float64(Float64(Float64(M_m * -0.5) / d) * D_m) / l), Float64(Float64(Float64(h * D_m) * M_m) * Float64(0.5 / d)), 1.0)) * w0);
	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[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], 2e+301], N[(N[Sqrt[N[(N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * -0.5), $MachinePrecision] / d), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(0.5 / d), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(N[Sqrt[N[(N[(N[(N[(N[(M$95$m * -0.5), $MachinePrecision] / d), $MachinePrecision] * D$95$m), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(h * D$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $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}\;\sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}} \cdot w0 \leq 2 \cdot 10^{+301}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\left(M\_m \cdot D\_m\right) \cdot -0.5}{d} \cdot \frac{h}{\ell}, \left(\frac{0.5}{d} \cdot M\_m\right) \cdot D\_m, 1\right)} \cdot w0\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\frac{M\_m \cdot -0.5}{d} \cdot D\_m}{\ell}, \left(\left(h \cdot D\_m\right) \cdot M\_m\right) \cdot \frac{0.5}{d}, 1\right)} \cdot w0\\


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

    1. Initial program 92.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{\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. *-commutativeN/A

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

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

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

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

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

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

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

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

    if 2.00000000000000011e301 < (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)))))

    1. Initial program 24.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{\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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}} \cdot w0 \leq 2 \cdot 10^{+301}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\left(M \cdot D\right) \cdot -0.5}{d} \cdot \frac{h}{\ell}, \left(\frac{0.5}{d} \cdot M\right) \cdot D, 1\right)} \cdot w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\frac{M \cdot -0.5}{d} \cdot D}{\ell}, \left(\left(h \cdot D\right) \cdot M\right) \cdot \frac{0.5}{d}, 1\right)} \cdot w0\\ \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} \mathbf{if}\;1 - \frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \leq \infty:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\left(M\_m \cdot D\_m\right) \cdot -0.5}{d} \cdot \frac{h}{\ell}, \left(\frac{0.5}{d} \cdot M\_m\right) \cdot D\_m, 1\right)} \cdot w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{D\_m}{d} \cdot \frac{-0.25 \cdot \left(M\_m \cdot M\_m\right)}{\ell}, \frac{D\_m}{d} \cdot h, 1\right)} \cdot w0\\ \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 (<= (- 1.0 (* (/ h l) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))) INFINITY)
   (*
    (sqrt
     (fma
      (* (/ (* (* M_m D_m) -0.5) d) (/ h l))
      (* (* (/ 0.5 d) M_m) D_m)
      1.0))
    w0)
   (*
    (sqrt (fma (* (/ D_m d) (/ (* -0.25 (* M_m M_m)) l)) (* (/ D_m d) h) 1.0))
    w0)))
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 ((1.0 - ((h / l) * pow(((M_m * D_m) / (2.0 * d)), 2.0))) <= ((double) INFINITY)) {
		tmp = sqrt(fma(((((M_m * D_m) * -0.5) / d) * (h / l)), (((0.5 / d) * M_m) * D_m), 1.0)) * w0;
	} else {
		tmp = sqrt(fma(((D_m / d) * ((-0.25 * (M_m * M_m)) / l)), ((D_m / d) * h), 1.0)) * w0;
	}
	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(1.0 - Float64(Float64(h / l) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0))) <= Inf)
		tmp = Float64(sqrt(fma(Float64(Float64(Float64(Float64(M_m * D_m) * -0.5) / d) * Float64(h / l)), Float64(Float64(Float64(0.5 / d) * M_m) * D_m), 1.0)) * w0);
	else
		tmp = Float64(sqrt(fma(Float64(Float64(D_m / d) * Float64(Float64(-0.25 * Float64(M_m * M_m)) / l)), Float64(Float64(D_m / d) * h), 1.0)) * w0);
	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[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[Sqrt[N[(N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * -0.5), $MachinePrecision] / d), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(0.5 / d), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(N[Sqrt[N[(N[(N[(D$95$m / d), $MachinePrecision] * N[(N[(-0.25 * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * h), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $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}\;1 - \frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \leq \infty:\\
\;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\left(M\_m \cdot D\_m\right) \cdot -0.5}{d} \cdot \frac{h}{\ell}, \left(\frac{0.5}{d} \cdot M\_m\right) \cdot D\_m, 1\right)} \cdot w0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 #s(literal 1 binary64) (*.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 86.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{\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. *-commutativeN/A

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

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

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

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

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

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

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

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

    if +inf.0 < (-.f64 #s(literal 1 binary64) (*.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{\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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 79.8% 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}\;\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \leq -1 \cdot 10^{+105}:\\ \;\;\;\;\mathsf{fma}\left(-0.125 \cdot \left(D\_m \cdot D\_m\right), \left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot M\_m\right) \cdot M\_m\right) \cdot w0, w0\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot w0\\ \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 l) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) -1e+105)
   (fma (* -0.125 (* D_m D_m)) (* (* (* (/ h (* (* d d) l)) M_m) M_m) w0) w0)
   (* 1.0 w0)))
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 / l) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) <= -1e+105) {
		tmp = fma((-0.125 * (D_m * D_m)), ((((h / ((d * d) * l)) * M_m) * M_m) * w0), w0);
	} else {
		tmp = 1.0 * w0;
	}
	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(h / l) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) <= -1e+105)
		tmp = fma(Float64(-0.125 * Float64(D_m * D_m)), Float64(Float64(Float64(Float64(h / Float64(Float64(d * d) * l)) * M_m) * M_m) * w0), w0);
	else
		tmp = Float64(1.0 * w0);
	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[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], -1e+105], N[(N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(h / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * w0), $MachinePrecision] + w0), $MachinePrecision], N[(1.0 * w0), $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}\;\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \leq -1 \cdot 10^{+105}:\\
\;\;\;\;\mathsf{fma}\left(-0.125 \cdot \left(D\_m \cdot D\_m\right), \left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot M\_m\right) \cdot M\_m\right) \cdot w0, w0\right)\\

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


\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)) < -9.9999999999999994e104

    1. Initial program 54.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 h 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. associate-*r*N/A

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

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

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

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

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

      1. Initial program 86.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 h around 0

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

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

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

      Alternative 6: 79.8% 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}\;\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \leq -1 \cdot 10^{+105}:\\ \;\;\;\;\left(-0.125 \cdot \left(D\_m \cdot D\_m\right)\right) \cdot \left(\left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot M\_m\right) \cdot M\_m\right) \cdot w0\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot w0\\ \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 l) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) -1e+105)
         (* (* -0.125 (* D_m D_m)) (* (* (* (/ h (* (* d d) l)) M_m) M_m) w0))
         (* 1.0 w0)))
      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 / l) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) <= -1e+105) {
      		tmp = (-0.125 * (D_m * D_m)) * ((((h / ((d * d) * l)) * M_m) * M_m) * w0);
      	} else {
      		tmp = 1.0 * w0;
      	}
      	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 (((h / l) * (((m_m * d_m) / (2.0d0 * d)) ** 2.0d0)) <= (-1d+105)) then
              tmp = ((-0.125d0) * (d_m * d_m)) * ((((h / ((d * d) * l)) * m_m) * m_m) * w0)
          else
              tmp = 1.0d0 * w0
          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 (((h / l) * Math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) <= -1e+105) {
      		tmp = (-0.125 * (D_m * D_m)) * ((((h / ((d * d) * l)) * M_m) * M_m) * w0);
      	} else {
      		tmp = 1.0 * w0;
      	}
      	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 ((h / l) * math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) <= -1e+105:
      		tmp = (-0.125 * (D_m * D_m)) * ((((h / ((d * d) * l)) * M_m) * M_m) * w0)
      	else:
      		tmp = 1.0 * w0
      	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(h / l) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) <= -1e+105)
      		tmp = Float64(Float64(-0.125 * Float64(D_m * D_m)) * Float64(Float64(Float64(Float64(h / Float64(Float64(d * d) * l)) * M_m) * M_m) * w0));
      	else
      		tmp = Float64(1.0 * w0);
      	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 (((h / l) * (((M_m * D_m) / (2.0 * d)) ^ 2.0)) <= -1e+105)
      		tmp = (-0.125 * (D_m * D_m)) * ((((h / ((d * d) * l)) * M_m) * M_m) * w0);
      	else
      		tmp = 1.0 * w0;
      	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[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], -1e+105], N[(N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(h / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * w0), $MachinePrecision]), $MachinePrecision], N[(1.0 * w0), $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}\;\frac{h}{\ell} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2} \leq -1 \cdot 10^{+105}:\\
      \;\;\;\;\left(-0.125 \cdot \left(D\_m \cdot D\_m\right)\right) \cdot \left(\left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot M\_m\right) \cdot M\_m\right) \cdot w0\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;1 \cdot w0\\
      
      
      \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)) < -9.9999999999999994e104

        1. Initial program 54.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 h 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. associate-*r*N/A

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(\left(D \cdot D\right) \cdot -0.125, \frac{\left(h \cdot \left(M \cdot M\right)\right) \cdot w0}{\ell \cdot \left(d \cdot d\right)}, w0\right)} \]
        6. Taylor expanded in h 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 rewrites31.2%

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

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

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

            1. Initial program 86.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 h around 0

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

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

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

            Alternative 7: 83.3% accurate, 1.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])\\ \\ \begin{array}{l} t_0 := \frac{M\_m \cdot D\_m}{2 \cdot d}\\ \mathbf{if}\;t\_0 \leq 5 \cdot 10^{-51}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{D\_m}{d} \cdot \frac{-0.25 \cdot \left(M\_m \cdot M\_m\right)}{\ell}, \frac{D\_m}{d} \cdot h, 1\right)} \cdot w0\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+167}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\left(\left(0.25 \cdot M\_m\right) \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot \frac{-h}{\ell}, \frac{D\_m}{d}, 1\right)} \cdot w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\left(\frac{0.5}{d} \cdot M\_m\right) \cdot \left(h \cdot D\_m\right), \left(\frac{-0.5}{\ell \cdot d} \cdot M\_m\right) \cdot D\_m, 1\right)} \cdot w0\\ \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 (<= t_0 5e-51)
                 (*
                  (sqrt
                   (fma (* (/ D_m d) (/ (* -0.25 (* M_m M_m)) l)) (* (/ D_m d) h) 1.0))
                  w0)
                 (if (<= t_0 4e+167)
                   (*
                    (sqrt
                     (fma
                      (* (* (* 0.25 M_m) (* (/ D_m d) M_m)) (/ (- h) l))
                      (/ D_m d)
                      1.0))
                    w0)
                   (*
                    (sqrt
                     (fma
                      (* (* (/ 0.5 d) M_m) (* h D_m))
                      (* (* (/ -0.5 (* l d)) M_m) D_m)
                      1.0))
                    w0)))))
            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 (t_0 <= 5e-51) {
            		tmp = sqrt(fma(((D_m / d) * ((-0.25 * (M_m * M_m)) / l)), ((D_m / d) * h), 1.0)) * w0;
            	} else if (t_0 <= 4e+167) {
            		tmp = sqrt(fma((((0.25 * M_m) * ((D_m / d) * M_m)) * (-h / l)), (D_m / d), 1.0)) * w0;
            	} else {
            		tmp = sqrt(fma((((0.5 / d) * M_m) * (h * D_m)), (((-0.5 / (l * d)) * M_m) * D_m), 1.0)) * w0;
            	}
            	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 (t_0 <= 5e-51)
            		tmp = Float64(sqrt(fma(Float64(Float64(D_m / d) * Float64(Float64(-0.25 * Float64(M_m * M_m)) / l)), Float64(Float64(D_m / d) * h), 1.0)) * w0);
            	elseif (t_0 <= 4e+167)
            		tmp = Float64(sqrt(fma(Float64(Float64(Float64(0.25 * M_m) * Float64(Float64(D_m / d) * M_m)) * Float64(Float64(-h) / l)), Float64(D_m / d), 1.0)) * w0);
            	else
            		tmp = Float64(sqrt(fma(Float64(Float64(Float64(0.5 / d) * M_m) * Float64(h * D_m)), Float64(Float64(Float64(-0.5 / Float64(l * d)) * M_m) * D_m), 1.0)) * w0);
            	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[t$95$0, 5e-51], N[(N[Sqrt[N[(N[(N[(D$95$m / d), $MachinePrecision] * N[(N[(-0.25 * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * h), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], If[LessEqual[t$95$0, 4e+167], N[(N[Sqrt[N[(N[(N[(N[(0.25 * M$95$m), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] * N[((-h) / l), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(N[Sqrt[N[(N[(N[(N[(0.5 / d), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(h * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.5 / N[(l * d), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $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 \leq 5 \cdot 10^{-51}:\\
            \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{D\_m}{d} \cdot \frac{-0.25 \cdot \left(M\_m \cdot M\_m\right)}{\ell}, \frac{D\_m}{d} \cdot h, 1\right)} \cdot w0\\
            
            \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+167}:\\
            \;\;\;\;\sqrt{\mathsf{fma}\left(\left(\left(0.25 \cdot M\_m\right) \cdot \left(\frac{D\_m}{d} \cdot M\_m\right)\right) \cdot \frac{-h}{\ell}, \frac{D\_m}{d}, 1\right)} \cdot w0\\
            
            \mathbf{else}:\\
            \;\;\;\;\sqrt{\mathsf{fma}\left(\left(\frac{0.5}{d} \cdot M\_m\right) \cdot \left(h \cdot D\_m\right), \left(\frac{-0.5}{\ell \cdot d} \cdot M\_m\right) \cdot D\_m, 1\right)} \cdot w0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 5.00000000000000004e-51

              1. Initial program 81.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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

              if 5.00000000000000004e-51 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 4.0000000000000002e167

              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{\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 rewrites57.8%

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

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

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

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

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

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

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

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

                  \[\leadsto w0 \cdot \sqrt{\mathsf{fma}\left(\frac{\mathsf{neg}\left(h\right)}{\ell} \cdot \left(\left(\frac{D}{d} \cdot M\right) \cdot \color{blue}{\left(\frac{1}{4} \cdot M\right)}\right), \frac{D}{d}, 1\right)} \]
                9. lower-*.f6470.8

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

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

              if 4.0000000000000002e167 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d))

              1. Initial program 37.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{\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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 8: 82.4% accurate, 1.5× 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}\;\frac{M\_m \cdot D\_m}{2 \cdot d} \leq 10^{-54}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{D\_m}{d} \cdot \frac{-0.25 \cdot \left(M\_m \cdot M\_m\right)}{\ell}, \frac{D\_m}{d} \cdot h, 1\right)} \cdot w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\left(\frac{0.5}{d} \cdot M\_m\right) \cdot \left(h \cdot D\_m\right), \left(\frac{-0.5}{\ell \cdot d} \cdot M\_m\right) \cdot D\_m, 1\right)} \cdot w0\\ \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 D_m) (* 2.0 d)) 1e-54)
               (*
                (sqrt (fma (* (/ D_m d) (/ (* -0.25 (* M_m M_m)) l)) (* (/ D_m d) h) 1.0))
                w0)
               (*
                (sqrt
                 (fma
                  (* (* (/ 0.5 d) M_m) (* h D_m))
                  (* (* (/ -0.5 (* l d)) M_m) D_m)
                  1.0))
                w0)))
            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 * D_m) / (2.0 * d)) <= 1e-54) {
            		tmp = sqrt(fma(((D_m / d) * ((-0.25 * (M_m * M_m)) / l)), ((D_m / d) * h), 1.0)) * w0;
            	} else {
            		tmp = sqrt(fma((((0.5 / d) * M_m) * (h * D_m)), (((-0.5 / (l * d)) * M_m) * D_m), 1.0)) * w0;
            	}
            	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(M_m * D_m) / Float64(2.0 * d)) <= 1e-54)
            		tmp = Float64(sqrt(fma(Float64(Float64(D_m / d) * Float64(Float64(-0.25 * Float64(M_m * M_m)) / l)), Float64(Float64(D_m / d) * h), 1.0)) * w0);
            	else
            		tmp = Float64(sqrt(fma(Float64(Float64(Float64(0.5 / d) * M_m) * Float64(h * D_m)), Float64(Float64(Float64(-0.5 / Float64(l * d)) * M_m) * D_m), 1.0)) * w0);
            	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[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 1e-54], N[(N[Sqrt[N[(N[(N[(D$95$m / d), $MachinePrecision] * N[(N[(-0.25 * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * h), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(N[Sqrt[N[(N[(N[(N[(0.5 / d), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(h * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.5 / N[(l * d), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $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}\;\frac{M\_m \cdot D\_m}{2 \cdot d} \leq 10^{-54}:\\
            \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{D\_m}{d} \cdot \frac{-0.25 \cdot \left(M\_m \cdot M\_m\right)}{\ell}, \frac{D\_m}{d} \cdot h, 1\right)} \cdot w0\\
            
            \mathbf{else}:\\
            \;\;\;\;\sqrt{\mathsf{fma}\left(\left(\frac{0.5}{d} \cdot M\_m\right) \cdot \left(h \cdot D\_m\right), \left(\frac{-0.5}{\ell \cdot d} \cdot M\_m\right) \cdot D\_m, 1\right)} \cdot w0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 1e-54

              1. Initial program 81.9%

                \[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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

              if 1e-54 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d))

              1. Initial program 59.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{\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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 9: 76.7% accurate, 1.6× 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}\;\frac{M\_m \cdot D\_m}{2 \cdot d} \leq 4 \cdot 10^{-67}:\\ \;\;\;\;1 \cdot w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\left(\frac{0.5}{d} \cdot M\_m\right) \cdot \left(h \cdot D\_m\right), \left(\frac{-0.5}{\ell \cdot d} \cdot M\_m\right) \cdot D\_m, 1\right)} \cdot w0\\ \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 D_m) (* 2.0 d)) 4e-67)
               (* 1.0 w0)
               (*
                (sqrt
                 (fma
                  (* (* (/ 0.5 d) M_m) (* h D_m))
                  (* (* (/ -0.5 (* l d)) M_m) D_m)
                  1.0))
                w0)))
            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 * D_m) / (2.0 * d)) <= 4e-67) {
            		tmp = 1.0 * w0;
            	} else {
            		tmp = sqrt(fma((((0.5 / d) * M_m) * (h * D_m)), (((-0.5 / (l * d)) * M_m) * D_m), 1.0)) * w0;
            	}
            	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(M_m * D_m) / Float64(2.0 * d)) <= 4e-67)
            		tmp = Float64(1.0 * w0);
            	else
            		tmp = Float64(sqrt(fma(Float64(Float64(Float64(0.5 / d) * M_m) * Float64(h * D_m)), Float64(Float64(Float64(-0.5 / Float64(l * d)) * M_m) * D_m), 1.0)) * w0);
            	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[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 4e-67], N[(1.0 * w0), $MachinePrecision], N[(N[Sqrt[N[(N[(N[(N[(0.5 / d), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(h * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.5 / N[(l * d), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $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}\;\frac{M\_m \cdot D\_m}{2 \cdot d} \leq 4 \cdot 10^{-67}:\\
            \;\;\;\;1 \cdot w0\\
            
            \mathbf{else}:\\
            \;\;\;\;\sqrt{\mathsf{fma}\left(\left(\frac{0.5}{d} \cdot M\_m\right) \cdot \left(h \cdot D\_m\right), \left(\frac{-0.5}{\ell \cdot d} \cdot M\_m\right) \cdot D\_m, 1\right)} \cdot w0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 3.99999999999999977e-67

              1. Initial program 81.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 h around 0

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

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

                if 3.99999999999999977e-67 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d))

                1. Initial program 61.1%

                  \[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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 10: 76.4% accurate, 1.6× 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}\;\frac{M\_m \cdot D\_m}{2 \cdot d} \leq 5 \cdot 10^{-190}:\\ \;\;\;\;1 \cdot w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\left(h \cdot M\_m\right) \cdot D\_m}{d} \cdot 0.5, \frac{-0.5}{\ell \cdot d} \cdot \left(M\_m \cdot D\_m\right), 1\right)} \cdot w0\\ \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 D_m) (* 2.0 d)) 5e-190)
                 (* 1.0 w0)
                 (*
                  (sqrt
                   (fma
                    (* (/ (* (* h M_m) D_m) d) 0.5)
                    (* (/ -0.5 (* l d)) (* M_m D_m))
                    1.0))
                  w0)))
              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 * D_m) / (2.0 * d)) <= 5e-190) {
              		tmp = 1.0 * w0;
              	} else {
              		tmp = sqrt(fma(((((h * M_m) * D_m) / d) * 0.5), ((-0.5 / (l * d)) * (M_m * D_m)), 1.0)) * w0;
              	}
              	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(M_m * D_m) / Float64(2.0 * d)) <= 5e-190)
              		tmp = Float64(1.0 * w0);
              	else
              		tmp = Float64(sqrt(fma(Float64(Float64(Float64(Float64(h * M_m) * D_m) / d) * 0.5), Float64(Float64(-0.5 / Float64(l * d)) * Float64(M_m * D_m)), 1.0)) * w0);
              	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[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 5e-190], N[(1.0 * w0), $MachinePrecision], N[(N[Sqrt[N[(N[(N[(N[(N[(h * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] / d), $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[(-0.5 / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $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}\;\frac{M\_m \cdot D\_m}{2 \cdot d} \leq 5 \cdot 10^{-190}:\\
              \;\;\;\;1 \cdot w0\\
              
              \mathbf{else}:\\
              \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\left(h \cdot M\_m\right) \cdot D\_m}{d} \cdot 0.5, \frac{-0.5}{\ell \cdot d} \cdot \left(M\_m \cdot D\_m\right), 1\right)} \cdot w0\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) < 5.00000000000000034e-190

                1. Initial program 80.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 h around 0

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

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

                  if 5.00000000000000034e-190 < (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d))

                  1. Initial program 72.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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 11: 81.7% accurate, 1.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}\;M\_m \cdot D\_m \leq 10^{-204}:\\ \;\;\;\;1 \cdot w0\\ \mathbf{elif}\;M\_m \cdot D\_m \leq 2 \cdot 10^{+38}:\\ \;\;\;\;\sqrt{1 - \frac{\left(\frac{M\_m \cdot D\_m}{\left(d \cdot d\right) \cdot 4} \cdot \left(M\_m \cdot D\_m\right)\right) \cdot h}{\ell}} \cdot w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\left(\left(0.25 \cdot \left(M\_m \cdot M\_m\right)\right) \cdot D\_m\right) \cdot h}{\left(-\ell\right) \cdot d}, \frac{D\_m}{d}, 1\right)} \cdot w0\\ \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 D_m) 1e-204)
                   (* 1.0 w0)
                   (if (<= (* M_m D_m) 2e+38)
                     (*
                      (sqrt
                       (- 1.0 (/ (* (* (/ (* M_m D_m) (* (* d d) 4.0)) (* M_m D_m)) h) l)))
                      w0)
                     (*
                      (sqrt
                       (fma (/ (* (* (* 0.25 (* M_m M_m)) D_m) h) (* (- l) d)) (/ D_m d) 1.0))
                      w0))))
                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 * D_m) <= 1e-204) {
                		tmp = 1.0 * w0;
                	} else if ((M_m * D_m) <= 2e+38) {
                		tmp = sqrt((1.0 - (((((M_m * D_m) / ((d * d) * 4.0)) * (M_m * D_m)) * h) / l))) * w0;
                	} else {
                		tmp = sqrt(fma(((((0.25 * (M_m * M_m)) * D_m) * h) / (-l * d)), (D_m / d), 1.0)) * w0;
                	}
                	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(M_m * D_m) <= 1e-204)
                		tmp = Float64(1.0 * w0);
                	elseif (Float64(M_m * D_m) <= 2e+38)
                		tmp = Float64(sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M_m * D_m) / Float64(Float64(d * d) * 4.0)) * Float64(M_m * D_m)) * h) / l))) * w0);
                	else
                		tmp = Float64(sqrt(fma(Float64(Float64(Float64(Float64(0.25 * Float64(M_m * M_m)) * D_m) * h) / Float64(Float64(-l) * d)), Float64(D_m / d), 1.0)) * w0);
                	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[(M$95$m * D$95$m), $MachinePrecision], 1e-204], N[(1.0 * w0), $MachinePrecision], If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 2e+38], N[(N[Sqrt[N[(1.0 - N[(N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(N[Sqrt[N[(N[(N[(N[(N[(0.25 * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision] * h), $MachinePrecision] / N[((-l) * d), $MachinePrecision]), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $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 \cdot D\_m \leq 10^{-204}:\\
                \;\;\;\;1 \cdot w0\\
                
                \mathbf{elif}\;M\_m \cdot D\_m \leq 2 \cdot 10^{+38}:\\
                \;\;\;\;\sqrt{1 - \frac{\left(\frac{M\_m \cdot D\_m}{\left(d \cdot d\right) \cdot 4} \cdot \left(M\_m \cdot D\_m\right)\right) \cdot h}{\ell}} \cdot w0\\
                
                \mathbf{else}:\\
                \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\left(\left(0.25 \cdot \left(M\_m \cdot M\_m\right)\right) \cdot D\_m\right) \cdot h}{\left(-\ell\right) \cdot d}, \frac{D\_m}{d}, 1\right)} \cdot w0\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if (*.f64 M D) < 1e-204

                  1. Initial program 76.3%

                    \[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 h around 0

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

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

                    if 1e-204 < (*.f64 M D) < 1.99999999999999995e38

                    1. Initial program 90.6%

                      \[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. associate-*r/N/A

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

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

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

                    if 1.99999999999999995e38 < (*.f64 M D)

                    1. Initial program 71.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{\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 rewrites66.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 12: 81.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 \cdot D\_m \leq 10^{-204}:\\ \;\;\;\;1 \cdot w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 - \frac{\left(\frac{M\_m \cdot D\_m}{\left(d \cdot d\right) \cdot 4} \cdot \left(M\_m \cdot D\_m\right)\right) \cdot h}{\ell}} \cdot w0\\ \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 D_m) 1e-204)
                     (* 1.0 w0)
                     (*
                      (sqrt (- 1.0 (/ (* (* (/ (* M_m D_m) (* (* d d) 4.0)) (* M_m D_m)) h) l)))
                      w0)))
                  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 * D_m) <= 1e-204) {
                  		tmp = 1.0 * w0;
                  	} else {
                  		tmp = sqrt((1.0 - (((((M_m * D_m) / ((d * d) * 4.0)) * (M_m * D_m)) * h) / l))) * w0;
                  	}
                  	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) <= 1d-204) then
                          tmp = 1.0d0 * w0
                      else
                          tmp = sqrt((1.0d0 - (((((m_m * d_m) / ((d * d) * 4.0d0)) * (m_m * d_m)) * h) / l))) * w0
                      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 ((M_m * D_m) <= 1e-204) {
                  		tmp = 1.0 * w0;
                  	} else {
                  		tmp = Math.sqrt((1.0 - (((((M_m * D_m) / ((d * d) * 4.0)) * (M_m * D_m)) * h) / l))) * w0;
                  	}
                  	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 (M_m * D_m) <= 1e-204:
                  		tmp = 1.0 * w0
                  	else:
                  		tmp = math.sqrt((1.0 - (((((M_m * D_m) / ((d * d) * 4.0)) * (M_m * D_m)) * h) / l))) * w0
                  	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(M_m * D_m) <= 1e-204)
                  		tmp = Float64(1.0 * w0);
                  	else
                  		tmp = Float64(sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M_m * D_m) / Float64(Float64(d * d) * 4.0)) * Float64(M_m * D_m)) * h) / l))) * w0);
                  	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) <= 1e-204)
                  		tmp = 1.0 * w0;
                  	else
                  		tmp = sqrt((1.0 - (((((M_m * D_m) / ((d * d) * 4.0)) * (M_m * D_m)) * h) / l))) * w0;
                  	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[(M$95$m * D$95$m), $MachinePrecision], 1e-204], N[(1.0 * w0), $MachinePrecision], N[(N[Sqrt[N[(1.0 - N[(N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * w0), $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 \cdot D\_m \leq 10^{-204}:\\
                  \;\;\;\;1 \cdot w0\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\sqrt{1 - \frac{\left(\frac{M\_m \cdot D\_m}{\left(d \cdot d\right) \cdot 4} \cdot \left(M\_m \cdot D\_m\right)\right) \cdot h}{\ell}} \cdot w0\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if (*.f64 M D) < 1e-204

                    1. Initial program 76.3%

                      \[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 h around 0

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

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

                      if 1e-204 < (*.f64 M D)

                      1. Initial program 82.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. associate-*r/N/A

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

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

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

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

                    Alternative 13: 83.0% 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}\;D\_m \leq 5.6 \cdot 10^{-75}:\\ \;\;\;\;\mathsf{fma}\left(-0.125 \cdot \left(D\_m \cdot D\_m\right), \frac{\frac{\frac{\left(M\_m \cdot M\_m\right) \cdot h}{\ell} \cdot w0}{d}}{d}, w0\right)\\ \mathbf{elif}\;D\_m \leq 8.4 \cdot 10^{+148}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\left(D\_m \cdot D\_m\right) \cdot -0.25, \frac{M\_m}{d} \cdot \frac{h \cdot M\_m}{\ell \cdot d}, 1\right)} \cdot w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\left(0.5 \cdot M\_m\right) \cdot \left(\left(M\_m \cdot D\_m\right) \cdot -0.5\right)}{\left(d \cdot d\right) \cdot \ell} \cdot D\_m, h, 1\right)} \cdot w0\\ \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 (<= D_m 5.6e-75)
                       (fma (* -0.125 (* D_m D_m)) (/ (/ (* (/ (* (* M_m M_m) h) l) w0) d) d) w0)
                       (if (<= D_m 8.4e+148)
                         (*
                          (sqrt
                           (fma (* (* D_m D_m) -0.25) (* (/ M_m d) (/ (* h M_m) (* l d))) 1.0))
                          w0)
                         (*
                          (sqrt
                           (fma
                            (* (/ (* (* 0.5 M_m) (* (* M_m D_m) -0.5)) (* (* d d) l)) D_m)
                            h
                            1.0))
                          w0))))
                    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 (D_m <= 5.6e-75) {
                    		tmp = fma((-0.125 * (D_m * D_m)), ((((((M_m * M_m) * h) / l) * w0) / d) / d), w0);
                    	} else if (D_m <= 8.4e+148) {
                    		tmp = sqrt(fma(((D_m * D_m) * -0.25), ((M_m / d) * ((h * M_m) / (l * d))), 1.0)) * w0;
                    	} else {
                    		tmp = sqrt(fma(((((0.5 * M_m) * ((M_m * D_m) * -0.5)) / ((d * d) * l)) * D_m), h, 1.0)) * w0;
                    	}
                    	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 (D_m <= 5.6e-75)
                    		tmp = fma(Float64(-0.125 * Float64(D_m * D_m)), Float64(Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) / l) * w0) / d) / d), w0);
                    	elseif (D_m <= 8.4e+148)
                    		tmp = Float64(sqrt(fma(Float64(Float64(D_m * D_m) * -0.25), Float64(Float64(M_m / d) * Float64(Float64(h * M_m) / Float64(l * d))), 1.0)) * w0);
                    	else
                    		tmp = Float64(sqrt(fma(Float64(Float64(Float64(Float64(0.5 * M_m) * Float64(Float64(M_m * D_m) * -0.5)) / Float64(Float64(d * d) * l)) * D_m), h, 1.0)) * w0);
                    	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[D$95$m, 5.6e-75], N[(N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision] * w0), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision] + w0), $MachinePrecision], If[LessEqual[D$95$m, 8.4e+148], N[(N[Sqrt[N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * -0.25), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * N[(N[(h * M$95$m), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $MachinePrecision], N[(N[Sqrt[N[(N[(N[(N[(N[(0.5 * M$95$m), $MachinePrecision] * N[(N[(M$95$m * D$95$m), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision] * h + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $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}\;D\_m \leq 5.6 \cdot 10^{-75}:\\
                    \;\;\;\;\mathsf{fma}\left(-0.125 \cdot \left(D\_m \cdot D\_m\right), \frac{\frac{\frac{\left(M\_m \cdot M\_m\right) \cdot h}{\ell} \cdot w0}{d}}{d}, w0\right)\\
                    
                    \mathbf{elif}\;D\_m \leq 8.4 \cdot 10^{+148}:\\
                    \;\;\;\;\sqrt{\mathsf{fma}\left(\left(D\_m \cdot D\_m\right) \cdot -0.25, \frac{M\_m}{d} \cdot \frac{h \cdot M\_m}{\ell \cdot d}, 1\right)} \cdot w0\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\left(0.5 \cdot M\_m\right) \cdot \left(\left(M\_m \cdot D\_m\right) \cdot -0.5\right)}{\left(d \cdot d\right) \cdot \ell} \cdot D\_m, h, 1\right)} \cdot w0\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if D < 5.59999999999999996e-75

                      1. Initial program 79.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 h 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. associate-*r*N/A

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

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

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

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

                        if 5.59999999999999996e-75 < D < 8.39999999999999996e148

                        1. Initial program 74.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 h around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            if 8.39999999999999996e148 < D

                            1. Initial program 73.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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          Alternative 14: 80.9% accurate, 2.0× 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 \cdot D\_m \leq 5 \cdot 10^{-94}:\\ \;\;\;\;1 \cdot w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\left(0.5 \cdot M\_m\right) \cdot \left(\left(M\_m \cdot D\_m\right) \cdot -0.5\right)}{\left(d \cdot d\right) \cdot \ell} \cdot D\_m, h, 1\right)} \cdot w0\\ \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 D_m) 5e-94)
                             (* 1.0 w0)
                             (*
                              (sqrt
                               (fma
                                (* (/ (* (* 0.5 M_m) (* (* M_m D_m) -0.5)) (* (* d d) l)) D_m)
                                h
                                1.0))
                              w0)))
                          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 * D_m) <= 5e-94) {
                          		tmp = 1.0 * w0;
                          	} else {
                          		tmp = sqrt(fma(((((0.5 * M_m) * ((M_m * D_m) * -0.5)) / ((d * d) * l)) * D_m), h, 1.0)) * w0;
                          	}
                          	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(M_m * D_m) <= 5e-94)
                          		tmp = Float64(1.0 * w0);
                          	else
                          		tmp = Float64(sqrt(fma(Float64(Float64(Float64(Float64(0.5 * M_m) * Float64(Float64(M_m * D_m) * -0.5)) / Float64(Float64(d * d) * l)) * D_m), h, 1.0)) * w0);
                          	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[(M$95$m * D$95$m), $MachinePrecision], 5e-94], N[(1.0 * w0), $MachinePrecision], N[(N[Sqrt[N[(N[(N[(N[(N[(0.5 * M$95$m), $MachinePrecision] * N[(N[(M$95$m * D$95$m), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision] * h + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $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 \cdot D\_m \leq 5 \cdot 10^{-94}:\\
                          \;\;\;\;1 \cdot w0\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\sqrt{\mathsf{fma}\left(\frac{\left(0.5 \cdot M\_m\right) \cdot \left(\left(M\_m \cdot D\_m\right) \cdot -0.5\right)}{\left(d \cdot d\right) \cdot \ell} \cdot D\_m, h, 1\right)} \cdot w0\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if (*.f64 M D) < 4.9999999999999995e-94

                            1. Initial program 77.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 h around 0

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

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

                              if 4.9999999999999995e-94 < (*.f64 M D)

                              1. Initial program 78.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-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            Alternative 15: 81.1% 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}\;M\_m \cdot D\_m \leq 10^{-193}:\\ \;\;\;\;\mathsf{fma}\left(-0.125 \cdot \left(D\_m \cdot D\_m\right), \frac{\frac{\frac{\left(M\_m \cdot M\_m\right) \cdot h}{\ell} \cdot w0}{d}}{d}, w0\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\left(-0.25 \cdot D\_m\right) \cdot \left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot M\_m\right) \cdot M\_m\right), D\_m, 1\right)} \cdot w0\\ \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 D_m) 1e-193)
                               (fma (* -0.125 (* D_m D_m)) (/ (/ (* (/ (* (* M_m M_m) h) l) w0) d) d) w0)
                               (*
                                (sqrt (fma (* (* -0.25 D_m) (* (* (/ h (* (* d d) l)) M_m) M_m)) D_m 1.0))
                                w0)))
                            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 * D_m) <= 1e-193) {
                            		tmp = fma((-0.125 * (D_m * D_m)), ((((((M_m * M_m) * h) / l) * w0) / d) / d), w0);
                            	} else {
                            		tmp = sqrt(fma(((-0.25 * D_m) * (((h / ((d * d) * l)) * M_m) * M_m)), D_m, 1.0)) * w0;
                            	}
                            	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(M_m * D_m) <= 1e-193)
                            		tmp = fma(Float64(-0.125 * Float64(D_m * D_m)), Float64(Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) / l) * w0) / d) / d), w0);
                            	else
                            		tmp = Float64(sqrt(fma(Float64(Float64(-0.25 * D_m) * Float64(Float64(Float64(h / Float64(Float64(d * d) * l)) * M_m) * M_m)), D_m, 1.0)) * w0);
                            	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[(M$95$m * D$95$m), $MachinePrecision], 1e-193], N[(N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision] * w0), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision] + w0), $MachinePrecision], N[(N[Sqrt[N[(N[(N[(-0.25 * D$95$m), $MachinePrecision] * N[(N[(N[(h / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] * D$95$m + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $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 \cdot D\_m \leq 10^{-193}:\\
                            \;\;\;\;\mathsf{fma}\left(-0.125 \cdot \left(D\_m \cdot D\_m\right), \frac{\frac{\frac{\left(M\_m \cdot M\_m\right) \cdot h}{\ell} \cdot w0}{d}}{d}, w0\right)\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\sqrt{\mathsf{fma}\left(\left(-0.25 \cdot D\_m\right) \cdot \left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot M\_m\right) \cdot M\_m\right), D\_m, 1\right)} \cdot w0\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if (*.f64 M D) < 1e-193

                              1. Initial program 76.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 h 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. associate-*r*N/A

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

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

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

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

                                if 1e-193 < (*.f64 M D)

                                1. Initial program 81.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 h around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                Alternative 16: 81.0% 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}\;M\_m \cdot D\_m \leq 10^{-193}:\\ \;\;\;\;1 \cdot w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\mathsf{fma}\left(\left(-0.25 \cdot D\_m\right) \cdot \left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot M\_m\right) \cdot M\_m\right), D\_m, 1\right)} \cdot w0\\ \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 D_m) 1e-193)
                                   (* 1.0 w0)
                                   (*
                                    (sqrt (fma (* (* -0.25 D_m) (* (* (/ h (* (* d d) l)) M_m) M_m)) D_m 1.0))
                                    w0)))
                                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 * D_m) <= 1e-193) {
                                		tmp = 1.0 * w0;
                                	} else {
                                		tmp = sqrt(fma(((-0.25 * D_m) * (((h / ((d * d) * l)) * M_m) * M_m)), D_m, 1.0)) * w0;
                                	}
                                	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(M_m * D_m) <= 1e-193)
                                		tmp = Float64(1.0 * w0);
                                	else
                                		tmp = Float64(sqrt(fma(Float64(Float64(-0.25 * D_m) * Float64(Float64(Float64(h / Float64(Float64(d * d) * l)) * M_m) * M_m)), D_m, 1.0)) * w0);
                                	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[(M$95$m * D$95$m), $MachinePrecision], 1e-193], N[(1.0 * w0), $MachinePrecision], N[(N[Sqrt[N[(N[(N[(-0.25 * D$95$m), $MachinePrecision] * N[(N[(N[(h / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision] * D$95$m + 1.0), $MachinePrecision]], $MachinePrecision] * w0), $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 \cdot D\_m \leq 10^{-193}:\\
                                \;\;\;\;1 \cdot w0\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\sqrt{\mathsf{fma}\left(\left(-0.25 \cdot D\_m\right) \cdot \left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot M\_m\right) \cdot M\_m\right), D\_m, 1\right)} \cdot w0\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if (*.f64 M D) < 1e-193

                                  1. Initial program 76.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 h around 0

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

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

                                    if 1e-193 < (*.f64 M D)

                                    1. Initial program 81.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 h around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    Alternative 17: 68.8% 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])\\ \\ 1 \cdot w0 \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 (* 1.0 w0))
                                    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 1.0 * w0;
                                    }
                                    
                                    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 = 1.0d0 * w0
                                    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 1.0 * w0;
                                    }
                                    
                                    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 1.0 * w0
                                    
                                    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(1.0 * w0)
                                    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 = 1.0 * w0;
                                    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[(1.0 * w0), $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])\\
                                    \\
                                    1 \cdot w0
                                    \end{array}
                                    
                                    Derivation
                                    1. Initial program 78.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 h around 0

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

                                        \[\leadsto w0 \cdot \color{blue}{1} \]
                                      2. Final simplification67.8%

                                        \[\leadsto 1 \cdot w0 \]
                                      3. Add Preprocessing

                                      Reproduce

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