Henrywood and Agarwal, Equation (13)

Percentage Accurate: 24.8% → 55.9%
Time: 21.9s
Alternatives: 6
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 6 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.8% 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: 55.9% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := \left(w \cdot h\right) \cdot \left(D \cdot D\right)\\
t_2 := \left(d \cdot d\right) \cdot \frac{c0}{t_1}\\
t_3 := {t_2}^{2}\\
t_4 := \frac{c0 \cdot \left(d \cdot d\right)}{t_1}\\
t_5 := t_0 \cdot \left(t_4 + \sqrt{t_4 \cdot t_4 - M \cdot M}\right)\\
t_6 := {\left(\frac{d}{D}\right)}^{2}\\
\mathbf{if}\;t_5 \leq -2 \cdot 10^{-251}:\\
\;\;\;\;t_0 \cdot \frac{c0 \cdot \frac{t_6}{w} - t_6 \cdot \frac{c0}{w \cdot \sqrt[3]{-1}}}{h}\\

\mathbf{elif}\;t_5 \leq 0:\\
\;\;\;\;t_0 \cdot \frac{M \cdot M + \left(t_3 - t_3\right)}{t_2 - \sqrt{t_3 - M \cdot M}}\\

\mathbf{elif}\;t_5 \leq \infty:\\
\;\;\;\;\frac{c0}{w} \cdot \left(\left(d \cdot d\right) \cdot \frac{c0}{D \cdot \left(\left(w \cdot h\right) \cdot D\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;t_0 \cdot \mathsf{fma}\left(0, c0, \frac{0.5}{c0} \cdot \frac{w \cdot \left(M \cdot \left(h \cdot M\right)\right)}{t_6}\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))))) < -2.00000000000000003e-251

    1. Initial program 74.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. times-frac70.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) \]
      2. fma-def70.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \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)} \]
      3. associate-/r*70.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{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. difference-of-squares70.1%

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \color{blue}{\frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}}\right) \]
    5. Step-by-step derivation
      1. times-frac72.3%

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \color{blue}{\left(d \cdot d\right) \cdot \frac{c0}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}}\right) \]
    7. Step-by-step derivation
      1. add-cbrt-cube66.1%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \frac{\frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(\sqrt[3]{-1} \cdot w\right)} + -1 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot w}}{h}\right)} \]
    12. Step-by-step derivation
      1. associate-*r/78.3%

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

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

    if -2.00000000000000003e-251 < (*.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 52.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. times-frac37.3%

        \[\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) \]
      2. fma-def26.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \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)} \]
      3. associate-/r*26.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{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. difference-of-squares26.4%

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

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

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

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

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

        \[\leadsto \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{\color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} + M\right)} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      5. associate-/l/36.5%

        \[\leadsto \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{\left(\frac{c0}{w \cdot h} \cdot \color{blue}{\frac{d \cdot d}{D \cdot D}} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      6. times-frac41.1%

        \[\leadsto \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{\left(\color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      7. associate-/l/41.1%

        \[\leadsto \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{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\frac{d \cdot d}{D \cdot D}} - M\right)}\right) \]
      8. times-frac52.3%

        \[\leadsto \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{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}} - M\right)}\right) \]
    5. Applied egg-rr51.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\frac{{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right)}^{2} - \left({\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right)}^{2} - M \cdot M\right)}{\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)}^{2} - M \cdot M}}} \]
    6. Step-by-step derivation
      1. Simplified77.6%

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

      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 72.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. times-frac69.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) \]
        2. fma-def69.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \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)} \]
        3. associate-/r*69.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{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. difference-of-squares69.0%

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)} \]
      5. Step-by-step derivation
        1. times-frac74.4%

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

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

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

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right)}\right) \]
        5. times-frac77.1%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right)\right) \]
        6. unpow277.1%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right)\right) \]
      6. Simplified77.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c0}{w} \cdot \frac{\frac{{\left(\frac{d}{D}\right)}^{2}}{w \cdot h} \cdot c0}{1}} \]
      11. Taylor expanded in d around 0 74.3%

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

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

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

          \[\leadsto \frac{c0}{w} \cdot \frac{\left(d \cdot d\right) \cdot \frac{c0}{\color{blue}{\left(D \cdot D\right)} \cdot \left(w \cdot h\right)}}{1} \]
        4. associate-*r*79.6%

          \[\leadsto \frac{c0}{w} \cdot \frac{\left(d \cdot d\right) \cdot \frac{c0}{\color{blue}{D \cdot \left(D \cdot \left(w \cdot h\right)\right)}}}{1} \]
      13. Simplified79.6%

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

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

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\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. *-commutative0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(d \cdot d\right) \cdot \frac{c0}{\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. fma-def0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(d \cdot d, \frac{c0}{\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)} \]
        4. associate-*l*0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{w \cdot \left(h \cdot \left(D \cdot D\right)\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) \]
        5. *-commutative0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{\left(h \cdot \left(D \cdot D\right)\right) \cdot w}}, \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) \]
        6. associate-*r*0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{\left(\left(h \cdot D\right) \cdot D\right)} \cdot w}, \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) \]
        7. associate-*l*0.1%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{\left(h \cdot D\right) \cdot \left(D \cdot w\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) \]
        8. *-commutative0.1%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\left(h \cdot D\right) \cdot \color{blue}{\left(w \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. Simplified4.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(-1 \cdot \left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)\right) \cdot c0} + 0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}\right) \]
        3. *-commutative2.0%

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0, c0, \frac{0.5}{c0} \cdot \frac{w \cdot \left(\left(h \cdot M\right) \cdot M\right)}{{\left(\frac{d}{D}\right)}^{2}}\right)} \]
    7. Recombined 4 regimes into one program.
    8. Final simplification61.4%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\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) \leq -2 \cdot 10^{-251}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{c0 \cdot \frac{{\left(\frac{d}{D}\right)}^{2}}{w} - {\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot \sqrt[3]{-1}}}{h}\\ \mathbf{elif}\;\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) \leq 0:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{M \cdot M + \left({\left(\left(d \cdot d\right) \cdot \frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)}^{2} - {\left(\left(d \cdot d\right) \cdot \frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)}^{2}\right)}{\left(d \cdot d\right) \cdot \frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - \sqrt{{\left(\left(d \cdot d\right) \cdot \frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)}^{2} - M \cdot M}}\\ \mathbf{elif}\;\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) \leq \infty:\\ \;\;\;\;\frac{c0}{w} \cdot \left(\left(d \cdot d\right) \cdot \frac{c0}{D \cdot \left(\left(w \cdot h\right) \cdot D\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0, c0, \frac{0.5}{c0} \cdot \frac{w \cdot \left(M \cdot \left(h \cdot M\right)\right)}{{\left(\frac{d}{D}\right)}^{2}}\right)\\ \end{array} \]

    Alternative 2: 55.1% accurate, 0.3× 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{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \mathbf{if}\;t_1 \cdot \left(t_2 + \sqrt{t_2 \cdot t_2 - M \cdot M}\right) \leq \infty:\\ \;\;\;\;t_1 \cdot \frac{c0 \cdot \frac{t_0}{w} - t_0 \cdot \frac{c0}{w \cdot \sqrt[3]{-1}}}{h}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \mathsf{fma}\left(0, c0, \frac{0.5}{c0} \cdot \frac{w \cdot \left(M \cdot \left(h \cdot M\right)\right)}{t_0}\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 (* d d)) (* (* w h) (* D D)))))
       (if (<= (* t_1 (+ t_2 (sqrt (- (* t_2 t_2) (* M M))))) INFINITY)
         (* t_1 (/ (- (* c0 (/ t_0 w)) (* t_0 (/ c0 (* w (cbrt -1.0))))) h))
         (* t_1 (fma 0.0 c0 (* (/ 0.5 c0) (/ (* w (* M (* h M))) t_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 * (d * d)) / ((w * h) * (D * D));
    	double tmp;
    	if ((t_1 * (t_2 + sqrt(((t_2 * t_2) - (M * M))))) <= ((double) INFINITY)) {
    		tmp = t_1 * (((c0 * (t_0 / w)) - (t_0 * (c0 / (w * cbrt(-1.0))))) / h);
    	} else {
    		tmp = t_1 * fma(0.0, c0, ((0.5 / c0) * ((w * (M * (h * M))) / t_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 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))
    	tmp = 0.0
    	if (Float64(t_1 * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))))) <= Inf)
    		tmp = Float64(t_1 * Float64(Float64(Float64(c0 * Float64(t_0 / w)) - Float64(t_0 * Float64(c0 / Float64(w * cbrt(-1.0))))) / h));
    	else
    		tmp = Float64(t_1 * fma(0.0, c0, Float64(Float64(0.5 / c0) * Float64(Float64(w * Float64(M * Float64(h * M))) / t_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 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[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], Infinity], N[(t$95$1 * N[(N[(N[(c0 * N[(t$95$0 / w), $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[(c0 / N[(w * N[Power[-1.0, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(0.0 * c0 + N[(N[(0.5 / c0), $MachinePrecision] * N[(N[(w * N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$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{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
    \mathbf{if}\;t_1 \cdot \left(t_2 + \sqrt{t_2 \cdot t_2 - M \cdot M}\right) \leq \infty:\\
    \;\;\;\;t_1 \cdot \frac{c0 \cdot \frac{t_0}{w} - t_0 \cdot \frac{c0}{w \cdot \sqrt[3]{-1}}}{h}\\
    
    \mathbf{else}:\\
    \;\;\;\;t_1 \cdot \mathsf{fma}\left(0, c0, \frac{0.5}{c0} \cdot \frac{w \cdot \left(M \cdot \left(h \cdot M\right)\right)}{t_0}\right)\\
    
    
    \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

      1. Initial program 71.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. times-frac66.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) \]
        2. fma-def65.4%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \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)} \]
        3. associate-/r*65.4%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{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. difference-of-squares65.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \color{blue}{\left(d \cdot d\right) \cdot \frac{c0}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}}\right) \]
      7. Step-by-step derivation
        1. add-cbrt-cube63.5%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \frac{\frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(\sqrt[3]{-1} \cdot w\right)} + -1 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot w}}{h}\right)} \]
      12. Step-by-step derivation
        1. associate-*r/73.1%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\frac{-\left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot \sqrt[3]{-1}} - c0 \cdot \frac{{\left(\frac{d}{D}\right)}^{2}}{w}\right)}{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. associate-*l/0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\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. *-commutative0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(d \cdot d\right) \cdot \frac{c0}{\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. fma-def0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(d \cdot d, \frac{c0}{\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)} \]
        4. associate-*l*0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{w \cdot \left(h \cdot \left(D \cdot D\right)\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) \]
        5. *-commutative0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{\left(h \cdot \left(D \cdot D\right)\right) \cdot w}}, \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) \]
        6. associate-*r*0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{\left(\left(h \cdot D\right) \cdot D\right)} \cdot w}, \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) \]
        7. associate-*l*0.1%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{\left(h \cdot D\right) \cdot \left(D \cdot w\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) \]
        8. *-commutative0.1%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\left(h \cdot D\right) \cdot \color{blue}{\left(w \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. Simplified4.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(-1 \cdot \left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)\right) \cdot c0} + 0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}\right) \]
        3. *-commutative2.0%

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0, c0, \frac{0.5}{c0} \cdot \frac{w \cdot \left(\left(h \cdot M\right) \cdot M\right)}{{\left(\frac{d}{D}\right)}^{2}}\right)} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification59.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\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) \leq \infty:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{c0 \cdot \frac{{\left(\frac{d}{D}\right)}^{2}}{w} - {\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot \sqrt[3]{-1}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0, c0, \frac{0.5}{c0} \cdot \frac{w \cdot \left(M \cdot \left(h \cdot M\right)\right)}{{\left(\frac{d}{D}\right)}^{2}}\right)\\ \end{array} \]

    Alternative 3: 55.5% accurate, 0.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \mathbf{if}\;t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right) \leq \infty:\\ \;\;\;\;\frac{c0}{w} \cdot \left(\left(d \cdot d\right) \cdot \frac{c0}{D \cdot \left(\left(w \cdot h\right) \cdot D\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \mathsf{fma}\left(0, c0, \frac{0.5}{c0} \cdot \frac{w \cdot \left(M \cdot \left(h \cdot M\right)\right)}{{\left(\frac{d}{D}\right)}^{2}}\right)\\ \end{array} \end{array} \]
    (FPCore (c0 w h D d M)
     :precision binary64
     (let* ((t_0 (/ c0 (* 2.0 w))) (t_1 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
       (if (<= (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M))))) INFINITY)
         (* (/ c0 w) (* (* d d) (/ c0 (* D (* (* w h) D)))))
         (*
          t_0
          (fma 0.0 c0 (* (/ 0.5 c0) (/ (* w (* M (* h M))) (pow (/ d D) 2.0))))))))
    double code(double c0, double w, double h, double D, double d, double M) {
    	double t_0 = c0 / (2.0 * w);
    	double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
    	double tmp;
    	if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= ((double) INFINITY)) {
    		tmp = (c0 / w) * ((d * d) * (c0 / (D * ((w * h) * D))));
    	} else {
    		tmp = t_0 * fma(0.0, c0, ((0.5 / c0) * ((w * (M * (h * M))) / pow((d / D), 2.0))));
    	}
    	return tmp;
    }
    
    function code(c0, w, h, D, d, M)
    	t_0 = Float64(c0 / Float64(2.0 * w))
    	t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))
    	tmp = 0.0
    	if (Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= Inf)
    		tmp = Float64(Float64(c0 / w) * Float64(Float64(d * d) * Float64(c0 / Float64(D * Float64(Float64(w * h) * D)))));
    	else
    		tmp = Float64(t_0 * fma(0.0, c0, Float64(Float64(0.5 / c0) * Float64(Float64(w * Float64(M * Float64(h * M))) / (Float64(d / D) ^ 2.0)))));
    	end
    	return tmp
    end
    
    code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(c0 / w), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] * N[(c0 / N[(D * N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(0.0 * c0 + N[(N[(0.5 / c0), $MachinePrecision] * N[(N[(w * N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{c0}{2 \cdot w}\\
    t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
    \mathbf{if}\;t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right) \leq \infty:\\
    \;\;\;\;\frac{c0}{w} \cdot \left(\left(d \cdot d\right) \cdot \frac{c0}{D \cdot \left(\left(w \cdot h\right) \cdot D\right)}\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t_0 \cdot \mathsf{fma}\left(0, c0, \frac{0.5}{c0} \cdot \frac{w \cdot \left(M \cdot \left(h \cdot M\right)\right)}{{\left(\frac{d}{D}\right)}^{2}}\right)\\
    
    
    \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

      1. Initial program 71.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. times-frac66.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) \]
        2. fma-def65.4%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \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)} \]
        3. associate-/r*65.4%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{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. difference-of-squares65.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c0}{w} \cdot \frac{\frac{{\left(\frac{d}{D}\right)}^{2}}{w \cdot h} \cdot c0}{1}} \]
      11. Taylor expanded in d around 0 70.7%

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

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

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

          \[\leadsto \frac{c0}{w} \cdot \frac{\left(d \cdot d\right) \cdot \frac{c0}{\color{blue}{\left(D \cdot D\right)} \cdot \left(w \cdot h\right)}}{1} \]
        4. associate-*r*73.7%

          \[\leadsto \frac{c0}{w} \cdot \frac{\left(d \cdot d\right) \cdot \frac{c0}{\color{blue}{D \cdot \left(D \cdot \left(w \cdot h\right)\right)}}}{1} \]
      13. Simplified73.7%

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

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

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\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. *-commutative0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(d \cdot d\right) \cdot \frac{c0}{\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. fma-def0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(d \cdot d, \frac{c0}{\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)} \]
        4. associate-*l*0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{w \cdot \left(h \cdot \left(D \cdot D\right)\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) \]
        5. *-commutative0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{\left(h \cdot \left(D \cdot D\right)\right) \cdot w}}, \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) \]
        6. associate-*r*0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{\left(\left(h \cdot D\right) \cdot D\right)} \cdot w}, \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) \]
        7. associate-*l*0.1%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\color{blue}{\left(h \cdot D\right) \cdot \left(D \cdot w\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) \]
        8. *-commutative0.1%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\left(h \cdot D\right) \cdot \color{blue}{\left(w \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. Simplified4.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(-1 \cdot \left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)\right) \cdot c0} + 0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}\right) \]
        3. *-commutative2.0%

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0, c0, \frac{0.5}{c0} \cdot \frac{w \cdot \left(\left(h \cdot M\right) \cdot M\right)}{{\left(\frac{d}{D}\right)}^{2}}\right)} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification59.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\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) \leq \infty:\\ \;\;\;\;\frac{c0}{w} \cdot \left(\left(d \cdot d\right) \cdot \frac{c0}{D \cdot \left(\left(w \cdot h\right) \cdot D\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0, c0, \frac{0.5}{c0} \cdot \frac{w \cdot \left(M \cdot \left(h \cdot M\right)\right)}{{\left(\frac{d}{D}\right)}^{2}}\right)\\ \end{array} \]

    Alternative 4: 56.1% accurate, 0.9× 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)}\\ \mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right) \leq \infty:\\ \;\;\;\;\frac{c0}{w} \cdot \left(\left(d \cdot d\right) \cdot \frac{c0}{D \cdot \left(\left(w \cdot h\right) \cdot D\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
    (FPCore (c0 w h D d M)
     :precision binary64
     (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
       (if (<=
            (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))
            INFINITY)
         (* (/ c0 w) (* (* d d) (/ c0 (* D (* (* w h) D)))))
         0.0)))
    double code(double c0, double w, double h, double D, double d, double M) {
    	double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
    	double tmp;
    	if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= ((double) INFINITY)) {
    		tmp = (c0 / w) * ((d * d) * (c0 / (D * ((w * h) * D))));
    	} else {
    		tmp = 0.0;
    	}
    	return tmp;
    }
    
    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));
    	double tmp;
    	if (((c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))))) <= Double.POSITIVE_INFINITY) {
    		tmp = (c0 / w) * ((d * d) * (c0 / (D * ((w * h) * D))));
    	} else {
    		tmp = 0.0;
    	}
    	return tmp;
    }
    
    def code(c0, w, h, D, d, M):
    	t_0 = (c0 * (d * d)) / ((w * h) * (D * D))
    	tmp = 0
    	if ((c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))) <= math.inf:
    		tmp = (c0 / w) * ((d * d) * (c0 / (D * ((w * h) * D))))
    	else:
    		tmp = 0.0
    	return tmp
    
    function code(c0, w, h, D, d, M)
    	t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))
    	tmp = 0.0
    	if (Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) <= Inf)
    		tmp = Float64(Float64(c0 / w) * Float64(Float64(d * d) * Float64(c0 / Float64(D * Float64(Float64(w * h) * D)))));
    	else
    		tmp = 0.0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(c0, w, h, D, d, M)
    	t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
    	tmp = 0.0;
    	if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= Inf)
    		tmp = (c0 / w) * ((d * d) * (c0 / (D * ((w * h) * D))));
    	else
    		tmp = 0.0;
    	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[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[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], Infinity], N[(N[(c0 / w), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] * N[(c0 / N[(D * N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
    
    \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)}\\
    \mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right) \leq \infty:\\
    \;\;\;\;\frac{c0}{w} \cdot \left(\left(d \cdot d\right) \cdot \frac{c0}{D \cdot \left(\left(w \cdot h\right) \cdot D\right)}\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;0\\
    
    
    \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

      1. Initial program 71.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. times-frac66.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) \]
        2. fma-def65.4%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \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)} \]
        3. associate-/r*65.4%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{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. difference-of-squares65.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c0}{w} \cdot \frac{\frac{{\left(\frac{d}{D}\right)}^{2}}{w \cdot h} \cdot c0}{1}} \]
      11. Taylor expanded in d around 0 70.7%

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

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

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

          \[\leadsto \frac{c0}{w} \cdot \frac{\left(d \cdot d\right) \cdot \frac{c0}{\color{blue}{\left(D \cdot D\right)} \cdot \left(w \cdot h\right)}}{1} \]
        4. associate-*r*73.7%

          \[\leadsto \frac{c0}{w} \cdot \frac{\left(d \cdot d\right) \cdot \frac{c0}{\color{blue}{D \cdot \left(D \cdot \left(w \cdot h\right)\right)}}}{1} \]
      13. Simplified73.7%

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

      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. 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) \]
        2. fma-def0.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \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)} \]
        3. associate-/r*0.1%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{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. difference-of-squares6.8%

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

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

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

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

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

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-1 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)\right) \cdot c0\right) \]
        4. mul0-lft45.7%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-1 \cdot \color{blue}{0}\right) \cdot c0\right) \]
        5. metadata-eval45.7%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{0} \cdot c0\right) \]
        6. mul0-lft2.5%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(0 \cdot \frac{{d}^{2} \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)}\right)} \cdot c0\right) \]
        7. metadata-eval2.5%

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

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

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

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2} \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}\right) \]
        11. metadata-eval2.5%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2} \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)}\right)\right) \]
        12. mul0-lft45.7%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \color{blue}{0}\right) \]
      6. Simplified45.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(c0 \cdot 0\right)} \]
      7. Taylor expanded in c0 around 0 49.6%

        \[\leadsto \color{blue}{0} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification58.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\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) \leq \infty:\\ \;\;\;\;\frac{c0}{w} \cdot \left(\left(d \cdot d\right) \cdot \frac{c0}{D \cdot \left(\left(w \cdot h\right) \cdot D\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

    Alternative 5: 36.1% accurate, 7.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq -6 \cdot 10^{-150}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq 1.22 \cdot 10^{-18}:\\ \;\;\;\;\frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
    (FPCore (c0 w h D d M)
     :precision binary64
     (if (<= w -6e-150)
       0.0
       (if (<= w 1.22e-18)
         (/ (* (* d d) (* c0 c0)) (* (* D D) (* h (* w w))))
         0.0)))
    double code(double c0, double w, double h, double D, double d, double M) {
    	double tmp;
    	if (w <= -6e-150) {
    		tmp = 0.0;
    	} else if (w <= 1.22e-18) {
    		tmp = ((d * d) * (c0 * c0)) / ((D * D) * (h * (w * w)));
    	} 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 <= (-6d-150)) then
            tmp = 0.0d0
        else if (w <= 1.22d-18) then
            tmp = ((d_1 * d_1) * (c0 * c0)) / ((d * d) * (h * (w * w)))
        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 <= -6e-150) {
    		tmp = 0.0;
    	} else if (w <= 1.22e-18) {
    		tmp = ((d * d) * (c0 * c0)) / ((D * D) * (h * (w * w)));
    	} else {
    		tmp = 0.0;
    	}
    	return tmp;
    }
    
    def code(c0, w, h, D, d, M):
    	tmp = 0
    	if w <= -6e-150:
    		tmp = 0.0
    	elif w <= 1.22e-18:
    		tmp = ((d * d) * (c0 * c0)) / ((D * D) * (h * (w * w)))
    	else:
    		tmp = 0.0
    	return tmp
    
    function code(c0, w, h, D, d, M)
    	tmp = 0.0
    	if (w <= -6e-150)
    		tmp = 0.0;
    	elseif (w <= 1.22e-18)
    		tmp = Float64(Float64(Float64(d * d) * Float64(c0 * c0)) / Float64(Float64(D * D) * Float64(h * Float64(w * w))));
    	else
    		tmp = 0.0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(c0, w, h, D, d, M)
    	tmp = 0.0;
    	if (w <= -6e-150)
    		tmp = 0.0;
    	elseif (w <= 1.22e-18)
    		tmp = ((d * d) * (c0 * c0)) / ((D * D) * (h * (w * w)));
    	else
    		tmp = 0.0;
    	end
    	tmp_2 = tmp;
    end
    
    code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[w, -6e-150], 0.0, If[LessEqual[w, 1.22e-18], N[(N[(N[(d * d), $MachinePrecision] * N[(c0 * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;w \leq -6 \cdot 10^{-150}:\\
    \;\;\;\;0\\
    
    \mathbf{elif}\;w \leq 1.22 \cdot 10^{-18}:\\
    \;\;\;\;\frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if w < -6.0000000000000003e-150 or 1.2200000000000001e-18 < w

      1. Initial program 18.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. times-frac16.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) \]
        2. fma-def15.9%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \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)} \]
        3. associate-/r*15.9%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{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. difference-of-squares19.1%

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

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

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

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

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

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-1 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)\right) \cdot c0\right) \]
        4. mul0-lft42.9%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-1 \cdot \color{blue}{0}\right) \cdot c0\right) \]
        5. metadata-eval42.9%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{0} \cdot c0\right) \]
        6. mul0-lft5.1%

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

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(\color{blue}{\left(-1 + 1\right)} \cdot \frac{{d}^{2} \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right) \]
        8. distribute-lft1-in5.1%

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

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(c0 \cdot \left(-1 \cdot \frac{{d}^{2} \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)} + \frac{{d}^{2} \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)}\right)\right)} \]
        10. distribute-lft1-in5.1%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2} \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}\right) \]
        11. metadata-eval5.1%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2} \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)}\right)\right) \]
        12. mul0-lft42.9%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \color{blue}{0}\right) \]
      6. Simplified42.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(c0 \cdot 0\right)} \]
      7. Taylor expanded in c0 around 0 44.2%

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

      if -6.0000000000000003e-150 < w < 1.2200000000000001e-18

      1. Initial program 37.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. times-frac35.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) \]
        2. fma-def35.6%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \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)} \]
        3. associate-/r*35.6%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{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. difference-of-squares41.8%

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)} \]
      5. Step-by-step derivation
        1. times-frac47.3%

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

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

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

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right)}\right) \]
        5. times-frac59.0%

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right)\right) \]
        6. unpow259.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{c0}{w} \cdot \frac{\frac{{\left(\frac{d}{D}\right)}^{2}}{w \cdot h} \cdot c0}{1}} \]
      11. Taylor expanded in c0 around 0 38.1%

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

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

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

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

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

          \[\leadsto \frac{\left(c0 \cdot c0\right) \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \color{blue}{\left(h \cdot {w}^{2}\right)}} \]
        6. unpow238.1%

          \[\leadsto \frac{\left(c0 \cdot c0\right) \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(h \cdot \color{blue}{\left(w \cdot w\right)}\right)} \]
      13. Simplified38.1%

        \[\leadsto \color{blue}{\frac{\left(c0 \cdot c0\right) \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification41.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -6 \cdot 10^{-150}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq 1.22 \cdot 10^{-18}:\\ \;\;\;\;\frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

    Alternative 6: 34.3% 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 25.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. times-frac23.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) \]
      2. fma-def23.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \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)} \]
      3. associate-/r*23.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{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. difference-of-squares27.9%

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-1 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)\right) \cdot c0\right) \]
      4. mul0-lft32.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-1 \cdot \color{blue}{0}\right) \cdot c0\right) \]
      5. metadata-eval32.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{0} \cdot c0\right) \]
      6. mul0-lft3.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(0 \cdot \frac{{d}^{2} \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)}\right)} \cdot c0\right) \]
      7. metadata-eval3.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(\color{blue}{\left(-1 + 1\right)} \cdot \frac{{d}^{2} \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right) \]
      8. distribute-lft1-in3.6%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(c0 \cdot \left(-1 \cdot \frac{{d}^{2} \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)} + \frac{{d}^{2} \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)}\right)\right)} \]
      10. distribute-lft1-in3.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2} \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}\right) \]
      11. metadata-eval3.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2} \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)}\right)\right) \]
      12. mul0-lft32.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \color{blue}{0}\right) \]
    6. Simplified32.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(c0 \cdot 0\right)} \]
    7. Taylor expanded in c0 around 0 35.0%

      \[\leadsto \color{blue}{0} \]
    8. Final simplification35.0%

      \[\leadsto 0 \]

    Reproduce

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