Henrywood and Agarwal, Equation (13)

Percentage Accurate: 24.6% → 62.2%
Time: 38.9s
Alternatives: 14
Speedup: 151.0×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right) \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
   (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
    code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 * (d * d)) / ((w * h) * (D * D))
	return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))
	return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M)))))
end
function tmp = code(c0, w, h, D, d, M)
	t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)
\end{array}
\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 14 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: 24.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right) \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
   (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
    code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 * (d * d)) / ((w * h) * (D * D))
	return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))
	return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M)))))
end
function tmp = code(c0, w, h, D, d, M)
	t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)
\end{array}
\end{array}

Alternative 1: 62.2% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\frac{d}{D}\right)}^{2}\\ t_1 := \frac{c0}{2 \cdot w}\\ t_2 := \frac{\frac{c0}{w}}{h}\\ t_3 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\ t_4 := t\_1 \cdot \left(t\_3 + \sqrt{t\_3 \cdot t\_3 - M \cdot M}\right)\\ t_5 := t\_0 \cdot t\_2\\ t_6 := \frac{t\_0 \cdot \frac{c0}{w}}{h}\\ \mathbf{if}\;t\_4 \leq -\infty:\\ \;\;\;\;t\_1 \cdot \mathsf{fma}\left({\left({\left(\mathsf{fma}\left(\frac{c0}{w \cdot h}, t\_0, M\right)\right)}^{0.25}\right)}^{2}, \sqrt{t\_5 - M}, t\_5\right)\\ \mathbf{elif}\;t\_4 \leq 0:\\ \;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\ \mathbf{elif}\;t\_4 \leq \infty:\\ \;\;\;\;t\_1 \cdot \left(t\_6 + \sqrt{\mathsf{fma}\left(t\_2, t\_0, M\right)} \cdot \sqrt{t\_6 - M}\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (pow (/ d D) 2.0))
        (t_1 (/ c0 (* 2.0 w)))
        (t_2 (/ (/ c0 w) h))
        (t_3 (/ (* c0 (* d d)) (* (* D D) (* w h))))
        (t_4 (* t_1 (+ t_3 (sqrt (- (* t_3 t_3) (* M M))))))
        (t_5 (* t_0 t_2))
        (t_6 (/ (* t_0 (/ c0 w)) h)))
   (if (<= t_4 (- INFINITY))
     (*
      t_1
      (fma
       (pow (pow (fma (/ c0 (* w h)) t_0 M) 0.25) 2.0)
       (sqrt (- t_5 M))
       t_5))
     (if (<= t_4 0.0)
       (* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
       (if (<= t_4 INFINITY)
         (* t_1 (+ t_6 (* (sqrt (fma t_2 t_0 M)) (sqrt (- t_6 M)))))
         (* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = pow((d / D), 2.0);
	double t_1 = c0 / (2.0 * w);
	double t_2 = (c0 / w) / h;
	double t_3 = (c0 * (d * d)) / ((D * D) * (w * h));
	double t_4 = t_1 * (t_3 + sqrt(((t_3 * t_3) - (M * M))));
	double t_5 = t_0 * t_2;
	double t_6 = (t_0 * (c0 / w)) / h;
	double tmp;
	if (t_4 <= -((double) INFINITY)) {
		tmp = t_1 * fma(pow(pow(fma((c0 / (w * h)), t_0, M), 0.25), 2.0), sqrt((t_5 - M)), t_5);
	} else if (t_4 <= 0.0) {
		tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
	} else if (t_4 <= ((double) INFINITY)) {
		tmp = t_1 * (t_6 + (sqrt(fma(t_2, t_0, M)) * sqrt((t_6 - M))));
	} else {
		tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
	}
	return tmp;
}
function code(c0, w, h, D, d, M)
	t_0 = Float64(d / D) ^ 2.0
	t_1 = Float64(c0 / Float64(2.0 * w))
	t_2 = Float64(Float64(c0 / w) / h)
	t_3 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h)))
	t_4 = Float64(t_1 * Float64(t_3 + sqrt(Float64(Float64(t_3 * t_3) - Float64(M * M)))))
	t_5 = Float64(t_0 * t_2)
	t_6 = Float64(Float64(t_0 * Float64(c0 / w)) / h)
	tmp = 0.0
	if (t_4 <= Float64(-Inf))
		tmp = Float64(t_1 * fma(((fma(Float64(c0 / Float64(w * h)), t_0, M) ^ 0.25) ^ 2.0), sqrt(Float64(t_5 - M)), t_5));
	elseif (t_4 <= 0.0)
		tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h)));
	elseif (t_4 <= Inf)
		tmp = Float64(t_1 * Float64(t_6 + Float64(sqrt(fma(t_2, t_0, M)) * sqrt(Float64(t_6 - M)))));
	else
		tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0))));
	end
	return tmp
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * N[(t$95$3 + N[Sqrt[N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$0 * t$95$2), $MachinePrecision]}, Block[{t$95$6 = N[(N[(t$95$0 * N[(c0 / w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(t$95$1 * N[(N[Power[N[Power[N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * t$95$0 + M), $MachinePrecision], 0.25], $MachinePrecision], 2.0], $MachinePrecision] * N[Sqrt[N[(t$95$5 - M), $MachinePrecision]], $MachinePrecision] + t$95$5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(t$95$1 * N[(t$95$6 + N[(N[Sqrt[N[(t$95$2 * t$95$0 + M), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$6 - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{2}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{\frac{c0}{w}}{h}\\
t_3 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_4 := t\_1 \cdot \left(t\_3 + \sqrt{t\_3 \cdot t\_3 - M \cdot M}\right)\\
t_5 := t\_0 \cdot t\_2\\
t_6 := \frac{t\_0 \cdot \frac{c0}{w}}{h}\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left({\left({\left(\mathsf{fma}\left(\frac{c0}{w \cdot h}, t\_0, M\right)\right)}^{0.25}\right)}^{2}, \sqrt{t\_5 - M}, t\_5\right)\\

\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\

\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_1 \cdot \left(t\_6 + \sqrt{\mathsf{fma}\left(t\_2, t\_0, M\right)} \cdot \sqrt{t\_6 - M}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0

    1. Initial program 74.9%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative74.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative74.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac74.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg74.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified74.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Applied egg-rr87.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)} \]
    6. Step-by-step derivation
      1. associate-/r*87.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\color{blue}{\frac{\frac{c0}{w}}{h}}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      2. associate-/r*87.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      3. associate-/r*87.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \color{blue}{\frac{\frac{c0}{w}}{h}} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
    7. Simplified87.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)} \]
    8. Step-by-step derivation
      1. fma-udef87.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\color{blue}{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} + M}}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      2. associate-/r*87.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\color{blue}{\frac{c0}{w \cdot h}} \cdot {\left(\frac{d}{D}\right)}^{2} + M}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      3. *-commutative87.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\color{blue}{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h}} + M}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
    9. Applied egg-rr87.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\color{blue}{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h} + M}}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
    10. Step-by-step derivation
      1. add-sqr-sqrt87.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\color{blue}{\sqrt{\sqrt{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h} + M}} \cdot \sqrt{\sqrt{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h} + M}}}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      2. pow287.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\color{blue}{{\left(\sqrt{\sqrt{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h} + M}}\right)}^{2}}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      3. pow1/287.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left({\left(\sqrt{\color{blue}{{\left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h} + M\right)}^{0.5}}}\right)}^{2}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      4. sqrt-pow187.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left({\color{blue}{\left({\left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h} + M\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      5. *-commutative87.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left({\left({\left(\color{blue}{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}} + M\right)}^{\left(\frac{0.5}{2}\right)}\right)}^{2}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      6. fma-def87.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left({\left({\color{blue}{\left(\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{d}{D}\right)}^{2}, M\right)\right)}}^{\left(\frac{0.5}{2}\right)}\right)}^{2}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      7. metadata-eval87.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left({\left({\left(\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{d}{D}\right)}^{2}, M\right)\right)}^{\color{blue}{0.25}}\right)}^{2}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
    11. Applied egg-rr87.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\color{blue}{{\left({\left(\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{d}{D}\right)}^{2}, M\right)\right)}^{0.25}\right)}^{2}}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]

    if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0

    1. Initial program 68.5%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified67.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 67.5%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*60.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac60.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*60.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified60.6%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 87.3%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*81.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified81.0%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}}{h}} \]
      2. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      3. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      4. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      5. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{d}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      6. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\sqrt{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      7. sqrt-prod34.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      8. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{M}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      9. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}}}{h}} \]
      10. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}}}{h}} \]
      11. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}}{h}} \]
      12. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{d}}{\sqrt{{M}^{2}}}}{h}} \]
      13. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\sqrt{\color{blue}{M \cdot M}}}}{h}} \]
      14. sqrt-prod40.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}}{h}} \]
      15. add-sqr-sqrt87.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{M}}}{h}} \]
    12. Applied egg-rr87.4%

      \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{d}{M} \cdot \frac{d}{M}}}{h}} \]

    if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0

    1. Initial program 73.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative73.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative73.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified71.2%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/r*71.3%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
      2. frac-times71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
      3. *-commutative71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{w}}{h}} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
      4. associate-*r/71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h}} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
      5. pow271.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{\color{blue}{{\left(\frac{d}{D}\right)}^{2}} \cdot \frac{c0}{w}}{h} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    6. Applied egg-rr71.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h}} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    7. Applied egg-rr79.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \color{blue}{\sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M} \cdot \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative79.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \color{blue}{\sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}}\right) \]
      2. associate-/r*79.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \sqrt{\mathsf{fma}\left(\color{blue}{\frac{\frac{c0}{w}}{h}}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}\right) \]
      3. associate-/r*82.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot {\left(\frac{d}{D}\right)}^{2} - M}\right) \]
    9. Simplified82.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \color{blue}{\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}}\right) \]
    10. Step-by-step derivation
      1. associate-*l/82.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\color{blue}{\frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}} - M}\right) \]
    11. Applied egg-rr82.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\color{blue}{\frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}} - M}\right) \]

    if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M)))))

    1. Initial program 0.0%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified3.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 1.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified2.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 44.8%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*44.8%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified44.8%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. associate-/r/45.5%

        \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2}}} \cdot h\right)} \]
      2. add-sqr-sqrt45.5%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}} \cdot h\right) \]
      3. pow245.5%

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

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

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      7. add-sqr-sqrt53.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{d}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      8. unpow253.7%

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}\right)}^{2}} \cdot h\right) \]
      10. add-sqr-sqrt59.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{M}}\right)}^{2}} \cdot h\right) \]
    12. Applied egg-rr59.7%

      \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}} \cdot h\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification69.2%

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

Alternative 2: 62.2% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\frac{c0}{w}}{h}\\ t_1 := \frac{c0}{2 \cdot w}\\ t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\ t_3 := t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\ t_4 := {\left(\frac{d}{D}\right)}^{2}\\ \mathbf{if}\;t\_3 \leq -\infty:\\ \;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(t\_0, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(\frac{c0}{w \cdot h}, t\_4, M\right)\right)\\ \mathbf{elif}\;t\_3 \leq 0:\\ \;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;t\_1 \cdot \left(\frac{t\_4 \cdot \frac{c0}{w}}{h} + \sqrt{t\_4 \cdot t\_0 - M} \cdot \sqrt{\mathsf{fma}\left(t\_0, t\_4, M\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (/ c0 w) h))
        (t_1 (/ c0 (* 2.0 w)))
        (t_2 (/ (* c0 (* d d)) (* (* D D) (* w h))))
        (t_3 (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))))
        (t_4 (pow (/ d D) 2.0)))
   (if (<= t_3 (- INFINITY))
     (*
      (/ (/ c0 w) 2.0)
      (fma t_0 (* (/ d D) (/ d D)) (fma (/ c0 (* w h)) t_4 M)))
     (if (<= t_3 0.0)
       (* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
       (if (<= t_3 INFINITY)
         (*
          t_1
          (+
           (/ (* t_4 (/ c0 w)) h)
           (* (sqrt (- (* t_4 t_0) M)) (sqrt (fma t_0 t_4 M)))))
         (* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 / w) / h;
	double t_1 = c0 / (2.0 * w);
	double t_2 = (c0 * (d * d)) / ((D * D) * (w * h));
	double t_3 = t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))));
	double t_4 = pow((d / D), 2.0);
	double tmp;
	if (t_3 <= -((double) INFINITY)) {
		tmp = ((c0 / w) / 2.0) * fma(t_0, ((d / D) * (d / D)), fma((c0 / (w * h)), t_4, M));
	} else if (t_3 <= 0.0) {
		tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
	} else if (t_3 <= ((double) INFINITY)) {
		tmp = t_1 * (((t_4 * (c0 / w)) / h) + (sqrt(((t_4 * t_0) - M)) * sqrt(fma(t_0, t_4, M))));
	} else {
		tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
	}
	return tmp;
}
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 / w) / h)
	t_1 = Float64(c0 / Float64(2.0 * w))
	t_2 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h)))
	t_3 = Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M)))))
	t_4 = Float64(d / D) ^ 2.0
	tmp = 0.0
	if (t_3 <= Float64(-Inf))
		tmp = Float64(Float64(Float64(c0 / w) / 2.0) * fma(t_0, Float64(Float64(d / D) * Float64(d / D)), fma(Float64(c0 / Float64(w * h)), t_4, M)));
	elseif (t_3 <= 0.0)
		tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h)));
	elseif (t_3 <= Inf)
		tmp = Float64(t_1 * Float64(Float64(Float64(t_4 * Float64(c0 / w)) / h) + Float64(sqrt(Float64(Float64(t_4 * t_0) - M)) * sqrt(fma(t_0, t_4, M)))));
	else
		tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0))));
	end
	return tmp
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] + N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * t$95$4 + M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(t$95$1 * N[(N[(N[(t$95$4 * N[(c0 / w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision] + N[(N[Sqrt[N[(N[(t$95$4 * t$95$0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$0 * t$95$4 + M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\frac{c0}{w}}{h}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_3 := t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\
t_4 := {\left(\frac{d}{D}\right)}^{2}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(t\_0, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(\frac{c0}{w \cdot h}, t\_4, M\right)\right)\\

\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\

\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_1 \cdot \left(\frac{t\_4 \cdot \frac{c0}{w}}{h} + \sqrt{t\_4 \cdot t\_0 - M} \cdot \sqrt{\mathsf{fma}\left(t\_0, t\_4, M\right)}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0

    1. Initial program 74.9%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified74.5%

      \[\leadsto \color{blue}{\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right) \cdot \mathsf{fma}\left(\frac{d \cdot d}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, -M\right)}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac74.4%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{d}{w} \cdot \frac{d}{h \cdot D}}, \frac{c0}{D}, -M\right)}\right) \]
    5. Applied egg-rr74.4%

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

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}}\right) \]
      2. pow279.2%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\color{blue}{{\left(\frac{d}{D}\right)}^{2}}, \frac{\frac{c0}{w}}{h}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}\right) \]
      3. associate-/l/79.2%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \color{blue}{\frac{c0}{h \cdot w}}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}\right) \]
      4. frac-times79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\frac{d \cdot d}{w \cdot \left(h \cdot D\right)}}, \frac{c0}{D}, -M\right)}\right) \]
      5. unpow279.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{\color{blue}{{d}^{2}}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, -M\right)}\right) \]
      6. add-sqr-sqrt47.7%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{-M} \cdot \sqrt{-M}}\right)}\right) \]
      7. sqrt-unprod79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{\left(-M\right) \cdot \left(-M\right)}}\right)}\right) \]
      8. sqr-neg79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \sqrt{\color{blue}{M \cdot M}}\right)}\right) \]
      9. sqrt-prod31.6%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{M} \cdot \sqrt{M}}\right)}\right) \]
      10. add-sqr-sqrt79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{M}\right)}\right) \]
    7. Applied egg-rr79.3%

      \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, M\right)}}\right) \]
    8. Simplified87.2%

      \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\mathsf{fma}\left(\frac{c0}{h \cdot w}, {\left(\frac{d}{D}\right)}^{2}, M\right)}\right) \]

    if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0

    1. Initial program 68.5%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified67.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 67.5%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*60.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac60.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*60.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified60.6%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 87.3%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*81.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified81.0%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}}{h}} \]
      2. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      3. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      4. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      5. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{d}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      6. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\sqrt{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      7. sqrt-prod34.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      8. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{M}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      9. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}}}{h}} \]
      10. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}}}{h}} \]
      11. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}}{h}} \]
      12. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{d}}{\sqrt{{M}^{2}}}}{h}} \]
      13. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\sqrt{\color{blue}{M \cdot M}}}}{h}} \]
      14. sqrt-prod40.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}}{h}} \]
      15. add-sqr-sqrt87.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{M}}}{h}} \]
    12. Applied egg-rr87.4%

      \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{d}{M} \cdot \frac{d}{M}}}{h}} \]

    if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0

    1. Initial program 73.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative73.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative73.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified71.2%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/r*71.3%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
      2. frac-times71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
      3. *-commutative71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{w}}{h}} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
      4. associate-*r/71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h}} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
      5. pow271.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{\color{blue}{{\left(\frac{d}{D}\right)}^{2}} \cdot \frac{c0}{w}}{h} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    6. Applied egg-rr71.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h}} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    7. Applied egg-rr79.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \color{blue}{\sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M} \cdot \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative79.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \color{blue}{\sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}}\right) \]
      2. associate-/r*79.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \sqrt{\mathsf{fma}\left(\color{blue}{\frac{\frac{c0}{w}}{h}}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}\right) \]
      3. associate-/r*82.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot {\left(\frac{d}{D}\right)}^{2} - M}\right) \]
    9. Simplified82.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \color{blue}{\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}}\right) \]

    if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M)))))

    1. Initial program 0.0%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified3.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 1.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified2.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 44.8%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*44.8%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified44.8%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. associate-/r/45.5%

        \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2}}} \cdot h\right)} \]
      2. add-sqr-sqrt45.5%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}} \cdot h\right) \]
      3. pow245.5%

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

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

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      7. add-sqr-sqrt53.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{d}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      8. unpow253.7%

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}\right)}^{2}} \cdot h\right) \]
      10. add-sqr-sqrt59.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{M}}\right)}^{2}} \cdot h\right) \]
    12. Applied egg-rr59.7%

      \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}} \cdot h\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification69.2%

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

Alternative 3: 62.2% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\frac{c0}{w}}{h}\\ t_1 := \frac{c0}{2 \cdot w}\\ t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\ t_3 := t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\ t_4 := {\left(\frac{d}{D}\right)}^{2}\\ t_5 := \frac{t\_4 \cdot \frac{c0}{w}}{h}\\ \mathbf{if}\;t\_3 \leq -\infty:\\ \;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(t\_0, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(\frac{c0}{w \cdot h}, t\_4, M\right)\right)\\ \mathbf{elif}\;t\_3 \leq 0:\\ \;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;t\_1 \cdot \left(t\_5 + \sqrt{\mathsf{fma}\left(t\_0, t\_4, M\right)} \cdot \sqrt{t\_5 - M}\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (/ c0 w) h))
        (t_1 (/ c0 (* 2.0 w)))
        (t_2 (/ (* c0 (* d d)) (* (* D D) (* w h))))
        (t_3 (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))))
        (t_4 (pow (/ d D) 2.0))
        (t_5 (/ (* t_4 (/ c0 w)) h)))
   (if (<= t_3 (- INFINITY))
     (*
      (/ (/ c0 w) 2.0)
      (fma t_0 (* (/ d D) (/ d D)) (fma (/ c0 (* w h)) t_4 M)))
     (if (<= t_3 0.0)
       (* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
       (if (<= t_3 INFINITY)
         (* t_1 (+ t_5 (* (sqrt (fma t_0 t_4 M)) (sqrt (- t_5 M)))))
         (* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 / w) / h;
	double t_1 = c0 / (2.0 * w);
	double t_2 = (c0 * (d * d)) / ((D * D) * (w * h));
	double t_3 = t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))));
	double t_4 = pow((d / D), 2.0);
	double t_5 = (t_4 * (c0 / w)) / h;
	double tmp;
	if (t_3 <= -((double) INFINITY)) {
		tmp = ((c0 / w) / 2.0) * fma(t_0, ((d / D) * (d / D)), fma((c0 / (w * h)), t_4, M));
	} else if (t_3 <= 0.0) {
		tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
	} else if (t_3 <= ((double) INFINITY)) {
		tmp = t_1 * (t_5 + (sqrt(fma(t_0, t_4, M)) * sqrt((t_5 - M))));
	} else {
		tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
	}
	return tmp;
}
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 / w) / h)
	t_1 = Float64(c0 / Float64(2.0 * w))
	t_2 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h)))
	t_3 = Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M)))))
	t_4 = Float64(d / D) ^ 2.0
	t_5 = Float64(Float64(t_4 * Float64(c0 / w)) / h)
	tmp = 0.0
	if (t_3 <= Float64(-Inf))
		tmp = Float64(Float64(Float64(c0 / w) / 2.0) * fma(t_0, Float64(Float64(d / D) * Float64(d / D)), fma(Float64(c0 / Float64(w * h)), t_4, M)));
	elseif (t_3 <= 0.0)
		tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h)));
	elseif (t_3 <= Inf)
		tmp = Float64(t_1 * Float64(t_5 + Float64(sqrt(fma(t_0, t_4, M)) * sqrt(Float64(t_5 - M)))));
	else
		tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0))));
	end
	return tmp
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$4 * N[(c0 / w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] + N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * t$95$4 + M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(t$95$1 * N[(t$95$5 + N[(N[Sqrt[N[(t$95$0 * t$95$4 + M), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$5 - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\frac{c0}{w}}{h}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_3 := t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\
t_4 := {\left(\frac{d}{D}\right)}^{2}\\
t_5 := \frac{t\_4 \cdot \frac{c0}{w}}{h}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(t\_0, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(\frac{c0}{w \cdot h}, t\_4, M\right)\right)\\

\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\

\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_1 \cdot \left(t\_5 + \sqrt{\mathsf{fma}\left(t\_0, t\_4, M\right)} \cdot \sqrt{t\_5 - M}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0

    1. Initial program 74.9%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified74.5%

      \[\leadsto \color{blue}{\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right) \cdot \mathsf{fma}\left(\frac{d \cdot d}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, -M\right)}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac74.4%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{d}{w} \cdot \frac{d}{h \cdot D}}, \frac{c0}{D}, -M\right)}\right) \]
    5. Applied egg-rr74.4%

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

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}}\right) \]
      2. pow279.2%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\color{blue}{{\left(\frac{d}{D}\right)}^{2}}, \frac{\frac{c0}{w}}{h}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}\right) \]
      3. associate-/l/79.2%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \color{blue}{\frac{c0}{h \cdot w}}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}\right) \]
      4. frac-times79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\frac{d \cdot d}{w \cdot \left(h \cdot D\right)}}, \frac{c0}{D}, -M\right)}\right) \]
      5. unpow279.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{\color{blue}{{d}^{2}}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, -M\right)}\right) \]
      6. add-sqr-sqrt47.7%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{-M} \cdot \sqrt{-M}}\right)}\right) \]
      7. sqrt-unprod79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{\left(-M\right) \cdot \left(-M\right)}}\right)}\right) \]
      8. sqr-neg79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \sqrt{\color{blue}{M \cdot M}}\right)}\right) \]
      9. sqrt-prod31.6%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{M} \cdot \sqrt{M}}\right)}\right) \]
      10. add-sqr-sqrt79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{M}\right)}\right) \]
    7. Applied egg-rr79.3%

      \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, M\right)}}\right) \]
    8. Simplified87.2%

      \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\mathsf{fma}\left(\frac{c0}{h \cdot w}, {\left(\frac{d}{D}\right)}^{2}, M\right)}\right) \]

    if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0

    1. Initial program 68.5%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified67.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 67.5%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*60.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac60.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*60.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified60.6%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 87.3%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*81.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified81.0%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}}{h}} \]
      2. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      3. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      4. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      5. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{d}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      6. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\sqrt{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      7. sqrt-prod34.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      8. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{M}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      9. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}}}{h}} \]
      10. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}}}{h}} \]
      11. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}}{h}} \]
      12. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{d}}{\sqrt{{M}^{2}}}}{h}} \]
      13. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\sqrt{\color{blue}{M \cdot M}}}}{h}} \]
      14. sqrt-prod40.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}}{h}} \]
      15. add-sqr-sqrt87.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{M}}}{h}} \]
    12. Applied egg-rr87.4%

      \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{d}{M} \cdot \frac{d}{M}}}{h}} \]

    if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0

    1. Initial program 73.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative73.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative73.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified71.2%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/r*71.3%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
      2. frac-times71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
      3. *-commutative71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{w}}{h}} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
      4. associate-*r/71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h}} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
      5. pow271.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{\color{blue}{{\left(\frac{d}{D}\right)}^{2}} \cdot \frac{c0}{w}}{h} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    6. Applied egg-rr71.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h}} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    7. Applied egg-rr79.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \color{blue}{\sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M} \cdot \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative79.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \color{blue}{\sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}}\right) \]
      2. associate-/r*79.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \sqrt{\mathsf{fma}\left(\color{blue}{\frac{\frac{c0}{w}}{h}}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}\right) \]
      3. associate-/r*82.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot {\left(\frac{d}{D}\right)}^{2} - M}\right) \]
    9. Simplified82.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \color{blue}{\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}}\right) \]
    10. Step-by-step derivation
      1. associate-*l/82.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\color{blue}{\frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}} - M}\right) \]
    11. Applied egg-rr82.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\color{blue}{\frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}} - M}\right) \]

    if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M)))))

    1. Initial program 0.0%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified3.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 1.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified2.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 44.8%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*44.8%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified44.8%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. associate-/r/45.5%

        \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2}}} \cdot h\right)} \]
      2. add-sqr-sqrt45.5%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}} \cdot h\right) \]
      3. pow245.5%

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

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

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      7. add-sqr-sqrt53.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{d}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      8. unpow253.7%

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}\right)}^{2}} \cdot h\right) \]
      10. add-sqr-sqrt59.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{M}}\right)}^{2}} \cdot h\right) \]
    12. Applied egg-rr59.7%

      \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}} \cdot h\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification69.2%

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

Alternative 4: 56.3% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\frac{c0}{w}}{h}\\ t_1 := \frac{c0}{2 \cdot w}\\ t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\ t_3 := t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\ t_4 := {\left(\frac{d}{D}\right)}^{2}\\ \mathbf{if}\;t\_3 \leq -\infty:\\ \;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(t\_0, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(\frac{c0}{w \cdot h}, t\_4, M\right)\right)\\ \mathbf{elif}\;t\_3 \leq 0:\\ \;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;t\_1 \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(t\_0, t\_4, M\right)}, \frac{d}{D} \cdot \frac{1}{\sqrt{\frac{h}{\frac{c0}{w}}}}, \frac{t\_4 \cdot \frac{c0}{w}}{h}\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (/ c0 w) h))
        (t_1 (/ c0 (* 2.0 w)))
        (t_2 (/ (* c0 (* d d)) (* (* D D) (* w h))))
        (t_3 (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))))
        (t_4 (pow (/ d D) 2.0)))
   (if (<= t_3 (- INFINITY))
     (*
      (/ (/ c0 w) 2.0)
      (fma t_0 (* (/ d D) (/ d D)) (fma (/ c0 (* w h)) t_4 M)))
     (if (<= t_3 0.0)
       (* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
       (if (<= t_3 INFINITY)
         (*
          t_1
          (fma
           (sqrt (fma t_0 t_4 M))
           (* (/ d D) (/ 1.0 (sqrt (/ h (/ c0 w)))))
           (/ (* t_4 (/ c0 w)) h)))
         (* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 / w) / h;
	double t_1 = c0 / (2.0 * w);
	double t_2 = (c0 * (d * d)) / ((D * D) * (w * h));
	double t_3 = t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))));
	double t_4 = pow((d / D), 2.0);
	double tmp;
	if (t_3 <= -((double) INFINITY)) {
		tmp = ((c0 / w) / 2.0) * fma(t_0, ((d / D) * (d / D)), fma((c0 / (w * h)), t_4, M));
	} else if (t_3 <= 0.0) {
		tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
	} else if (t_3 <= ((double) INFINITY)) {
		tmp = t_1 * fma(sqrt(fma(t_0, t_4, M)), ((d / D) * (1.0 / sqrt((h / (c0 / w))))), ((t_4 * (c0 / w)) / h));
	} else {
		tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
	}
	return tmp;
}
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 / w) / h)
	t_1 = Float64(c0 / Float64(2.0 * w))
	t_2 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h)))
	t_3 = Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M)))))
	t_4 = Float64(d / D) ^ 2.0
	tmp = 0.0
	if (t_3 <= Float64(-Inf))
		tmp = Float64(Float64(Float64(c0 / w) / 2.0) * fma(t_0, Float64(Float64(d / D) * Float64(d / D)), fma(Float64(c0 / Float64(w * h)), t_4, M)));
	elseif (t_3 <= 0.0)
		tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h)));
	elseif (t_3 <= Inf)
		tmp = Float64(t_1 * fma(sqrt(fma(t_0, t_4, M)), Float64(Float64(d / D) * Float64(1.0 / sqrt(Float64(h / Float64(c0 / w))))), Float64(Float64(t_4 * Float64(c0 / w)) / h)));
	else
		tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0))));
	end
	return tmp
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] + N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * t$95$4 + M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(t$95$1 * N[(N[Sqrt[N[(t$95$0 * t$95$4 + M), $MachinePrecision]], $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / N[(c0 / w), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$4 * N[(c0 / w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\frac{c0}{w}}{h}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_3 := t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\
t_4 := {\left(\frac{d}{D}\right)}^{2}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(t\_0, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(\frac{c0}{w \cdot h}, t\_4, M\right)\right)\\

\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\

\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(t\_0, t\_4, M\right)}, \frac{d}{D} \cdot \frac{1}{\sqrt{\frac{h}{\frac{c0}{w}}}}, \frac{t\_4 \cdot \frac{c0}{w}}{h}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0

    1. Initial program 74.9%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified74.5%

      \[\leadsto \color{blue}{\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right) \cdot \mathsf{fma}\left(\frac{d \cdot d}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, -M\right)}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac74.4%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{d}{w} \cdot \frac{d}{h \cdot D}}, \frac{c0}{D}, -M\right)}\right) \]
    5. Applied egg-rr74.4%

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

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}}\right) \]
      2. pow279.2%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\color{blue}{{\left(\frac{d}{D}\right)}^{2}}, \frac{\frac{c0}{w}}{h}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}\right) \]
      3. associate-/l/79.2%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \color{blue}{\frac{c0}{h \cdot w}}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}\right) \]
      4. frac-times79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\frac{d \cdot d}{w \cdot \left(h \cdot D\right)}}, \frac{c0}{D}, -M\right)}\right) \]
      5. unpow279.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{\color{blue}{{d}^{2}}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, -M\right)}\right) \]
      6. add-sqr-sqrt47.7%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{-M} \cdot \sqrt{-M}}\right)}\right) \]
      7. sqrt-unprod79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{\left(-M\right) \cdot \left(-M\right)}}\right)}\right) \]
      8. sqr-neg79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \sqrt{\color{blue}{M \cdot M}}\right)}\right) \]
      9. sqrt-prod31.6%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{M} \cdot \sqrt{M}}\right)}\right) \]
      10. add-sqr-sqrt79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{M}\right)}\right) \]
    7. Applied egg-rr79.3%

      \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, M\right)}}\right) \]
    8. Simplified87.2%

      \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\mathsf{fma}\left(\frac{c0}{h \cdot w}, {\left(\frac{d}{D}\right)}^{2}, M\right)}\right) \]

    if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0

    1. Initial program 68.5%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified67.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 67.5%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*60.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac60.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*60.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified60.6%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 87.3%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*81.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified81.0%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}}{h}} \]
      2. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      3. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      4. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      5. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{d}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      6. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\sqrt{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      7. sqrt-prod34.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      8. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{M}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      9. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}}}{h}} \]
      10. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}}}{h}} \]
      11. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}}{h}} \]
      12. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{d}}{\sqrt{{M}^{2}}}}{h}} \]
      13. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\sqrt{\color{blue}{M \cdot M}}}}{h}} \]
      14. sqrt-prod40.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}}{h}} \]
      15. add-sqr-sqrt87.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{M}}}{h}} \]
    12. Applied egg-rr87.4%

      \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{d}{M} \cdot \frac{d}{M}}}{h}} \]

    if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0

    1. Initial program 73.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative73.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative73.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified71.2%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Applied egg-rr79.8%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)} \]
    6. Step-by-step derivation
      1. associate-/r*79.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\color{blue}{\frac{\frac{c0}{w}}{h}}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      2. associate-/r*79.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      3. associate-/r*82.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \color{blue}{\frac{\frac{c0}{w}}{h}} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
    7. Simplified82.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)} \]
    8. Step-by-step derivation
      1. associate-*l/82.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\color{blue}{\frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}} - M}\right) \]
    9. Applied egg-rr82.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \color{blue}{\frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}}\right) \]
    10. Taylor expanded in d around inf 40.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \color{blue}{\frac{d}{D} \cdot \sqrt{\frac{c0}{h \cdot w}}}, \frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}\right) \]
    11. Step-by-step derivation
      1. clear-num40.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \frac{d}{D} \cdot \sqrt{\color{blue}{\frac{1}{\frac{h \cdot w}{c0}}}}, \frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}\right) \]
      2. sqrt-div39.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \frac{d}{D} \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{\frac{h \cdot w}{c0}}}}, \frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}\right) \]
      3. metadata-eval39.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \frac{d}{D} \cdot \frac{\color{blue}{1}}{\sqrt{\frac{h \cdot w}{c0}}}, \frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}\right) \]
    12. Applied egg-rr39.8%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \frac{d}{D} \cdot \color{blue}{\frac{1}{\sqrt{\frac{h \cdot w}{c0}}}}, \frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}\right) \]
    13. Step-by-step derivation
      1. associate-/l*40.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \frac{d}{D} \cdot \frac{1}{\sqrt{\color{blue}{\frac{h}{\frac{c0}{w}}}}}, \frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}\right) \]
    14. Simplified40.0%

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

    if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M)))))

    1. Initial program 0.0%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified3.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 1.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified2.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 44.8%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*44.8%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified44.8%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. associate-/r/45.5%

        \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2}}} \cdot h\right)} \]
      2. add-sqr-sqrt45.5%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}} \cdot h\right) \]
      3. pow245.5%

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

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

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      7. add-sqr-sqrt53.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{d}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      8. unpow253.7%

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}\right)}^{2}} \cdot h\right) \]
      10. add-sqr-sqrt59.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{M}}\right)}^{2}} \cdot h\right) \]
    12. Applied egg-rr59.7%

      \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}} \cdot h\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification62.0%

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

Alternative 5: 62.0% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{w \cdot h}\\ t_1 := \frac{c0}{2 \cdot w}\\ t_2 := {\left(\frac{d}{D}\right)}^{2}\\ t_3 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\ t_4 := t\_1 \cdot \left(t\_3 + \sqrt{t\_3 \cdot t\_3 - M \cdot M}\right)\\ t_5 := \frac{d}{D} \cdot \sqrt{t\_0}\\ \mathbf{if}\;t\_4 \leq -\infty:\\ \;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(t\_0, t\_2, M\right)\right)\\ \mathbf{elif}\;t\_4 \leq 0:\\ \;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\ \mathbf{elif}\;t\_4 \leq \infty:\\ \;\;\;\;t\_1 \cdot \mathsf{fma}\left(0.5 \cdot \left(\frac{D \cdot M}{d} \cdot \sqrt{\frac{w \cdot h}{c0}}\right) + t\_5, t\_5, \frac{t\_2 \cdot \frac{c0}{w}}{h}\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ c0 (* w h)))
        (t_1 (/ c0 (* 2.0 w)))
        (t_2 (pow (/ d D) 2.0))
        (t_3 (/ (* c0 (* d d)) (* (* D D) (* w h))))
        (t_4 (* t_1 (+ t_3 (sqrt (- (* t_3 t_3) (* M M))))))
        (t_5 (* (/ d D) (sqrt t_0))))
   (if (<= t_4 (- INFINITY))
     (*
      (/ (/ c0 w) 2.0)
      (fma (/ (/ c0 w) h) (* (/ d D) (/ d D)) (fma t_0 t_2 M)))
     (if (<= t_4 0.0)
       (* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
       (if (<= t_4 INFINITY)
         (*
          t_1
          (fma
           (+ (* 0.5 (* (/ (* D M) d) (sqrt (/ (* w h) c0)))) t_5)
           t_5
           (/ (* t_2 (/ c0 w)) h)))
         (* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (w * h);
	double t_1 = c0 / (2.0 * w);
	double t_2 = pow((d / D), 2.0);
	double t_3 = (c0 * (d * d)) / ((D * D) * (w * h));
	double t_4 = t_1 * (t_3 + sqrt(((t_3 * t_3) - (M * M))));
	double t_5 = (d / D) * sqrt(t_0);
	double tmp;
	if (t_4 <= -((double) INFINITY)) {
		tmp = ((c0 / w) / 2.0) * fma(((c0 / w) / h), ((d / D) * (d / D)), fma(t_0, t_2, M));
	} else if (t_4 <= 0.0) {
		tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
	} else if (t_4 <= ((double) INFINITY)) {
		tmp = t_1 * fma(((0.5 * (((D * M) / d) * sqrt(((w * h) / c0)))) + t_5), t_5, ((t_2 * (c0 / w)) / h));
	} else {
		tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
	}
	return tmp;
}
function code(c0, w, h, D, d, M)
	t_0 = Float64(c0 / Float64(w * h))
	t_1 = Float64(c0 / Float64(2.0 * w))
	t_2 = Float64(d / D) ^ 2.0
	t_3 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h)))
	t_4 = Float64(t_1 * Float64(t_3 + sqrt(Float64(Float64(t_3 * t_3) - Float64(M * M)))))
	t_5 = Float64(Float64(d / D) * sqrt(t_0))
	tmp = 0.0
	if (t_4 <= Float64(-Inf))
		tmp = Float64(Float64(Float64(c0 / w) / 2.0) * fma(Float64(Float64(c0 / w) / h), Float64(Float64(d / D) * Float64(d / D)), fma(t_0, t_2, M)));
	elseif (t_4 <= 0.0)
		tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h)));
	elseif (t_4 <= Inf)
		tmp = Float64(t_1 * fma(Float64(Float64(0.5 * Float64(Float64(Float64(D * M) / d) * sqrt(Float64(Float64(w * h) / c0)))) + t_5), t_5, Float64(Float64(t_2 * Float64(c0 / w)) / h)));
	else
		tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0))));
	end
	return tmp
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * N[(t$95$3 + N[Sqrt[N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(d / D), $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * t$95$2 + M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(t$95$1 * N[(N[(N[(0.5 * N[(N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(N[(w * h), $MachinePrecision] / c0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$5), $MachinePrecision] * t$95$5 + N[(N[(t$95$2 * N[(c0 / w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := {\left(\frac{d}{D}\right)}^{2}\\
t_3 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_4 := t\_1 \cdot \left(t\_3 + \sqrt{t\_3 \cdot t\_3 - M \cdot M}\right)\\
t_5 := \frac{d}{D} \cdot \sqrt{t\_0}\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(t\_0, t\_2, M\right)\right)\\

\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\

\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(0.5 \cdot \left(\frac{D \cdot M}{d} \cdot \sqrt{\frac{w \cdot h}{c0}}\right) + t\_5, t\_5, \frac{t\_2 \cdot \frac{c0}{w}}{h}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0

    1. Initial program 74.9%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified74.5%

      \[\leadsto \color{blue}{\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right) \cdot \mathsf{fma}\left(\frac{d \cdot d}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, -M\right)}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac74.4%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{d}{w} \cdot \frac{d}{h \cdot D}}, \frac{c0}{D}, -M\right)}\right) \]
    5. Applied egg-rr74.4%

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

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}}\right) \]
      2. pow279.2%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\color{blue}{{\left(\frac{d}{D}\right)}^{2}}, \frac{\frac{c0}{w}}{h}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}\right) \]
      3. associate-/l/79.2%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \color{blue}{\frac{c0}{h \cdot w}}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}\right) \]
      4. frac-times79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\frac{d \cdot d}{w \cdot \left(h \cdot D\right)}}, \frac{c0}{D}, -M\right)}\right) \]
      5. unpow279.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{\color{blue}{{d}^{2}}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, -M\right)}\right) \]
      6. add-sqr-sqrt47.7%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{-M} \cdot \sqrt{-M}}\right)}\right) \]
      7. sqrt-unprod79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{\left(-M\right) \cdot \left(-M\right)}}\right)}\right) \]
      8. sqr-neg79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \sqrt{\color{blue}{M \cdot M}}\right)}\right) \]
      9. sqrt-prod31.6%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{M} \cdot \sqrt{M}}\right)}\right) \]
      10. add-sqr-sqrt79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{M}\right)}\right) \]
    7. Applied egg-rr79.3%

      \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, M\right)}}\right) \]
    8. Simplified87.2%

      \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\mathsf{fma}\left(\frac{c0}{h \cdot w}, {\left(\frac{d}{D}\right)}^{2}, M\right)}\right) \]

    if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0

    1. Initial program 68.5%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified67.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 67.5%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*60.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac60.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*60.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified60.6%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 87.3%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*81.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified81.0%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}}{h}} \]
      2. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      3. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      4. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      5. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{d}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      6. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\sqrt{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      7. sqrt-prod34.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      8. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{M}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      9. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}}}{h}} \]
      10. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}}}{h}} \]
      11. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}}{h}} \]
      12. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{d}}{\sqrt{{M}^{2}}}}{h}} \]
      13. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\sqrt{\color{blue}{M \cdot M}}}}{h}} \]
      14. sqrt-prod40.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}}{h}} \]
      15. add-sqr-sqrt87.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{M}}}{h}} \]
    12. Applied egg-rr87.4%

      \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{d}{M} \cdot \frac{d}{M}}}{h}} \]

    if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0

    1. Initial program 73.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative73.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative73.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified71.2%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Applied egg-rr79.8%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)} \]
    6. Step-by-step derivation
      1. associate-/r*79.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\color{blue}{\frac{\frac{c0}{w}}{h}}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      2. associate-/r*79.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      3. associate-/r*82.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \color{blue}{\frac{\frac{c0}{w}}{h}} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
    7. Simplified82.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)} \]
    8. Step-by-step derivation
      1. associate-*l/82.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)} \cdot \sqrt{\color{blue}{\frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}} - M}\right) \]
    9. Applied egg-rr82.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}, \color{blue}{\frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}}\right) \]
    10. Taylor expanded in d around inf 40.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \color{blue}{\frac{d}{D} \cdot \sqrt{\frac{c0}{h \cdot w}}}, \frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}\right) \]
    11. Taylor expanded in d around inf 80.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\color{blue}{0.5 \cdot \left(\frac{D \cdot M}{d} \cdot \sqrt{\frac{h \cdot w}{c0}}\right) + \frac{d}{D} \cdot \sqrt{\frac{c0}{h \cdot w}}}, \frac{d}{D} \cdot \sqrt{\frac{c0}{h \cdot w}}, \frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}\right) \]

    if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M)))))

    1. Initial program 0.0%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified3.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 1.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified2.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 44.8%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*44.8%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified44.8%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. associate-/r/45.5%

        \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2}}} \cdot h\right)} \]
      2. add-sqr-sqrt45.5%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}} \cdot h\right) \]
      3. pow245.5%

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

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

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      7. add-sqr-sqrt53.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{d}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      8. unpow253.7%

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}\right)}^{2}} \cdot h\right) \]
      10. add-sqr-sqrt59.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{M}}\right)}^{2}} \cdot h\right) \]
    12. Applied egg-rr59.7%

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

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

Alternative 6: 62.1% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{w \cdot h}\\ t_1 := {\left(\frac{d}{D}\right)}^{2}\\ t_2 := t\_0 \cdot t\_1\\ t_3 := \frac{c0}{2 \cdot w}\\ t_4 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\ t_5 := t\_3 \cdot \left(t\_4 + \sqrt{t\_4 \cdot t\_4 - M \cdot M}\right)\\ \mathbf{if}\;t\_5 \leq -\infty:\\ \;\;\;\;t\_3 \cdot \left(t\_2 + t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\ \mathbf{elif}\;t\_5 \leq 0:\\ \;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\ \mathbf{elif}\;t\_5 \leq \infty:\\ \;\;\;\;t\_3 \cdot \left(t\_1 \cdot \frac{\frac{c0}{w}}{h} + t\_2\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ c0 (* w h)))
        (t_1 (pow (/ d D) 2.0))
        (t_2 (* t_0 t_1))
        (t_3 (/ c0 (* 2.0 w)))
        (t_4 (/ (* c0 (* d d)) (* (* D D) (* w h))))
        (t_5 (* t_3 (+ t_4 (sqrt (- (* t_4 t_4) (* M M)))))))
   (if (<= t_5 (- INFINITY))
     (* t_3 (+ t_2 (* t_0 (* (/ d D) (/ d D)))))
     (if (<= t_5 0.0)
       (* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
       (if (<= t_5 INFINITY)
         (* t_3 (+ (* t_1 (/ (/ c0 w) h)) t_2))
         (* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (w * h);
	double t_1 = pow((d / D), 2.0);
	double t_2 = t_0 * t_1;
	double t_3 = c0 / (2.0 * w);
	double t_4 = (c0 * (d * d)) / ((D * D) * (w * h));
	double t_5 = t_3 * (t_4 + sqrt(((t_4 * t_4) - (M * M))));
	double tmp;
	if (t_5 <= -((double) INFINITY)) {
		tmp = t_3 * (t_2 + (t_0 * ((d / D) * (d / D))));
	} else if (t_5 <= 0.0) {
		tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
	} else if (t_5 <= ((double) INFINITY)) {
		tmp = t_3 * ((t_1 * ((c0 / w) / h)) + t_2);
	} else {
		tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
	}
	return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (w * h);
	double t_1 = Math.pow((d / D), 2.0);
	double t_2 = t_0 * t_1;
	double t_3 = c0 / (2.0 * w);
	double t_4 = (c0 * (d * d)) / ((D * D) * (w * h));
	double t_5 = t_3 * (t_4 + Math.sqrt(((t_4 * t_4) - (M * M))));
	double tmp;
	if (t_5 <= -Double.POSITIVE_INFINITY) {
		tmp = t_3 * (t_2 + (t_0 * ((d / D) * (d / D))));
	} else if (t_5 <= 0.0) {
		tmp = 0.25 * (Math.pow(D, 2.0) / (((d / M) * (d / M)) / h));
	} else if (t_5 <= Double.POSITIVE_INFINITY) {
		tmp = t_3 * ((t_1 * ((c0 / w) / h)) + t_2);
	} else {
		tmp = 0.25 * (h * (Math.pow(D, 2.0) / Math.pow((d / M), 2.0)));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = c0 / (w * h)
	t_1 = math.pow((d / D), 2.0)
	t_2 = t_0 * t_1
	t_3 = c0 / (2.0 * w)
	t_4 = (c0 * (d * d)) / ((D * D) * (w * h))
	t_5 = t_3 * (t_4 + math.sqrt(((t_4 * t_4) - (M * M))))
	tmp = 0
	if t_5 <= -math.inf:
		tmp = t_3 * (t_2 + (t_0 * ((d / D) * (d / D))))
	elif t_5 <= 0.0:
		tmp = 0.25 * (math.pow(D, 2.0) / (((d / M) * (d / M)) / h))
	elif t_5 <= math.inf:
		tmp = t_3 * ((t_1 * ((c0 / w) / h)) + t_2)
	else:
		tmp = 0.25 * (h * (math.pow(D, 2.0) / math.pow((d / M), 2.0)))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(c0 / Float64(w * h))
	t_1 = Float64(d / D) ^ 2.0
	t_2 = Float64(t_0 * t_1)
	t_3 = Float64(c0 / Float64(2.0 * w))
	t_4 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h)))
	t_5 = Float64(t_3 * Float64(t_4 + sqrt(Float64(Float64(t_4 * t_4) - Float64(M * M)))))
	tmp = 0.0
	if (t_5 <= Float64(-Inf))
		tmp = Float64(t_3 * Float64(t_2 + Float64(t_0 * Float64(Float64(d / D) * Float64(d / D)))));
	elseif (t_5 <= 0.0)
		tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h)));
	elseif (t_5 <= Inf)
		tmp = Float64(t_3 * Float64(Float64(t_1 * Float64(Float64(c0 / w) / h)) + t_2));
	else
		tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = c0 / (w * h);
	t_1 = (d / D) ^ 2.0;
	t_2 = t_0 * t_1;
	t_3 = c0 / (2.0 * w);
	t_4 = (c0 * (d * d)) / ((D * D) * (w * h));
	t_5 = t_3 * (t_4 + sqrt(((t_4 * t_4) - (M * M))));
	tmp = 0.0;
	if (t_5 <= -Inf)
		tmp = t_3 * (t_2 + (t_0 * ((d / D) * (d / D))));
	elseif (t_5 <= 0.0)
		tmp = 0.25 * ((D ^ 2.0) / (((d / M) * (d / M)) / h));
	elseif (t_5 <= Inf)
		tmp = t_3 * ((t_1 * ((c0 / w) / h)) + t_2);
	else
		tmp = 0.25 * (h * ((D ^ 2.0) / ((d / M) ^ 2.0)));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$3 * N[(t$95$4 + N[Sqrt[N[(N[(t$95$4 * t$95$4), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$5, (-Infinity)], N[(t$95$3 * N[(t$95$2 + N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, Infinity], N[(t$95$3 * N[(N[(t$95$1 * N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := {\left(\frac{d}{D}\right)}^{2}\\
t_2 := t\_0 \cdot t\_1\\
t_3 := \frac{c0}{2 \cdot w}\\
t_4 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_5 := t\_3 \cdot \left(t\_4 + \sqrt{t\_4 \cdot t\_4 - M \cdot M}\right)\\
\mathbf{if}\;t\_5 \leq -\infty:\\
\;\;\;\;t\_3 \cdot \left(t\_2 + t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\

\mathbf{elif}\;t\_5 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\

\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;t\_3 \cdot \left(t\_1 \cdot \frac{\frac{c0}{w}}{h} + t\_2\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0

    1. Initial program 74.9%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative74.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative74.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac74.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg74.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified74.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-times74.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    6. Applied egg-rr74.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    7. Taylor expanded in c0 around inf 79.8%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative79.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \color{blue}{\left(w \cdot h\right)}}\right) \]
      2. *-commutative79.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{\color{blue}{\left(w \cdot h\right) \cdot {D}^{2}}}\right) \]
      3. times-frac79.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{w \cdot h} \cdot \frac{{d}^{2}}{{D}^{2}}}\right) \]
      4. *-commutative79.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{\color{blue}{h \cdot w}} \cdot \frac{{d}^{2}}{{D}^{2}}\right) \]
      5. unpow279.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{{d}^{2}}{\color{blue}{D \cdot D}}\right) \]
      6. associate-/r*79.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}\right) \]
      7. unpow279.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\frac{\color{blue}{d \cdot d}}{D}}{D}\right) \]
      8. associate-*l/79.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\color{blue}{\frac{d}{D} \cdot d}}{D}\right) \]
      9. associate-*r/79.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      10. unpow279.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right) \]
    9. Simplified79.8%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}}\right) \]
    10. Step-by-step derivation
      1. frac-times74.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    11. Applied egg-rr87.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]

    if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0

    1. Initial program 68.5%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified67.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 67.5%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*60.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac60.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*60.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified60.6%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 87.3%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*81.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified81.0%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}}{h}} \]
      2. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      3. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      4. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      5. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{d}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      6. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\sqrt{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      7. sqrt-prod34.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      8. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{M}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      9. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}}}{h}} \]
      10. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}}}{h}} \]
      11. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}}{h}} \]
      12. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{d}}{\sqrt{{M}^{2}}}}{h}} \]
      13. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\sqrt{\color{blue}{M \cdot M}}}}{h}} \]
      14. sqrt-prod40.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}}{h}} \]
      15. add-sqr-sqrt87.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{M}}}{h}} \]
    12. Applied egg-rr87.4%

      \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{d}{M} \cdot \frac{d}{M}}}{h}} \]

    if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0

    1. Initial program 73.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative73.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative73.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified71.2%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-times71.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    6. Applied egg-rr71.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    7. Taylor expanded in c0 around inf 71.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \color{blue}{\left(w \cdot h\right)}}\right) \]
      2. *-commutative71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{\color{blue}{\left(w \cdot h\right) \cdot {D}^{2}}}\right) \]
      3. times-frac71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{w \cdot h} \cdot \frac{{d}^{2}}{{D}^{2}}}\right) \]
      4. *-commutative71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{\color{blue}{h \cdot w}} \cdot \frac{{d}^{2}}{{D}^{2}}\right) \]
      5. unpow271.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{{d}^{2}}{\color{blue}{D \cdot D}}\right) \]
      6. associate-/r*71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}\right) \]
      7. unpow271.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\frac{\color{blue}{d \cdot d}}{D}}{D}\right) \]
      8. associate-*l/71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\color{blue}{\frac{d}{D} \cdot d}}{D}\right) \]
      9. associate-*r/71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      10. unpow271.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right) \]
    9. Simplified71.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}}\right) \]
    10. Step-by-step derivation
      1. expm1-log1p-u70.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right)\right)} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      2. expm1-udef70.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right)} - 1\right)} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      3. frac-times76.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(e^{\mathsf{log1p}\left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right)} - 1\right) + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      4. pow276.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(e^{\mathsf{log1p}\left(\frac{c0}{w \cdot h} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right)} - 1\right) + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
    11. Applied egg-rr76.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)} - 1\right)} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
    12. Step-by-step derivation
      1. expm1-def79.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      2. expm1-log1p79.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      3. associate-/r*80.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot {\left(\frac{d}{D}\right)}^{2} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
    13. Simplified80.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]

    if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M)))))

    1. Initial program 0.0%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified3.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 1.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified2.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 44.8%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*44.8%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified44.8%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. associate-/r/45.5%

        \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2}}} \cdot h\right)} \]
      2. add-sqr-sqrt45.5%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}} \cdot h\right) \]
      3. pow245.5%

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

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

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      7. add-sqr-sqrt53.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{d}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      8. unpow253.7%

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}\right)}^{2}} \cdot h\right) \]
      10. add-sqr-sqrt59.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{M}}\right)}^{2}} \cdot h\right) \]
    12. Applied egg-rr59.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} - M \cdot M}\right) \leq -\infty:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \frac{c0}{w \cdot h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\ \mathbf{elif}\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} - M \cdot M}\right) \leq 0:\\ \;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\ \mathbf{elif}\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} - M \cdot M}\right) \leq \infty:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{\frac{c0}{w}}{h} + \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 62.1% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\frac{c0}{w}}{h}\\ t_1 := \frac{c0}{w \cdot h}\\ t_2 := \frac{c0}{2 \cdot w}\\ t_3 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\ t_4 := t\_2 \cdot \left(t\_3 + \sqrt{t\_3 \cdot t\_3 - M \cdot M}\right)\\ t_5 := {\left(\frac{d}{D}\right)}^{2}\\ \mathbf{if}\;t\_4 \leq -\infty:\\ \;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(t\_0, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(t\_1, t\_5, M\right)\right)\\ \mathbf{elif}\;t\_4 \leq 0:\\ \;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\ \mathbf{elif}\;t\_4 \leq \infty:\\ \;\;\;\;t\_2 \cdot \left(t\_5 \cdot t\_0 + t\_1 \cdot t\_5\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (/ c0 w) h))
        (t_1 (/ c0 (* w h)))
        (t_2 (/ c0 (* 2.0 w)))
        (t_3 (/ (* c0 (* d d)) (* (* D D) (* w h))))
        (t_4 (* t_2 (+ t_3 (sqrt (- (* t_3 t_3) (* M M))))))
        (t_5 (pow (/ d D) 2.0)))
   (if (<= t_4 (- INFINITY))
     (* (/ (/ c0 w) 2.0) (fma t_0 (* (/ d D) (/ d D)) (fma t_1 t_5 M)))
     (if (<= t_4 0.0)
       (* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
       (if (<= t_4 INFINITY)
         (* t_2 (+ (* t_5 t_0) (* t_1 t_5)))
         (* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 / w) / h;
	double t_1 = c0 / (w * h);
	double t_2 = c0 / (2.0 * w);
	double t_3 = (c0 * (d * d)) / ((D * D) * (w * h));
	double t_4 = t_2 * (t_3 + sqrt(((t_3 * t_3) - (M * M))));
	double t_5 = pow((d / D), 2.0);
	double tmp;
	if (t_4 <= -((double) INFINITY)) {
		tmp = ((c0 / w) / 2.0) * fma(t_0, ((d / D) * (d / D)), fma(t_1, t_5, M));
	} else if (t_4 <= 0.0) {
		tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
	} else if (t_4 <= ((double) INFINITY)) {
		tmp = t_2 * ((t_5 * t_0) + (t_1 * t_5));
	} else {
		tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
	}
	return tmp;
}
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 / w) / h)
	t_1 = Float64(c0 / Float64(w * h))
	t_2 = Float64(c0 / Float64(2.0 * w))
	t_3 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h)))
	t_4 = Float64(t_2 * Float64(t_3 + sqrt(Float64(Float64(t_3 * t_3) - Float64(M * M)))))
	t_5 = Float64(d / D) ^ 2.0
	tmp = 0.0
	if (t_4 <= Float64(-Inf))
		tmp = Float64(Float64(Float64(c0 / w) / 2.0) * fma(t_0, Float64(Float64(d / D) * Float64(d / D)), fma(t_1, t_5, M)));
	elseif (t_4 <= 0.0)
		tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h)));
	elseif (t_4 <= Inf)
		tmp = Float64(t_2 * Float64(Float64(t_5 * t_0) + Float64(t_1 * t_5)));
	else
		tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0))));
	end
	return tmp
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 * N[(t$95$3 + N[Sqrt[N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * t$95$5 + M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(t$95$2 * N[(N[(t$95$5 * t$95$0), $MachinePrecision] + N[(t$95$1 * t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\frac{c0}{w}}{h}\\
t_1 := \frac{c0}{w \cdot h}\\
t_2 := \frac{c0}{2 \cdot w}\\
t_3 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_4 := t\_2 \cdot \left(t\_3 + \sqrt{t\_3 \cdot t\_3 - M \cdot M}\right)\\
t_5 := {\left(\frac{d}{D}\right)}^{2}\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(t\_0, \frac{d}{D} \cdot \frac{d}{D}, \mathsf{fma}\left(t\_1, t\_5, M\right)\right)\\

\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\

\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_2 \cdot \left(t\_5 \cdot t\_0 + t\_1 \cdot t\_5\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0

    1. Initial program 74.9%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified74.5%

      \[\leadsto \color{blue}{\frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right) \cdot \mathsf{fma}\left(\frac{d \cdot d}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, -M\right)}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac74.4%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{d}{w} \cdot \frac{d}{h \cdot D}}, \frac{c0}{D}, -M\right)}\right) \]
    5. Applied egg-rr74.4%

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

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\sqrt{\mathsf{fma}\left(\frac{d}{D} \cdot \frac{d}{D}, \frac{\frac{c0}{w}}{h}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}}\right) \]
      2. pow279.2%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\color{blue}{{\left(\frac{d}{D}\right)}^{2}}, \frac{\frac{c0}{w}}{h}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}\right) \]
      3. associate-/l/79.2%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \color{blue}{\frac{c0}{h \cdot w}}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{d}{w} \cdot \frac{d}{h \cdot D}, \frac{c0}{D}, -M\right)}\right) \]
      4. frac-times79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\color{blue}{\frac{d \cdot d}{w \cdot \left(h \cdot D\right)}}, \frac{c0}{D}, -M\right)}\right) \]
      5. unpow279.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{\color{blue}{{d}^{2}}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, -M\right)}\right) \]
      6. add-sqr-sqrt47.7%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{-M} \cdot \sqrt{-M}}\right)}\right) \]
      7. sqrt-unprod79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{\left(-M\right) \cdot \left(-M\right)}}\right)}\right) \]
      8. sqr-neg79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \sqrt{\color{blue}{M \cdot M}}\right)}\right) \]
      9. sqrt-prod31.6%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{\sqrt{M} \cdot \sqrt{M}}\right)}\right) \]
      10. add-sqr-sqrt79.3%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, \color{blue}{M}\right)}\right) \]
    7. Applied egg-rr79.3%

      \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\sqrt{\mathsf{fma}\left({\left(\frac{d}{D}\right)}^{2}, \frac{c0}{h \cdot w}, M\right)} \cdot \sqrt{\mathsf{fma}\left(\frac{{d}^{2}}{w \cdot \left(h \cdot D\right)}, \frac{c0}{D}, M\right)}}\right) \]
    8. Simplified87.2%

      \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \color{blue}{\mathsf{fma}\left(\frac{c0}{h \cdot w}, {\left(\frac{d}{D}\right)}^{2}, M\right)}\right) \]

    if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0

    1. Initial program 68.5%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified67.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 67.5%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*60.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac60.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*60.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified60.6%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 87.3%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*81.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified81.0%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}}{h}} \]
      2. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      3. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      4. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      5. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{d}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      6. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\sqrt{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      7. sqrt-prod34.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      8. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{M}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      9. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}}}{h}} \]
      10. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}}}{h}} \]
      11. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}}{h}} \]
      12. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{d}}{\sqrt{{M}^{2}}}}{h}} \]
      13. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\sqrt{\color{blue}{M \cdot M}}}}{h}} \]
      14. sqrt-prod40.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}}{h}} \]
      15. add-sqr-sqrt87.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{M}}}{h}} \]
    12. Applied egg-rr87.4%

      \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{d}{M} \cdot \frac{d}{M}}}{h}} \]

    if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0

    1. Initial program 73.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative73.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative73.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified71.2%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-times71.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    6. Applied egg-rr71.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    7. Taylor expanded in c0 around inf 71.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \color{blue}{\left(w \cdot h\right)}}\right) \]
      2. *-commutative71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{\color{blue}{\left(w \cdot h\right) \cdot {D}^{2}}}\right) \]
      3. times-frac71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{w \cdot h} \cdot \frac{{d}^{2}}{{D}^{2}}}\right) \]
      4. *-commutative71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{\color{blue}{h \cdot w}} \cdot \frac{{d}^{2}}{{D}^{2}}\right) \]
      5. unpow271.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{{d}^{2}}{\color{blue}{D \cdot D}}\right) \]
      6. associate-/r*71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}\right) \]
      7. unpow271.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\frac{\color{blue}{d \cdot d}}{D}}{D}\right) \]
      8. associate-*l/71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\color{blue}{\frac{d}{D} \cdot d}}{D}\right) \]
      9. associate-*r/71.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      10. unpow271.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right) \]
    9. Simplified71.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}}\right) \]
    10. Step-by-step derivation
      1. expm1-log1p-u70.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right)\right)} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      2. expm1-udef70.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right)} - 1\right)} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      3. frac-times76.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(e^{\mathsf{log1p}\left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right)} - 1\right) + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      4. pow276.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(e^{\mathsf{log1p}\left(\frac{c0}{w \cdot h} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right)} - 1\right) + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
    11. Applied egg-rr76.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(e^{\mathsf{log1p}\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)} - 1\right)} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
    12. Step-by-step derivation
      1. expm1-def79.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      2. expm1-log1p79.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
      3. associate-/r*80.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot {\left(\frac{d}{D}\right)}^{2} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]
    13. Simplified80.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]

    if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M)))))

    1. Initial program 0.0%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified3.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 1.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified2.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 44.8%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*44.8%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified44.8%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. associate-/r/45.5%

        \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2}}} \cdot h\right)} \]
      2. add-sqr-sqrt45.5%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}} \cdot h\right) \]
      3. pow245.5%

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

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

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      7. add-sqr-sqrt53.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{d}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      8. unpow253.7%

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}\right)}^{2}} \cdot h\right) \]
      10. add-sqr-sqrt59.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{M}}\right)}^{2}} \cdot h\right) \]
    12. Applied egg-rr59.7%

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

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

Alternative 8: 62.1% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{w \cdot h}\\ t_1 := \frac{c0}{2 \cdot w}\\ t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\ t_3 := t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\ t_4 := t\_1 \cdot \left(t\_0 \cdot {\left(\frac{d}{D}\right)}^{2} + t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\ \mathbf{if}\;t\_3 \leq -\infty:\\ \;\;\;\;t\_4\\ \mathbf{elif}\;t\_3 \leq 0:\\ \;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;t\_4\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ c0 (* w h)))
        (t_1 (/ c0 (* 2.0 w)))
        (t_2 (/ (* c0 (* d d)) (* (* D D) (* w h))))
        (t_3 (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))))
        (t_4
         (* t_1 (+ (* t_0 (pow (/ d D) 2.0)) (* t_0 (* (/ d D) (/ d D)))))))
   (if (<= t_3 (- INFINITY))
     t_4
     (if (<= t_3 0.0)
       (* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
       (if (<= t_3 INFINITY)
         t_4
         (* 0.25 (* h (/ (pow D 2.0) (pow (/ d M) 2.0)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (w * h);
	double t_1 = c0 / (2.0 * w);
	double t_2 = (c0 * (d * d)) / ((D * D) * (w * h));
	double t_3 = t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))));
	double t_4 = t_1 * ((t_0 * pow((d / D), 2.0)) + (t_0 * ((d / D) * (d / D))));
	double tmp;
	if (t_3 <= -((double) INFINITY)) {
		tmp = t_4;
	} else if (t_3 <= 0.0) {
		tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
	} else if (t_3 <= ((double) INFINITY)) {
		tmp = t_4;
	} else {
		tmp = 0.25 * (h * (pow(D, 2.0) / pow((d / M), 2.0)));
	}
	return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (w * h);
	double t_1 = c0 / (2.0 * w);
	double t_2 = (c0 * (d * d)) / ((D * D) * (w * h));
	double t_3 = t_1 * (t_2 + Math.sqrt(((t_2 * t_2) - (M * M))));
	double t_4 = t_1 * ((t_0 * Math.pow((d / D), 2.0)) + (t_0 * ((d / D) * (d / D))));
	double tmp;
	if (t_3 <= -Double.POSITIVE_INFINITY) {
		tmp = t_4;
	} else if (t_3 <= 0.0) {
		tmp = 0.25 * (Math.pow(D, 2.0) / (((d / M) * (d / M)) / h));
	} else if (t_3 <= Double.POSITIVE_INFINITY) {
		tmp = t_4;
	} else {
		tmp = 0.25 * (h * (Math.pow(D, 2.0) / Math.pow((d / M), 2.0)));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = c0 / (w * h)
	t_1 = c0 / (2.0 * w)
	t_2 = (c0 * (d * d)) / ((D * D) * (w * h))
	t_3 = t_1 * (t_2 + math.sqrt(((t_2 * t_2) - (M * M))))
	t_4 = t_1 * ((t_0 * math.pow((d / D), 2.0)) + (t_0 * ((d / D) * (d / D))))
	tmp = 0
	if t_3 <= -math.inf:
		tmp = t_4
	elif t_3 <= 0.0:
		tmp = 0.25 * (math.pow(D, 2.0) / (((d / M) * (d / M)) / h))
	elif t_3 <= math.inf:
		tmp = t_4
	else:
		tmp = 0.25 * (h * (math.pow(D, 2.0) / math.pow((d / M), 2.0)))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(c0 / Float64(w * h))
	t_1 = Float64(c0 / Float64(2.0 * w))
	t_2 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h)))
	t_3 = Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M)))))
	t_4 = Float64(t_1 * Float64(Float64(t_0 * (Float64(d / D) ^ 2.0)) + Float64(t_0 * Float64(Float64(d / D) * Float64(d / D)))))
	tmp = 0.0
	if (t_3 <= Float64(-Inf))
		tmp = t_4;
	elseif (t_3 <= 0.0)
		tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h)));
	elseif (t_3 <= Inf)
		tmp = t_4;
	else
		tmp = Float64(0.25 * Float64(h * Float64((D ^ 2.0) / (Float64(d / M) ^ 2.0))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = c0 / (w * h);
	t_1 = c0 / (2.0 * w);
	t_2 = (c0 * (d * d)) / ((D * D) * (w * h));
	t_3 = t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))));
	t_4 = t_1 * ((t_0 * ((d / D) ^ 2.0)) + (t_0 * ((d / D) * (d / D))));
	tmp = 0.0;
	if (t_3 <= -Inf)
		tmp = t_4;
	elseif (t_3 <= 0.0)
		tmp = 0.25 * ((D ^ 2.0) / (((d / M) * (d / M)) / h));
	elseif (t_3 <= Inf)
		tmp = t_4;
	else
		tmp = 0.25 * (h * ((D ^ 2.0) / ((d / M) ^ 2.0)));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * N[(N[(t$95$0 * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$4, If[LessEqual[t$95$3, 0.0], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$4, N[(0.25 * N[(h * N[(N[Power[D, 2.0], $MachinePrecision] / N[Power[N[(d / M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_3 := t\_1 \cdot \left(t\_2 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\
t_4 := t\_1 \cdot \left(t\_0 \cdot {\left(\frac{d}{D}\right)}^{2} + t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_4\\

\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\

\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;t\_4\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0 or -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0

    1. Initial program 74.3%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative74.3%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative74.3%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac72.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg72.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified72.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-times72.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    6. Applied egg-rr72.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    7. Taylor expanded in c0 around inf 75.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative75.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \color{blue}{\left(w \cdot h\right)}}\right) \]
      2. *-commutative75.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{\color{blue}{\left(w \cdot h\right) \cdot {D}^{2}}}\right) \]
      3. times-frac75.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{w \cdot h} \cdot \frac{{d}^{2}}{{D}^{2}}}\right) \]
      4. *-commutative75.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{\color{blue}{h \cdot w}} \cdot \frac{{d}^{2}}{{D}^{2}}\right) \]
      5. unpow275.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{{d}^{2}}{\color{blue}{D \cdot D}}\right) \]
      6. associate-/r*75.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}\right) \]
      7. unpow275.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\frac{\color{blue}{d \cdot d}}{D}}{D}\right) \]
      8. associate-*l/75.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\color{blue}{\frac{d}{D} \cdot d}}{D}\right) \]
      9. associate-*r/75.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      10. unpow275.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right) \]
    9. Simplified75.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}}\right) \]
    10. Step-by-step derivation
      1. frac-times72.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    11. Applied egg-rr83.3%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]

    if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0

    1. Initial program 68.5%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative68.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg48.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified67.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 67.5%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval67.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*60.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac60.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*60.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified60.6%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 87.3%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*81.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified81.0%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}}{h}} \]
      2. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      3. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      4. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      5. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{d}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      6. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\sqrt{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      7. sqrt-prod34.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      8. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{M}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      9. sqrt-div80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}}}{h}} \]
      10. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}}}{h}} \]
      11. sqrt-prod27.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}}{h}} \]
      12. add-sqr-sqrt80.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{d}}{\sqrt{{M}^{2}}}}{h}} \]
      13. unpow280.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\sqrt{\color{blue}{M \cdot M}}}}{h}} \]
      14. sqrt-prod40.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}}{h}} \]
      15. add-sqr-sqrt87.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{M}}}{h}} \]
    12. Applied egg-rr87.4%

      \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{d}{M} \cdot \frac{d}{M}}}{h}} \]

    if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M)))))

    1. Initial program 0.0%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified3.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 1.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*1.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*2.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified2.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 44.8%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*44.8%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified44.8%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. associate-/r/45.5%

        \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2}}} \cdot h\right)} \]
      2. add-sqr-sqrt45.5%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}} \cdot h\right) \]
      3. pow245.5%

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

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

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      7. add-sqr-sqrt53.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{\color{blue}{d}}{\sqrt{{M}^{2}}}\right)}^{2}} \cdot h\right) \]
      8. unpow253.7%

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

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}\right)}^{2}} \cdot h\right) \]
      10. add-sqr-sqrt59.7%

        \[\leadsto 0.25 \cdot \left(\frac{{D}^{2}}{{\left(\frac{d}{\color{blue}{M}}\right)}^{2}} \cdot h\right) \]
    12. Applied egg-rr59.7%

      \[\leadsto 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}} \cdot h\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification68.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} - M \cdot M}\right) \leq -\infty:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \frac{c0}{w \cdot h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\ \mathbf{elif}\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} - M \cdot M}\right) \leq 0:\\ \;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\ \mathbf{elif}\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} - M \cdot M}\right) \leq \infty:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \frac{c0}{w \cdot h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(h \cdot \frac{{D}^{2}}{{\left(\frac{d}{M}\right)}^{2}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 61.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\ t_1 := \frac{c0}{w \cdot h}\\ t_2 := \frac{c0}{2 \cdot w}\\ t_3 := t\_2 \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)\\ \mathbf{if}\;t\_3 \leq -\infty \lor \neg \left(t\_3 \leq 0\right) \land t\_3 \leq \infty:\\ \;\;\;\;t\_2 \cdot \left(t\_1 \cdot {\left(\frac{d}{D}\right)}^{2} + t\_1 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (* c0 (* d d)) (* (* D D) (* w h))))
        (t_1 (/ c0 (* w h)))
        (t_2 (/ c0 (* 2.0 w)))
        (t_3 (* t_2 (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
   (if (or (<= t_3 (- INFINITY)) (and (not (<= t_3 0.0)) (<= t_3 INFINITY)))
     (* t_2 (+ (* t_1 (pow (/ d D) 2.0)) (* t_1 (* (/ d D) (/ d D)))))
     (* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * (d * d)) / ((D * D) * (w * h));
	double t_1 = c0 / (w * h);
	double t_2 = c0 / (2.0 * w);
	double t_3 = t_2 * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
	double tmp;
	if ((t_3 <= -((double) INFINITY)) || (!(t_3 <= 0.0) && (t_3 <= ((double) INFINITY)))) {
		tmp = t_2 * ((t_1 * pow((d / D), 2.0)) + (t_1 * ((d / D) * (d / D))));
	} else {
		tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
	}
	return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * (d * d)) / ((D * D) * (w * h));
	double t_1 = c0 / (w * h);
	double t_2 = c0 / (2.0 * w);
	double t_3 = t_2 * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
	double tmp;
	if ((t_3 <= -Double.POSITIVE_INFINITY) || (!(t_3 <= 0.0) && (t_3 <= Double.POSITIVE_INFINITY))) {
		tmp = t_2 * ((t_1 * Math.pow((d / D), 2.0)) + (t_1 * ((d / D) * (d / D))));
	} else {
		tmp = 0.25 * (Math.pow(D, 2.0) / (((d / M) * (d / M)) / h));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 * (d * d)) / ((D * D) * (w * h))
	t_1 = c0 / (w * h)
	t_2 = c0 / (2.0 * w)
	t_3 = t_2 * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
	tmp = 0
	if (t_3 <= -math.inf) or (not (t_3 <= 0.0) and (t_3 <= math.inf)):
		tmp = t_2 * ((t_1 * math.pow((d / D), 2.0)) + (t_1 * ((d / D) * (d / D))))
	else:
		tmp = 0.25 * (math.pow(D, 2.0) / (((d / M) * (d / M)) / h))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h)))
	t_1 = Float64(c0 / Float64(w * h))
	t_2 = Float64(c0 / Float64(2.0 * w))
	t_3 = Float64(t_2 * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M)))))
	tmp = 0.0
	if ((t_3 <= Float64(-Inf)) || (!(t_3 <= 0.0) && (t_3 <= Inf)))
		tmp = Float64(t_2 * Float64(Float64(t_1 * (Float64(d / D) ^ 2.0)) + Float64(t_1 * Float64(Float64(d / D) * Float64(d / D)))));
	else
		tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h)));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (c0 * (d * d)) / ((D * D) * (w * h));
	t_1 = c0 / (w * h);
	t_2 = c0 / (2.0 * w);
	t_3 = t_2 * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
	tmp = 0.0;
	if ((t_3 <= -Inf) || (~((t_3 <= 0.0)) && (t_3 <= Inf)))
		tmp = t_2 * ((t_1 * ((d / D) ^ 2.0)) + (t_1 * ((d / D) * (d / D))));
	else
		tmp = 0.25 * ((D ^ 2.0) / (((d / M) * (d / M)) / h));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$3, (-Infinity)], And[N[Not[LessEqual[t$95$3, 0.0]], $MachinePrecision], LessEqual[t$95$3, Infinity]]], N[(t$95$2 * N[(N[(t$95$1 * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_1 := \frac{c0}{w \cdot h}\\
t_2 := \frac{c0}{2 \cdot w}\\
t_3 := t\_2 \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M \cdot M}\right)\\
\mathbf{if}\;t\_3 \leq -\infty \lor \neg \left(t\_3 \leq 0\right) \land t\_3 \leq \infty:\\
\;\;\;\;t\_2 \cdot \left(t\_1 \cdot {\left(\frac{d}{D}\right)}^{2} + t\_1 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -inf.0 or -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0

    1. Initial program 74.3%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative74.3%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative74.3%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac72.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg72.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified72.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-times72.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    6. Applied egg-rr72.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    7. Taylor expanded in c0 around inf 75.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative75.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \color{blue}{\left(w \cdot h\right)}}\right) \]
      2. *-commutative75.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{\color{blue}{\left(w \cdot h\right) \cdot {D}^{2}}}\right) \]
      3. times-frac75.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{w \cdot h} \cdot \frac{{d}^{2}}{{D}^{2}}}\right) \]
      4. *-commutative75.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{\color{blue}{h \cdot w}} \cdot \frac{{d}^{2}}{{D}^{2}}\right) \]
      5. unpow275.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{{d}^{2}}{\color{blue}{D \cdot D}}\right) \]
      6. associate-/r*75.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}\right) \]
      7. unpow275.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\frac{\color{blue}{d \cdot d}}{D}}{D}\right) \]
      8. associate-*l/75.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\color{blue}{\frac{d}{D} \cdot d}}{D}\right) \]
      9. associate-*r/75.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      10. unpow275.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right) \]
    9. Simplified75.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}}\right) \]
    10. Step-by-step derivation
      1. frac-times72.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    11. Applied egg-rr83.3%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \]

    if -inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0 or +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M)))))

    1. Initial program 5.9%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative5.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative5.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac4.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg4.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified9.4%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 7.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def7.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in7.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval7.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*6.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac7.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*7.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified7.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 48.5%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*48.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified48.0%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt47.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}}{h}} \]
      2. sqrt-div48.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      3. unpow248.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      4. sqrt-prod23.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      5. add-sqr-sqrt46.2%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{d}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      6. unpow246.2%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\sqrt{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      7. sqrt-prod21.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      8. add-sqr-sqrt44.8%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{M}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      9. sqrt-div44.8%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}}}{h}} \]
      10. unpow244.8%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}}}{h}} \]
      11. sqrt-prod21.7%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}}{h}} \]
      12. add-sqr-sqrt49.1%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{d}}{\sqrt{{M}^{2}}}}{h}} \]
      13. unpow249.1%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\sqrt{\color{blue}{M \cdot M}}}}{h}} \]
      14. sqrt-prod29.5%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}}{h}} \]
      15. add-sqr-sqrt59.2%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{M}}}{h}} \]
    12. Applied egg-rr59.2%

      \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{d}{M} \cdot \frac{d}{M}}}{h}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} - M \cdot M}\right) \leq -\infty \lor \neg \left(\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} - M \cdot M}\right) \leq 0\right) \land \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)} - M \cdot M}\right) \leq \infty:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \frac{c0}{w \cdot h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 37.1% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := d \cdot \frac{d}{D}\\ t_1 := \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\\ t_2 := \frac{c0}{2 \cdot w}\\ \mathbf{if}\;D \leq 1.55 \cdot 10^{-204}:\\ \;\;\;\;0\\ \mathbf{elif}\;D \leq 3.4 \cdot 10^{-142}:\\ \;\;\;\;t\_2 \cdot \left(t\_1 + \frac{\frac{c0}{w} \cdot t\_0}{h \cdot D}\right)\\ \mathbf{elif}\;D \leq 5.9 \cdot 10^{+71}:\\ \;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\ \mathbf{elif}\;D \leq 6.5 \cdot 10^{+141}:\\ \;\;\;\;t\_2 \cdot \left(t\_1 + \frac{t\_0}{D \cdot \frac{w \cdot h}{c0}}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (* d (/ d D)))
        (t_1 (* (/ c0 (* w h)) (/ (* d d) (* D D))))
        (t_2 (/ c0 (* 2.0 w))))
   (if (<= D 1.55e-204)
     0.0
     (if (<= D 3.4e-142)
       (* t_2 (+ t_1 (/ (* (/ c0 w) t_0) (* h D))))
       (if (<= D 5.9e+71)
         (* 0.25 (/ (pow D 2.0) (/ (* (/ d M) (/ d M)) h)))
         (if (<= D 6.5e+141)
           (* t_2 (+ t_1 (/ t_0 (* D (/ (* w h) c0)))))
           0.0))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = d * (d / D);
	double t_1 = (c0 / (w * h)) * ((d * d) / (D * D));
	double t_2 = c0 / (2.0 * w);
	double tmp;
	if (D <= 1.55e-204) {
		tmp = 0.0;
	} else if (D <= 3.4e-142) {
		tmp = t_2 * (t_1 + (((c0 / w) * t_0) / (h * D)));
	} else if (D <= 5.9e+71) {
		tmp = 0.25 * (pow(D, 2.0) / (((d / M) * (d / M)) / h));
	} else if (D <= 6.5e+141) {
		tmp = t_2 * (t_1 + (t_0 / (D * ((w * h) / c0))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = d_1 * (d_1 / d)
    t_1 = (c0 / (w * h)) * ((d_1 * d_1) / (d * d))
    t_2 = c0 / (2.0d0 * w)
    if (d <= 1.55d-204) then
        tmp = 0.0d0
    else if (d <= 3.4d-142) then
        tmp = t_2 * (t_1 + (((c0 / w) * t_0) / (h * d)))
    else if (d <= 5.9d+71) then
        tmp = 0.25d0 * ((d ** 2.0d0) / (((d_1 / m) * (d_1 / m)) / h))
    else if (d <= 6.5d+141) then
        tmp = t_2 * (t_1 + (t_0 / (d * ((w * h) / c0))))
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = d * (d / D);
	double t_1 = (c0 / (w * h)) * ((d * d) / (D * D));
	double t_2 = c0 / (2.0 * w);
	double tmp;
	if (D <= 1.55e-204) {
		tmp = 0.0;
	} else if (D <= 3.4e-142) {
		tmp = t_2 * (t_1 + (((c0 / w) * t_0) / (h * D)));
	} else if (D <= 5.9e+71) {
		tmp = 0.25 * (Math.pow(D, 2.0) / (((d / M) * (d / M)) / h));
	} else if (D <= 6.5e+141) {
		tmp = t_2 * (t_1 + (t_0 / (D * ((w * h) / c0))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = d * (d / D)
	t_1 = (c0 / (w * h)) * ((d * d) / (D * D))
	t_2 = c0 / (2.0 * w)
	tmp = 0
	if D <= 1.55e-204:
		tmp = 0.0
	elif D <= 3.4e-142:
		tmp = t_2 * (t_1 + (((c0 / w) * t_0) / (h * D)))
	elif D <= 5.9e+71:
		tmp = 0.25 * (math.pow(D, 2.0) / (((d / M) * (d / M)) / h))
	elif D <= 6.5e+141:
		tmp = t_2 * (t_1 + (t_0 / (D * ((w * h) / c0))))
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(d * Float64(d / D))
	t_1 = Float64(Float64(c0 / Float64(w * h)) * Float64(Float64(d * d) / Float64(D * D)))
	t_2 = Float64(c0 / Float64(2.0 * w))
	tmp = 0.0
	if (D <= 1.55e-204)
		tmp = 0.0;
	elseif (D <= 3.4e-142)
		tmp = Float64(t_2 * Float64(t_1 + Float64(Float64(Float64(c0 / w) * t_0) / Float64(h * D))));
	elseif (D <= 5.9e+71)
		tmp = Float64(0.25 * Float64((D ^ 2.0) / Float64(Float64(Float64(d / M) * Float64(d / M)) / h)));
	elseif (D <= 6.5e+141)
		tmp = Float64(t_2 * Float64(t_1 + Float64(t_0 / Float64(D * Float64(Float64(w * h) / c0)))));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = d * (d / D);
	t_1 = (c0 / (w * h)) * ((d * d) / (D * D));
	t_2 = c0 / (2.0 * w);
	tmp = 0.0;
	if (D <= 1.55e-204)
		tmp = 0.0;
	elseif (D <= 3.4e-142)
		tmp = t_2 * (t_1 + (((c0 / w) * t_0) / (h * D)));
	elseif (D <= 5.9e+71)
		tmp = 0.25 * ((D ^ 2.0) / (((d / M) * (d / M)) / h));
	elseif (D <= 6.5e+141)
		tmp = t_2 * (t_1 + (t_0 / (D * ((w * h) / c0))));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, 1.55e-204], 0.0, If[LessEqual[D, 3.4e-142], N[(t$95$2 * N[(t$95$1 + N[(N[(N[(c0 / w), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 5.9e+71], N[(0.25 * N[(N[Power[D, 2.0], $MachinePrecision] / N[(N[(N[(d / M), $MachinePrecision] * N[(d / M), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 6.5e+141], N[(t$95$2 * N[(t$95$1 + N[(t$95$0 / N[(D * N[(N[(w * h), $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := d \cdot \frac{d}{D}\\
t_1 := \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\\
t_2 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;D \leq 1.55 \cdot 10^{-204}:\\
\;\;\;\;0\\

\mathbf{elif}\;D \leq 3.4 \cdot 10^{-142}:\\
\;\;\;\;t\_2 \cdot \left(t\_1 + \frac{\frac{c0}{w} \cdot t\_0}{h \cdot D}\right)\\

\mathbf{elif}\;D \leq 5.9 \cdot 10^{+71}:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\

\mathbf{elif}\;D \leq 6.5 \cdot 10^{+141}:\\
\;\;\;\;t\_2 \cdot \left(t\_1 + \frac{t\_0}{D \cdot \frac{w \cdot h}{c0}}\right)\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if D < 1.55e-204 or 6.50000000000000053e141 < D

    1. Initial program 26.7%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative26.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative26.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac25.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg25.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified28.1%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 4.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg4.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right)} \]
      2. distribute-lft-in3.3%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(-\color{blue}{\left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right) + c0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}\right) \]
    7. Simplified33.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{0} \]
    8. Taylor expanded in c0 around 0 35.8%

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

    if 1.55e-204 < D < 3.40000000000000029e-142

    1. Initial program 36.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative36.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative36.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac36.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg36.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified36.7%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-times36.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    6. Applied egg-rr36.7%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    7. Taylor expanded in c0 around inf 47.5%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative47.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \color{blue}{\left(w \cdot h\right)}}\right) \]
      2. *-commutative47.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{\color{blue}{\left(w \cdot h\right) \cdot {D}^{2}}}\right) \]
      3. times-frac47.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{w \cdot h} \cdot \frac{{d}^{2}}{{D}^{2}}}\right) \]
      4. *-commutative47.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{\color{blue}{h \cdot w}} \cdot \frac{{d}^{2}}{{D}^{2}}\right) \]
      5. unpow247.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{{d}^{2}}{\color{blue}{D \cdot D}}\right) \]
      6. associate-/r*47.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}\right) \]
      7. unpow247.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\frac{\color{blue}{d \cdot d}}{D}}{D}\right) \]
      8. associate-*l/47.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\color{blue}{\frac{d}{D} \cdot d}}{D}\right) \]
      9. associate-*r/47.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      10. unpow247.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right) \]
    9. Simplified47.6%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}}\right) \]
    10. Step-by-step derivation
      1. pow247.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      2. associate-/l/47.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{c0}{w}}{h}} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) \]
      3. associate-*r/47.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{\frac{c0}{w}}{h} \cdot \color{blue}{\frac{\frac{d}{D} \cdot d}{D}}\right) \]
      4. frac-times47.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot d\right)}{h \cdot D}}\right) \]
    11. Applied egg-rr47.7%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot d\right)}{h \cdot D}}\right) \]

    if 3.40000000000000029e-142 < D < 5.9000000000000002e71

    1. Initial program 27.0%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative27.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative27.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac23.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg23.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified30.5%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 10.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right) + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
    6. Step-by-step derivation
      1. fma-def10.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right)} \]
      2. distribute-lft1-in10.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      3. metadata-eval10.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      4. associate-/r*9.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right), 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      5. times-frac9.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \color{blue}{\left(\frac{{D}^{2}}{c0} \cdot \frac{{M}^{2} \cdot \left(h \cdot w\right)}{{d}^{2}}\right)}\right) \]
      6. associate-*r*9.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot w}}{{d}^{2}}\right)\right) \]
    7. Simplified9.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(-1, c0 \cdot \left(0 \cdot \frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}\right), 0.5 \cdot \left(\frac{{D}^{2}}{c0} \cdot \frac{\left({M}^{2} \cdot h\right) \cdot w}{{d}^{2}}\right)\right)} \]
    8. Taylor expanded in c0 around 0 53.7%

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. associate-/r*52.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\color{blue}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    10. Simplified52.0%

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2}}{\frac{\frac{{d}^{2}}{{M}^{2}}}{h}}} \]
    11. Step-by-step derivation
      1. add-sqr-sqrt52.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\sqrt{\frac{{d}^{2}}{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}}{h}} \]
      2. sqrt-div52.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      3. unpow252.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      4. sqrt-prod25.3%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      5. add-sqr-sqrt51.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{\color{blue}{d}}{\sqrt{{M}^{2}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      6. unpow251.9%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\sqrt{\color{blue}{M \cdot M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      7. sqrt-prod19.8%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      8. add-sqr-sqrt45.2%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{\color{blue}{M}} \cdot \sqrt{\frac{{d}^{2}}{{M}^{2}}}}{h}} \]
      9. sqrt-div45.2%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \color{blue}{\frac{\sqrt{{d}^{2}}}{\sqrt{{M}^{2}}}}}{h}} \]
      10. unpow245.2%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\sqrt{\color{blue}{d \cdot d}}}{\sqrt{{M}^{2}}}}{h}} \]
      11. sqrt-prod18.6%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{{M}^{2}}}}{h}} \]
      12. add-sqr-sqrt49.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{\color{blue}{d}}{\sqrt{{M}^{2}}}}{h}} \]
      13. unpow249.0%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\sqrt{\color{blue}{M \cdot M}}}}{h}} \]
      14. sqrt-prod30.4%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{\sqrt{M} \cdot \sqrt{M}}}}{h}} \]
      15. add-sqr-sqrt62.6%

        \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{\color{blue}{M}}}{h}} \]
    12. Applied egg-rr62.6%

      \[\leadsto 0.25 \cdot \frac{{D}^{2}}{\frac{\color{blue}{\frac{d}{M} \cdot \frac{d}{M}}}{h}} \]

    if 5.9000000000000002e71 < D < 6.50000000000000053e141

    1. Initial program 29.2%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative29.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative29.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac28.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg28.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified34.1%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-times34.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    6. Applied egg-rr34.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    7. Taylor expanded in c0 around inf 45.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative45.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \color{blue}{\left(w \cdot h\right)}}\right) \]
      2. *-commutative45.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{\color{blue}{\left(w \cdot h\right) \cdot {D}^{2}}}\right) \]
      3. times-frac46.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{w \cdot h} \cdot \frac{{d}^{2}}{{D}^{2}}}\right) \]
      4. *-commutative46.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{\color{blue}{h \cdot w}} \cdot \frac{{d}^{2}}{{D}^{2}}\right) \]
      5. unpow246.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{{d}^{2}}{\color{blue}{D \cdot D}}\right) \]
      6. associate-/r*46.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}\right) \]
      7. unpow246.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\frac{\color{blue}{d \cdot d}}{D}}{D}\right) \]
      8. associate-*l/46.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\color{blue}{\frac{d}{D} \cdot d}}{D}\right) \]
      9. associate-*r/46.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      10. unpow246.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right) \]
    9. Simplified46.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}}\right) \]
    10. Step-by-step derivation
      1. pow246.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      2. associate-/l/46.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{c0}{w}}{h}} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) \]
      3. *-commutative46.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{w}}{h}}\right) \]
      4. associate-*r/46.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{d}{D} \cdot d}{D}} \cdot \frac{\frac{c0}{w}}{h}\right) \]
      5. associate-/l/46.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{\frac{d}{D} \cdot d}{D} \cdot \color{blue}{\frac{c0}{h \cdot w}}\right) \]
      6. clear-num46.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{\frac{d}{D} \cdot d}{D} \cdot \color{blue}{\frac{1}{\frac{h \cdot w}{c0}}}\right) \]
      7. frac-times46.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\left(\frac{d}{D} \cdot d\right) \cdot 1}{D \cdot \frac{h \cdot w}{c0}}}\right) \]
    11. Applied egg-rr46.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\left(\frac{d}{D} \cdot d\right) \cdot 1}{D \cdot \frac{h \cdot w}{c0}}}\right) \]
  3. Recombined 4 regimes into one program.
  4. Final simplification43.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;D \leq 1.55 \cdot 10^{-204}:\\ \;\;\;\;0\\ \mathbf{elif}\;D \leq 3.4 \cdot 10^{-142}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{\frac{c0}{w} \cdot \left(d \cdot \frac{d}{D}\right)}{h \cdot D}\right)\\ \mathbf{elif}\;D \leq 5.9 \cdot 10^{+71}:\\ \;\;\;\;0.25 \cdot \frac{{D}^{2}}{\frac{\frac{d}{M} \cdot \frac{d}{M}}{h}}\\ \mathbf{elif}\;D \leq 6.5 \cdot 10^{+141}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{d \cdot \frac{d}{D}}{D \cdot \frac{w \cdot h}{c0}}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 36.7% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq -4.4 \cdot 10^{+104}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq -4.2 \cdot 10^{-106} \lor \neg \left(w \leq -2.5 \cdot 10^{-266}\right) \land w \leq 1.9 \cdot 10^{-96}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot \left(d \cdot \frac{d}{D}\right)}{D \cdot \left(w \cdot h\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (if (<= w -4.4e+104)
   0.0
   (if (or (<= w -4.2e-106) (and (not (<= w -2.5e-266)) (<= w 1.9e-96)))
     (*
      (/ c0 (* 2.0 w))
      (+
       (* (/ c0 (* w h)) (/ (* d d) (* D D)))
       (/ (* c0 (* d (/ d D))) (* D (* w h)))))
     0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if (w <= -4.4e+104) {
		tmp = 0.0;
	} else if ((w <= -4.2e-106) || (!(w <= -2.5e-266) && (w <= 1.9e-96))) {
		tmp = (c0 / (2.0 * w)) * (((c0 / (w * h)) * ((d * d) / (D * D))) + ((c0 * (d * (d / D))) / (D * (w * h))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: tmp
    if (w <= (-4.4d+104)) then
        tmp = 0.0d0
    else if ((w <= (-4.2d-106)) .or. (.not. (w <= (-2.5d-266))) .and. (w <= 1.9d-96)) then
        tmp = (c0 / (2.0d0 * w)) * (((c0 / (w * h)) * ((d_1 * d_1) / (d * d))) + ((c0 * (d_1 * (d_1 / d))) / (d * (w * h))))
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if (w <= -4.4e+104) {
		tmp = 0.0;
	} else if ((w <= -4.2e-106) || (!(w <= -2.5e-266) && (w <= 1.9e-96))) {
		tmp = (c0 / (2.0 * w)) * (((c0 / (w * h)) * ((d * d) / (D * D))) + ((c0 * (d * (d / D))) / (D * (w * h))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	tmp = 0
	if w <= -4.4e+104:
		tmp = 0.0
	elif (w <= -4.2e-106) or (not (w <= -2.5e-266) and (w <= 1.9e-96)):
		tmp = (c0 / (2.0 * w)) * (((c0 / (w * h)) * ((d * d) / (D * D))) + ((c0 * (d * (d / D))) / (D * (w * h))))
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	tmp = 0.0
	if (w <= -4.4e+104)
		tmp = 0.0;
	elseif ((w <= -4.2e-106) || (!(w <= -2.5e-266) && (w <= 1.9e-96)))
		tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(Float64(c0 / Float64(w * h)) * Float64(Float64(d * d) / Float64(D * D))) + Float64(Float64(c0 * Float64(d * Float64(d / D))) / Float64(D * Float64(w * h)))));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	tmp = 0.0;
	if (w <= -4.4e+104)
		tmp = 0.0;
	elseif ((w <= -4.2e-106) || (~((w <= -2.5e-266)) && (w <= 1.9e-96)))
		tmp = (c0 / (2.0 * w)) * (((c0 / (w * h)) * ((d * d) / (D * D))) + ((c0 * (d * (d / D))) / (D * (w * h))));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[w, -4.4e+104], 0.0, If[Or[LessEqual[w, -4.2e-106], And[N[Not[LessEqual[w, -2.5e-266]], $MachinePrecision], LessEqual[w, 1.9e-96]]], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(c0 * N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(D * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq -4.4 \cdot 10^{+104}:\\
\;\;\;\;0\\

\mathbf{elif}\;w \leq -4.2 \cdot 10^{-106} \lor \neg \left(w \leq -2.5 \cdot 10^{-266}\right) \land w \leq 1.9 \cdot 10^{-96}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot \left(d \cdot \frac{d}{D}\right)}{D \cdot \left(w \cdot h\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < -4.40000000000000001e104 or -4.20000000000000007e-106 < w < -2.49999999999999996e-266 or 1.9e-96 < w

    1. Initial program 19.9%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative19.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative19.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac18.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg18.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified21.3%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 7.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg7.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right)} \]
      2. distribute-lft-in7.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(-\color{blue}{\left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right) + c0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}\right) \]
    7. Simplified44.6%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{0} \]
    8. Taylor expanded in c0 around 0 48.8%

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

    if -4.40000000000000001e104 < w < -4.20000000000000007e-106 or -2.49999999999999996e-266 < w < 1.9e-96

    1. Initial program 37.9%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative37.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative37.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac36.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg36.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified40.7%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-times39.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    6. Applied egg-rr39.8%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    7. Taylor expanded in c0 around inf 39.5%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative39.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \color{blue}{\left(w \cdot h\right)}}\right) \]
      2. *-commutative39.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{\color{blue}{\left(w \cdot h\right) \cdot {D}^{2}}}\right) \]
      3. times-frac41.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{w \cdot h} \cdot \frac{{d}^{2}}{{D}^{2}}}\right) \]
      4. *-commutative41.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{\color{blue}{h \cdot w}} \cdot \frac{{d}^{2}}{{D}^{2}}\right) \]
      5. unpow241.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{{d}^{2}}{\color{blue}{D \cdot D}}\right) \]
      6. associate-/r*42.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}\right) \]
      7. unpow242.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\frac{\color{blue}{d \cdot d}}{D}}{D}\right) \]
      8. associate-*l/42.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\color{blue}{\frac{d}{D} \cdot d}}{D}\right) \]
      9. associate-*r/42.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      10. unpow242.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right) \]
    9. Simplified42.6%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}}\right) \]
    10. Step-by-step derivation
      1. pow242.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      2. associate-/l/42.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{c0}{w}}{h}} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) \]
      3. *-commutative42.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{w}}{h}}\right) \]
      4. associate-*r/42.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{d}{D} \cdot d}{D}} \cdot \frac{\frac{c0}{w}}{h}\right) \]
      5. associate-/l/42.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{\frac{d}{D} \cdot d}{D} \cdot \color{blue}{\frac{c0}{h \cdot w}}\right) \]
      6. frac-times42.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\left(\frac{d}{D} \cdot d\right) \cdot c0}{D \cdot \left(h \cdot w\right)}}\right) \]
    11. Applied egg-rr42.5%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\left(\frac{d}{D} \cdot d\right) \cdot c0}{D \cdot \left(h \cdot w\right)}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -4.4 \cdot 10^{+104}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq -4.2 \cdot 10^{-106} \lor \neg \left(w \leq -2.5 \cdot 10^{-266}\right) \land w \leq 1.9 \cdot 10^{-96}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot \left(d \cdot \frac{d}{D}\right)}{D \cdot \left(w \cdot h\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 36.6% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\\ t_1 := \frac{c0}{2 \cdot w}\\ t_2 := d \cdot \frac{d}{D}\\ \mathbf{if}\;w \leq -8 \cdot 10^{+104}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq -4 \cdot 10^{-104}:\\ \;\;\;\;t\_1 \cdot \left(t\_0 + \frac{t\_2 \cdot \frac{c0}{h}}{w \cdot D}\right)\\ \mathbf{elif}\;w \leq -9.4 \cdot 10^{-268}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq 3 \cdot 10^{-96}:\\ \;\;\;\;t\_1 \cdot \left(t\_0 + \frac{c0 \cdot t\_2}{D \cdot \left(w \cdot h\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (* (/ c0 (* w h)) (/ (* d d) (* D D))))
        (t_1 (/ c0 (* 2.0 w)))
        (t_2 (* d (/ d D))))
   (if (<= w -8e+104)
     0.0
     (if (<= w -4e-104)
       (* t_1 (+ t_0 (/ (* t_2 (/ c0 h)) (* w D))))
       (if (<= w -9.4e-268)
         0.0
         (if (<= w 3e-96)
           (* t_1 (+ t_0 (/ (* c0 t_2) (* D (* w h)))))
           0.0))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 / (w * h)) * ((d * d) / (D * D));
	double t_1 = c0 / (2.0 * w);
	double t_2 = d * (d / D);
	double tmp;
	if (w <= -8e+104) {
		tmp = 0.0;
	} else if (w <= -4e-104) {
		tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D)));
	} else if (w <= -9.4e-268) {
		tmp = 0.0;
	} else if (w <= 3e-96) {
		tmp = t_1 * (t_0 + ((c0 * t_2) / (D * (w * h))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = (c0 / (w * h)) * ((d_1 * d_1) / (d * d))
    t_1 = c0 / (2.0d0 * w)
    t_2 = d_1 * (d_1 / d)
    if (w <= (-8d+104)) then
        tmp = 0.0d0
    else if (w <= (-4d-104)) then
        tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * d)))
    else if (w <= (-9.4d-268)) then
        tmp = 0.0d0
    else if (w <= 3d-96) then
        tmp = t_1 * (t_0 + ((c0 * t_2) / (d * (w * h))))
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 / (w * h)) * ((d * d) / (D * D));
	double t_1 = c0 / (2.0 * w);
	double t_2 = d * (d / D);
	double tmp;
	if (w <= -8e+104) {
		tmp = 0.0;
	} else if (w <= -4e-104) {
		tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D)));
	} else if (w <= -9.4e-268) {
		tmp = 0.0;
	} else if (w <= 3e-96) {
		tmp = t_1 * (t_0 + ((c0 * t_2) / (D * (w * h))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 / (w * h)) * ((d * d) / (D * D))
	t_1 = c0 / (2.0 * w)
	t_2 = d * (d / D)
	tmp = 0
	if w <= -8e+104:
		tmp = 0.0
	elif w <= -4e-104:
		tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D)))
	elif w <= -9.4e-268:
		tmp = 0.0
	elif w <= 3e-96:
		tmp = t_1 * (t_0 + ((c0 * t_2) / (D * (w * h))))
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 / Float64(w * h)) * Float64(Float64(d * d) / Float64(D * D)))
	t_1 = Float64(c0 / Float64(2.0 * w))
	t_2 = Float64(d * Float64(d / D))
	tmp = 0.0
	if (w <= -8e+104)
		tmp = 0.0;
	elseif (w <= -4e-104)
		tmp = Float64(t_1 * Float64(t_0 + Float64(Float64(t_2 * Float64(c0 / h)) / Float64(w * D))));
	elseif (w <= -9.4e-268)
		tmp = 0.0;
	elseif (w <= 3e-96)
		tmp = Float64(t_1 * Float64(t_0 + Float64(Float64(c0 * t_2) / Float64(D * Float64(w * h)))));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (c0 / (w * h)) * ((d * d) / (D * D));
	t_1 = c0 / (2.0 * w);
	t_2 = d * (d / D);
	tmp = 0.0;
	if (w <= -8e+104)
		tmp = 0.0;
	elseif (w <= -4e-104)
		tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D)));
	elseif (w <= -9.4e-268)
		tmp = 0.0;
	elseif (w <= 3e-96)
		tmp = t_1 * (t_0 + ((c0 * t_2) / (D * (w * h))));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -8e+104], 0.0, If[LessEqual[w, -4e-104], N[(t$95$1 * N[(t$95$0 + N[(N[(t$95$2 * N[(c0 / h), $MachinePrecision]), $MachinePrecision] / N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, -9.4e-268], 0.0, If[LessEqual[w, 3e-96], N[(t$95$1 * N[(t$95$0 + N[(N[(c0 * t$95$2), $MachinePrecision] / N[(D * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := d \cdot \frac{d}{D}\\
\mathbf{if}\;w \leq -8 \cdot 10^{+104}:\\
\;\;\;\;0\\

\mathbf{elif}\;w \leq -4 \cdot 10^{-104}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 + \frac{t\_2 \cdot \frac{c0}{h}}{w \cdot D}\right)\\

\mathbf{elif}\;w \leq -9.4 \cdot 10^{-268}:\\
\;\;\;\;0\\

\mathbf{elif}\;w \leq 3 \cdot 10^{-96}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 + \frac{c0 \cdot t\_2}{D \cdot \left(w \cdot h\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if w < -8e104 or -3.99999999999999971e-104 < w < -9.39999999999999947e-268 or 3e-96 < w

    1. Initial program 19.9%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative19.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative19.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac18.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg18.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified21.3%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 7.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg7.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right)} \]
      2. distribute-lft-in7.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(-\color{blue}{\left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right) + c0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}\right) \]
    7. Simplified44.6%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{0} \]
    8. Taylor expanded in c0 around 0 48.8%

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

    if -8e104 < w < -3.99999999999999971e-104

    1. Initial program 47.6%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative47.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative47.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac44.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg44.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified47.4%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-times44.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    6. Applied egg-rr44.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    7. Taylor expanded in c0 around inf 42.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative42.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \color{blue}{\left(w \cdot h\right)}}\right) \]
      2. *-commutative42.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{\color{blue}{\left(w \cdot h\right) \cdot {D}^{2}}}\right) \]
      3. times-frac41.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{w \cdot h} \cdot \frac{{d}^{2}}{{D}^{2}}}\right) \]
      4. *-commutative41.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{\color{blue}{h \cdot w}} \cdot \frac{{d}^{2}}{{D}^{2}}\right) \]
      5. unpow241.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{{d}^{2}}{\color{blue}{D \cdot D}}\right) \]
      6. associate-/r*41.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}\right) \]
      7. unpow241.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\frac{\color{blue}{d \cdot d}}{D}}{D}\right) \]
      8. associate-*l/41.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\color{blue}{\frac{d}{D} \cdot d}}{D}\right) \]
      9. associate-*r/41.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      10. unpow241.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right) \]
    9. Simplified41.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}}\right) \]
    10. Step-by-step derivation
      1. pow241.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      2. associate-/r*41.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{c0}{h}}{w}} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) \]
      3. associate-*r/41.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{\frac{c0}{h}}{w} \cdot \color{blue}{\frac{\frac{d}{D} \cdot d}{D}}\right) \]
      4. frac-times42.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{c0}{h} \cdot \left(\frac{d}{D} \cdot d\right)}{w \cdot D}}\right) \]
    11. Applied egg-rr42.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{c0}{h} \cdot \left(\frac{d}{D} \cdot d\right)}{w \cdot D}}\right) \]

    if -9.39999999999999947e-268 < w < 3e-96

    1. Initial program 34.1%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative34.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative34.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac32.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg32.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified38.0%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-times38.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    6. Applied egg-rr38.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    7. Taylor expanded in c0 around inf 38.5%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative38.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \color{blue}{\left(w \cdot h\right)}}\right) \]
      2. *-commutative38.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{\color{blue}{\left(w \cdot h\right) \cdot {D}^{2}}}\right) \]
      3. times-frac41.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{w \cdot h} \cdot \frac{{d}^{2}}{{D}^{2}}}\right) \]
      4. *-commutative41.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{\color{blue}{h \cdot w}} \cdot \frac{{d}^{2}}{{D}^{2}}\right) \]
      5. unpow241.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{{d}^{2}}{\color{blue}{D \cdot D}}\right) \]
      6. associate-/r*42.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}\right) \]
      7. unpow242.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\frac{\color{blue}{d \cdot d}}{D}}{D}\right) \]
      8. associate-*l/42.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\color{blue}{\frac{d}{D} \cdot d}}{D}\right) \]
      9. associate-*r/42.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      10. unpow242.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right) \]
    9. Simplified42.8%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}}\right) \]
    10. Step-by-step derivation
      1. pow242.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      2. associate-/l/42.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{c0}{w}}{h}} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) \]
      3. *-commutative42.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{w}}{h}}\right) \]
      4. associate-*r/42.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{d}{D} \cdot d}{D}} \cdot \frac{\frac{c0}{w}}{h}\right) \]
      5. associate-/l/42.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{\frac{d}{D} \cdot d}{D} \cdot \color{blue}{\frac{c0}{h \cdot w}}\right) \]
      6. frac-times42.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\left(\frac{d}{D} \cdot d\right) \cdot c0}{D \cdot \left(h \cdot w\right)}}\right) \]
    11. Applied egg-rr42.7%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\left(\frac{d}{D} \cdot d\right) \cdot c0}{D \cdot \left(h \cdot w\right)}}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification46.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -8 \cdot 10^{+104}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq -4 \cdot 10^{-104}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{\left(d \cdot \frac{d}{D}\right) \cdot \frac{c0}{h}}{w \cdot D}\right)\\ \mathbf{elif}\;w \leq -9.4 \cdot 10^{-268}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq 3 \cdot 10^{-96}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot \left(d \cdot \frac{d}{D}\right)}{D \cdot \left(w \cdot h\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 36.7% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\\ t_1 := \frac{c0}{2 \cdot w}\\ t_2 := d \cdot \frac{d}{D}\\ \mathbf{if}\;w \leq -4.5 \cdot 10^{+104}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq -6.2 \cdot 10^{-106}:\\ \;\;\;\;t\_1 \cdot \left(t\_0 + \frac{t\_2 \cdot \frac{c0}{h}}{w \cdot D}\right)\\ \mathbf{elif}\;w \leq -7.6 \cdot 10^{-268}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq 2.65 \cdot 10^{-96}:\\ \;\;\;\;t\_1 \cdot \left(t\_0 + \frac{t\_2}{D \cdot \frac{w \cdot h}{c0}}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (* (/ c0 (* w h)) (/ (* d d) (* D D))))
        (t_1 (/ c0 (* 2.0 w)))
        (t_2 (* d (/ d D))))
   (if (<= w -4.5e+104)
     0.0
     (if (<= w -6.2e-106)
       (* t_1 (+ t_0 (/ (* t_2 (/ c0 h)) (* w D))))
       (if (<= w -7.6e-268)
         0.0
         (if (<= w 2.65e-96)
           (* t_1 (+ t_0 (/ t_2 (* D (/ (* w h) c0)))))
           0.0))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 / (w * h)) * ((d * d) / (D * D));
	double t_1 = c0 / (2.0 * w);
	double t_2 = d * (d / D);
	double tmp;
	if (w <= -4.5e+104) {
		tmp = 0.0;
	} else if (w <= -6.2e-106) {
		tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D)));
	} else if (w <= -7.6e-268) {
		tmp = 0.0;
	} else if (w <= 2.65e-96) {
		tmp = t_1 * (t_0 + (t_2 / (D * ((w * h) / c0))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = (c0 / (w * h)) * ((d_1 * d_1) / (d * d))
    t_1 = c0 / (2.0d0 * w)
    t_2 = d_1 * (d_1 / d)
    if (w <= (-4.5d+104)) then
        tmp = 0.0d0
    else if (w <= (-6.2d-106)) then
        tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * d)))
    else if (w <= (-7.6d-268)) then
        tmp = 0.0d0
    else if (w <= 2.65d-96) then
        tmp = t_1 * (t_0 + (t_2 / (d * ((w * h) / c0))))
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 / (w * h)) * ((d * d) / (D * D));
	double t_1 = c0 / (2.0 * w);
	double t_2 = d * (d / D);
	double tmp;
	if (w <= -4.5e+104) {
		tmp = 0.0;
	} else if (w <= -6.2e-106) {
		tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D)));
	} else if (w <= -7.6e-268) {
		tmp = 0.0;
	} else if (w <= 2.65e-96) {
		tmp = t_1 * (t_0 + (t_2 / (D * ((w * h) / c0))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 / (w * h)) * ((d * d) / (D * D))
	t_1 = c0 / (2.0 * w)
	t_2 = d * (d / D)
	tmp = 0
	if w <= -4.5e+104:
		tmp = 0.0
	elif w <= -6.2e-106:
		tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D)))
	elif w <= -7.6e-268:
		tmp = 0.0
	elif w <= 2.65e-96:
		tmp = t_1 * (t_0 + (t_2 / (D * ((w * h) / c0))))
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 / Float64(w * h)) * Float64(Float64(d * d) / Float64(D * D)))
	t_1 = Float64(c0 / Float64(2.0 * w))
	t_2 = Float64(d * Float64(d / D))
	tmp = 0.0
	if (w <= -4.5e+104)
		tmp = 0.0;
	elseif (w <= -6.2e-106)
		tmp = Float64(t_1 * Float64(t_0 + Float64(Float64(t_2 * Float64(c0 / h)) / Float64(w * D))));
	elseif (w <= -7.6e-268)
		tmp = 0.0;
	elseif (w <= 2.65e-96)
		tmp = Float64(t_1 * Float64(t_0 + Float64(t_2 / Float64(D * Float64(Float64(w * h) / c0)))));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (c0 / (w * h)) * ((d * d) / (D * D));
	t_1 = c0 / (2.0 * w);
	t_2 = d * (d / D);
	tmp = 0.0;
	if (w <= -4.5e+104)
		tmp = 0.0;
	elseif (w <= -6.2e-106)
		tmp = t_1 * (t_0 + ((t_2 * (c0 / h)) / (w * D)));
	elseif (w <= -7.6e-268)
		tmp = 0.0;
	elseif (w <= 2.65e-96)
		tmp = t_1 * (t_0 + (t_2 / (D * ((w * h) / c0))));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -4.5e+104], 0.0, If[LessEqual[w, -6.2e-106], N[(t$95$1 * N[(t$95$0 + N[(N[(t$95$2 * N[(c0 / h), $MachinePrecision]), $MachinePrecision] / N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, -7.6e-268], 0.0, If[LessEqual[w, 2.65e-96], N[(t$95$1 * N[(t$95$0 + N[(t$95$2 / N[(D * N[(N[(w * h), $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := d \cdot \frac{d}{D}\\
\mathbf{if}\;w \leq -4.5 \cdot 10^{+104}:\\
\;\;\;\;0\\

\mathbf{elif}\;w \leq -6.2 \cdot 10^{-106}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 + \frac{t\_2 \cdot \frac{c0}{h}}{w \cdot D}\right)\\

\mathbf{elif}\;w \leq -7.6 \cdot 10^{-268}:\\
\;\;\;\;0\\

\mathbf{elif}\;w \leq 2.65 \cdot 10^{-96}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 + \frac{t\_2}{D \cdot \frac{w \cdot h}{c0}}\right)\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if w < -4.4999999999999998e104 or -6.19999999999999971e-106 < w < -7.6000000000000005e-268 or 2.6500000000000001e-96 < w

    1. Initial program 19.9%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative19.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative19.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac18.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg18.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified21.3%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in c0 around -inf 7.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right)\right)} \]
    6. Step-by-step derivation
      1. mul-1-neg7.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right)} \]
      2. distribute-lft-in7.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(-\color{blue}{\left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right) + c0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}\right) \]
    7. Simplified44.6%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{0} \]
    8. Taylor expanded in c0 around 0 48.8%

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

    if -4.4999999999999998e104 < w < -6.19999999999999971e-106

    1. Initial program 47.6%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative47.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative47.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac44.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg44.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified47.4%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-times44.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    6. Applied egg-rr44.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    7. Taylor expanded in c0 around inf 42.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative42.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \color{blue}{\left(w \cdot h\right)}}\right) \]
      2. *-commutative42.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{\color{blue}{\left(w \cdot h\right) \cdot {D}^{2}}}\right) \]
      3. times-frac41.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{w \cdot h} \cdot \frac{{d}^{2}}{{D}^{2}}}\right) \]
      4. *-commutative41.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{\color{blue}{h \cdot w}} \cdot \frac{{d}^{2}}{{D}^{2}}\right) \]
      5. unpow241.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{{d}^{2}}{\color{blue}{D \cdot D}}\right) \]
      6. associate-/r*41.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}\right) \]
      7. unpow241.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\frac{\color{blue}{d \cdot d}}{D}}{D}\right) \]
      8. associate-*l/41.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\color{blue}{\frac{d}{D} \cdot d}}{D}\right) \]
      9. associate-*r/41.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      10. unpow241.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right) \]
    9. Simplified41.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}}\right) \]
    10. Step-by-step derivation
      1. pow241.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      2. associate-/r*41.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{c0}{h}}{w}} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) \]
      3. associate-*r/41.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{\frac{c0}{h}}{w} \cdot \color{blue}{\frac{\frac{d}{D} \cdot d}{D}}\right) \]
      4. frac-times42.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{c0}{h} \cdot \left(\frac{d}{D} \cdot d\right)}{w \cdot D}}\right) \]
    11. Applied egg-rr42.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{c0}{h} \cdot \left(\frac{d}{D} \cdot d\right)}{w \cdot D}}\right) \]

    if -7.6000000000000005e-268 < w < 2.6500000000000001e-96

    1. Initial program 34.1%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. +-commutative34.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
      2. +-commutative34.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. times-frac32.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. fma-neg32.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
    3. Simplified38.0%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. frac-times38.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    6. Applied egg-rr38.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) - M \cdot M}\right) \]
    7. Taylor expanded in c0 around inf 38.5%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}\right) \]
    8. Step-by-step derivation
      1. *-commutative38.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \color{blue}{\left(w \cdot h\right)}}\right) \]
      2. *-commutative38.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0 \cdot {d}^{2}}{\color{blue}{\left(w \cdot h\right) \cdot {D}^{2}}}\right) \]
      3. times-frac41.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{w \cdot h} \cdot \frac{{d}^{2}}{{D}^{2}}}\right) \]
      4. *-commutative41.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{\color{blue}{h \cdot w}} \cdot \frac{{d}^{2}}{{D}^{2}}\right) \]
      5. unpow241.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{{d}^{2}}{\color{blue}{D \cdot D}}\right) \]
      6. associate-/r*42.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}\right) \]
      7. unpow242.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\frac{\color{blue}{d \cdot d}}{D}}{D}\right) \]
      8. associate-*l/42.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \frac{\color{blue}{\frac{d}{D} \cdot d}}{D}\right) \]
      9. associate-*r/42.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      10. unpow242.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right) \]
    9. Simplified42.8%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{c0}{h \cdot w} \cdot {\left(\frac{d}{D}\right)}^{2}}\right) \]
    10. Step-by-step derivation
      1. pow242.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{c0}{h \cdot w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \]
      2. associate-/l/42.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{c0}{w}}{h}} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) \]
      3. *-commutative42.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{w}}{h}}\right) \]
      4. associate-*r/42.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\frac{d}{D} \cdot d}{D}} \cdot \frac{\frac{c0}{w}}{h}\right) \]
      5. associate-/l/42.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{\frac{d}{D} \cdot d}{D} \cdot \color{blue}{\frac{c0}{h \cdot w}}\right) \]
      6. clear-num42.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{\frac{d}{D} \cdot d}{D} \cdot \color{blue}{\frac{1}{\frac{h \cdot w}{c0}}}\right) \]
      7. frac-times42.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\left(\frac{d}{D} \cdot d\right) \cdot 1}{D \cdot \frac{h \cdot w}{c0}}}\right) \]
    11. Applied egg-rr42.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \color{blue}{\frac{\left(\frac{d}{D} \cdot d\right) \cdot 1}{D \cdot \frac{h \cdot w}{c0}}}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification46.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -4.5 \cdot 10^{+104}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq -6.2 \cdot 10^{-106}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{\left(d \cdot \frac{d}{D}\right) \cdot \frac{c0}{h}}{w \cdot D}\right)\\ \mathbf{elif}\;w \leq -7.6 \cdot 10^{-268}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq 2.65 \cdot 10^{-96}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \frac{d \cdot \frac{d}{D}}{D \cdot \frac{w \cdot h}{c0}}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 33.4% accurate, 151.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (c0 w h D d M) :precision binary64 0.0)
double code(double c0, double w, double h, double D, double d, double M) {
	return 0.0;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    code = 0.0d0
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	return 0.0;
}
def code(c0, w, h, D, d, M):
	return 0.0
function code(c0, w, h, D, d, M)
	return 0.0
end
function tmp = code(c0, w, h, D, d, M)
	tmp = 0.0;
end
code[c0_, w_, h_, D_, d_, M_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 27.8%

    \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
  2. Step-by-step derivation
    1. +-commutative27.8%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
    2. +-commutative27.8%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
    3. times-frac26.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    4. fma-neg26.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\color{blue}{\mathsf{fma}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, -M \cdot M\right)}}\right) \]
  3. Simplified29.8%

    \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in c0 around -inf 5.3%

    \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right)\right)} \]
  6. Step-by-step derivation
    1. mul-1-neg5.3%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right)} \]
    2. distribute-lft-in4.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(-\color{blue}{\left(c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right) + c0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}\right) \]
  7. Simplified32.1%

    \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{0} \]
  8. Taylor expanded in c0 around 0 35.8%

    \[\leadsto \color{blue}{0} \]
  9. Final simplification35.8%

    \[\leadsto 0 \]
  10. Add Preprocessing

Reproduce

?
herbie shell --seed 2024040 
(FPCore (c0 w h D d M)
  :name "Henrywood and Agarwal, Equation (13)"
  :precision binary64
  (* (/ c0 (* 2.0 w)) (+ (/ (* c0 (* d d)) (* (* w h) (* D D))) (sqrt (- (* (/ (* c0 (* d d)) (* (* w h) (* D D))) (/ (* c0 (* d d)) (* (* w h) (* D D)))) (* M M))))))