Henrywood and Agarwal, Equation (13)

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

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

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

\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;\frac{\frac{c0 \cdot {M}^{2}}{t\_5 - \mathsf{hypot}\left(M, t\_5\right)}}{2 \cdot w}\\

\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_2 \cdot \left(\frac{\frac{c0}{w} \cdot t\_0}{h} + \mathsf{hypot}\left(t\_0 \cdot \frac{c0}{w \cdot h}, M\right)\right)\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\frac{-t\_0}{w \cdot h} - \frac{t\_0}{w \cdot h}}\\


\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))))) < -5.0000000000000003e-134

    1. Initial program 81.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. Simplified79.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot {\left(\mathsf{hypot}\left(\frac{d}{D} \cdot \sqrt{\frac{\frac{c0}{w}}{h}}, \frac{d}{D} \cdot \sqrt{\color{blue}{\frac{\frac{c0}{w}}{h}}}\right)\right)}^{2} \]
    13. Simplified90.4%

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

    if -5.0000000000000003e-134 < (*.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 61.4%

      \[\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. +-commutative61.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{M}^{2}}{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - \mathsf{hypot}\left(M, \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)}\right)\right)} \]
      2. expm1-log1p67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{c0 \cdot {M}^{2}}{\frac{c0}{w} \cdot \frac{{\left(\frac{d}{D}\right)}^{2}}{h} - \mathsf{hypot}\left(M, \frac{c0}{w} \cdot \frac{{\left(\frac{d}{D}\right)}^{2}}{h}\right)}}{\color{blue}{2 \cdot w}} \]
    14. Simplified74.2%

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

    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 78.1%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h}} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    7. Step-by-step derivation
      1. cancel-sign-sub-inv77.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \mathsf{hypot}\left(\color{blue}{\left(\sqrt{\frac{c0}{w \cdot h}} \cdot \sqrt{\frac{c0}{w \cdot h}}\right)} \cdot \sqrt{{\left(\frac{d}{D}\right)}^{4}}, \sqrt{\left(-M\right) \cdot M}\right)\right) \]
      8. add-sqr-sqrt64.7%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \mathsf{hypot}\left(\frac{c0}{w \cdot h} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{\left(\frac{4}{2}\right)}}, \sqrt{\left(-M\right) \cdot M}\right)\right) \]
      10. metadata-eval71.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \mathsf{hypot}\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{\color{blue}{2}}, \sqrt{\left(-M\right) \cdot M}\right)\right) \]
      11. add-sqr-sqrt71.0%

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\frac{\frac{{M}^{2}}{w}}{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} - \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}} \]
      2. mul-1-neg28.4%

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

        \[\leadsto -0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\left(-\color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right) - \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}} \]
      4. unpow227.8%

        \[\leadsto -0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\left(-\frac{\frac{{d}^{2}}{\color{blue}{D \cdot D}}}{h \cdot w}\right) - \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}} \]
      5. associate-/l/28.4%

        \[\leadsto -0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\left(-\frac{\color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}}{h \cdot w}\right) - \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}} \]
      6. unpow228.4%

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\left(-\frac{{\left(\frac{d}{D}\right)}^{2}}{h \cdot w}\right) - \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}} \]
    13. Simplified40.0%

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

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

Alternative 2: 56.0% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;t\_1 \cdot \frac{{M}^{2}}{M + \frac{c0 \cdot {d}^{2}}{\left(w \cdot h\right) \cdot {D}^{2}}}\\

\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;t\_1 \cdot \left(\frac{\frac{c0}{w} \cdot t\_2}{h} + \mathsf{hypot}\left(t\_2 \cdot \frac{c0}{w \cdot h}, M\right)\right)\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\frac{-t\_2}{w \cdot h} - \frac{t\_2}{w \cdot h}}\\


\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))))) < -5.0000000000000003e-134

    1. Initial program 81.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. Simplified79.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot {\left(\mathsf{hypot}\left(\frac{d}{D} \cdot \sqrt{\frac{\frac{c0}{w}}{h}}, \frac{d}{D} \cdot \sqrt{\color{blue}{\frac{\frac{c0}{w}}{h}}}\right)\right)}^{2} \]
    13. Simplified90.4%

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

    if -5.0000000000000003e-134 < (*.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 61.4%

      \[\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. +-commutative61.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{{M}^{2}}{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - \mathsf{hypot}\left(M, \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)}\right)\right)} \]
      2. expm1-log1p67.3%

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

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

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

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

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

    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 78.1%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h}} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    7. Step-by-step derivation
      1. cancel-sign-sub-inv77.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \mathsf{hypot}\left(\color{blue}{\left(\sqrt{\frac{c0}{w \cdot h}} \cdot \sqrt{\frac{c0}{w \cdot h}}\right)} \cdot \sqrt{{\left(\frac{d}{D}\right)}^{4}}, \sqrt{\left(-M\right) \cdot M}\right)\right) \]
      8. add-sqr-sqrt64.7%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \mathsf{hypot}\left(\frac{c0}{w \cdot h} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{\left(\frac{4}{2}\right)}}, \sqrt{\left(-M\right) \cdot M}\right)\right) \]
      10. metadata-eval71.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w}}{h} + \mathsf{hypot}\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{\color{blue}{2}}, \sqrt{\left(-M\right) \cdot M}\right)\right) \]
      11. add-sqr-sqrt71.0%

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\frac{\frac{{M}^{2}}{w}}{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} - \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}} \]
      2. mul-1-neg28.4%

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

        \[\leadsto -0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\left(-\color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right) - \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}} \]
      4. unpow227.8%

        \[\leadsto -0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\left(-\frac{\frac{{d}^{2}}{\color{blue}{D \cdot D}}}{h \cdot w}\right) - \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}} \]
      5. associate-/l/28.4%

        \[\leadsto -0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\left(-\frac{\color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}}{h \cdot w}\right) - \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}} \]
      6. unpow228.4%

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\left(-\frac{{\left(\frac{d}{D}\right)}^{2}}{h \cdot w}\right) - \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}} \]
    13. Simplified40.0%

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

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

Alternative 3: 54.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\frac{d}{D}\right)}^{2}\\ t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\ t_2 := \frac{c0}{2 \cdot w} \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_1 - M \cdot M}\right)\\ \mathbf{if}\;t\_2 \leq \infty:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\frac{-t\_0}{w \cdot h} - \frac{t\_0}{w \cdot h}}\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (pow (/ d D) 2.0))
        (t_1 (/ (* c0 (* d d)) (* (* D D) (* w h))))
        (t_2 (* (/ c0 (* 2.0 w)) (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))))
   (if (<= t_2 INFINITY)
     t_2
     (* -0.5 (/ (/ (pow M 2.0) w) (- (/ (- t_0) (* w h)) (/ t_0 (* w h))))))))
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 * (d * d)) / ((D * D) * (w * h));
	double t_2 = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
	double tmp;
	if (t_2 <= ((double) INFINITY)) {
		tmp = t_2;
	} else {
		tmp = -0.5 * ((pow(M, 2.0) / w) / ((-t_0 / (w * h)) - (t_0 / (w * h))));
	}
	return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = Math.pow((d / D), 2.0);
	double t_1 = (c0 * (d * d)) / ((D * D) * (w * h));
	double t_2 = (c0 / (2.0 * w)) * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))));
	double tmp;
	if (t_2 <= Double.POSITIVE_INFINITY) {
		tmp = t_2;
	} else {
		tmp = -0.5 * ((Math.pow(M, 2.0) / w) / ((-t_0 / (w * h)) - (t_0 / (w * h))));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = math.pow((d / D), 2.0)
	t_1 = (c0 * (d * d)) / ((D * D) * (w * h))
	t_2 = (c0 / (2.0 * w)) * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))
	tmp = 0
	if t_2 <= math.inf:
		tmp = t_2
	else:
		tmp = -0.5 * ((math.pow(M, 2.0) / w) / ((-t_0 / (w * h)) - (t_0 / (w * h))))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(d / D) ^ 2.0
	t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h)))
	t_2 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M)))))
	tmp = 0.0
	if (t_2 <= Inf)
		tmp = t_2;
	else
		tmp = Float64(-0.5 * Float64(Float64((M ^ 2.0) / w) / Float64(Float64(Float64(-t_0) / Float64(w * h)) - Float64(t_0 / Float64(w * h)))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (d / D) ^ 2.0;
	t_1 = (c0 * (d * d)) / ((D * D) * (w * h));
	t_2 = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
	tmp = 0.0;
	if (t_2 <= Inf)
		tmp = t_2;
	else
		tmp = -0.5 * (((M ^ 2.0) / w) / ((-t_0 / (w * h)) - (t_0 / (w * h))));
	end
	tmp_2 = 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[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, Infinity], t$95$2, N[(-0.5 * N[(N[(N[Power[M, 2.0], $MachinePrecision] / w), $MachinePrecision] / N[(N[((-t$95$0) / N[(w * h), $MachinePrecision]), $MachinePrecision] - N[(t$95$0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\frac{-t\_0}{w \cdot h} - \frac{t\_0}{w \cdot h}}\\


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

    1. Initial program 76.4%

      \[\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. Add Preprocessing

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -0.5 \cdot \color{blue}{\frac{\frac{{M}^{2}}{w}}{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} - \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}} \]
      2. mul-1-neg28.4%

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

        \[\leadsto -0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\left(-\color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}\right) - \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}} \]
      4. unpow227.8%

        \[\leadsto -0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\left(-\frac{\frac{{d}^{2}}{\color{blue}{D \cdot D}}}{h \cdot w}\right) - \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}} \]
      5. associate-/l/28.4%

        \[\leadsto -0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\left(-\frac{\color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}}{h \cdot w}\right) - \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}} \]
      6. unpow228.4%

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

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

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

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

        \[\leadsto -0.5 \cdot \frac{\frac{{M}^{2}}{w}}{\left(-\frac{{\left(\frac{d}{D}\right)}^{2}}{h \cdot w}\right) - \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{h \cdot w}}} \]
    13. Simplified40.0%

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

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

Alternative 4: 54.6% accurate, 0.5× speedup?

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

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

\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 76.4%

      \[\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. Add Preprocessing

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{0} \]
    8. Taylor expanded in c0 around 0 38.5%

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

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

Alternative 5: 45.1% accurate, 3.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c0 \leq -1.2 \cdot 10^{-115} \lor \neg \left(c0 \leq 3.3 \cdot 10^{-75} \lor \neg \left(c0 \leq 6.5 \cdot 10^{+98}\right) \land c0 \leq 5.5 \cdot 10^{+144}\right):\\ \;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (if (or (<= c0 -1.2e-115)
         (not
          (or (<= c0 3.3e-75) (and (not (<= c0 6.5e+98)) (<= c0 5.5e+144)))))
   (* (/ (/ c0 w) 2.0) (* 2.0 (* (/ (/ c0 w) h) (* (/ d D) (/ d D)))))
   0.0))
double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if ((c0 <= -1.2e-115) || !((c0 <= 3.3e-75) || (!(c0 <= 6.5e+98) && (c0 <= 5.5e+144)))) {
		tmp = ((c0 / w) / 2.0) * (2.0 * (((c0 / w) / h) * ((d / D) * (d / D))));
	} 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 ((c0 <= (-1.2d-115)) .or. (.not. (c0 <= 3.3d-75) .or. (.not. (c0 <= 6.5d+98)) .and. (c0 <= 5.5d+144))) then
        tmp = ((c0 / w) / 2.0d0) * (2.0d0 * (((c0 / w) / h) * ((d_1 / d) * (d_1 / d))))
    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 ((c0 <= -1.2e-115) || !((c0 <= 3.3e-75) || (!(c0 <= 6.5e+98) && (c0 <= 5.5e+144)))) {
		tmp = ((c0 / w) / 2.0) * (2.0 * (((c0 / w) / h) * ((d / D) * (d / D))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	tmp = 0
	if (c0 <= -1.2e-115) or not ((c0 <= 3.3e-75) or (not (c0 <= 6.5e+98) and (c0 <= 5.5e+144))):
		tmp = ((c0 / w) / 2.0) * (2.0 * (((c0 / w) / h) * ((d / D) * (d / D))))
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	tmp = 0.0
	if ((c0 <= -1.2e-115) || !((c0 <= 3.3e-75) || (!(c0 <= 6.5e+98) && (c0 <= 5.5e+144))))
		tmp = Float64(Float64(Float64(c0 / w) / 2.0) * Float64(2.0 * Float64(Float64(Float64(c0 / w) / h) * Float64(Float64(d / D) * Float64(d / D)))));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	tmp = 0.0;
	if ((c0 <= -1.2e-115) || ~(((c0 <= 3.3e-75) || (~((c0 <= 6.5e+98)) && (c0 <= 5.5e+144)))))
		tmp = ((c0 / w) / 2.0) * (2.0 * (((c0 / w) / h) * ((d / D) * (d / D))));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[c0, -1.2e-115], N[Not[Or[LessEqual[c0, 3.3e-75], And[N[Not[LessEqual[c0, 6.5e+98]], $MachinePrecision], LessEqual[c0, 5.5e+144]]]], $MachinePrecision]], N[(N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision] * N[(2.0 * N[(N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;c0 \leq -1.2 \cdot 10^{-115} \lor \neg \left(c0 \leq 3.3 \cdot 10^{-75} \lor \neg \left(c0 \leq 6.5 \cdot 10^{+98}\right) \land c0 \leq 5.5 \cdot 10^{+144}\right):\\
\;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c0 < -1.20000000000000011e-115 or 3.3e-75 < c0 < 6.4999999999999999e98 or 5.50000000000000022e144 < c0

    1. Initial program 31.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. Simplified40.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right)\right) \]
    16. Applied egg-rr54.3%

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

    if -1.20000000000000011e-115 < c0 < 3.3e-75 or 6.4999999999999999e98 < c0 < 5.50000000000000022e144

    1. Initial program 16.1%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{0} \]
    8. Taylor expanded in c0 around 0 47.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -1.2 \cdot 10^{-115} \lor \neg \left(c0 \leq 3.3 \cdot 10^{-75} \lor \neg \left(c0 \leq 6.5 \cdot 10^{+98}\right) \land c0 \leq 5.5 \cdot 10^{+144}\right):\\ \;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 44.9% accurate, 3.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\frac{c0}{w}}{h}\\ t_1 := \frac{\frac{c0}{w}}{2}\\ t_2 := t\_1 \cdot \left(2 \cdot \left(t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\ \mathbf{if}\;c0 \leq -1.5 \cdot 10^{-115}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;c0 \leq 2.25 \cdot 10^{-76}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \leq 7 \cdot 10^{+98}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;c0 \leq 3 \cdot 10^{+144}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(2 \cdot \left(t\_0 \cdot \frac{d \cdot \frac{d}{D}}{D}\right)\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (/ c0 w) h))
        (t_1 (/ (/ c0 w) 2.0))
        (t_2 (* t_1 (* 2.0 (* t_0 (* (/ d D) (/ d D)))))))
   (if (<= c0 -1.5e-115)
     t_2
     (if (<= c0 2.25e-76)
       0.0
       (if (<= c0 7e+98)
         t_2
         (if (<= c0 3e+144)
           0.0
           (* t_1 (* 2.0 (* t_0 (/ (* d (/ d D)) D))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 / w) / h;
	double t_1 = (c0 / w) / 2.0;
	double t_2 = t_1 * (2.0 * (t_0 * ((d / D) * (d / D))));
	double tmp;
	if (c0 <= -1.5e-115) {
		tmp = t_2;
	} else if (c0 <= 2.25e-76) {
		tmp = 0.0;
	} else if (c0 <= 7e+98) {
		tmp = t_2;
	} else if (c0 <= 3e+144) {
		tmp = 0.0;
	} else {
		tmp = t_1 * (2.0 * (t_0 * ((d * (d / D)) / D)));
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = (c0 / w) / h
    t_1 = (c0 / w) / 2.0d0
    t_2 = t_1 * (2.0d0 * (t_0 * ((d_1 / d) * (d_1 / d))))
    if (c0 <= (-1.5d-115)) then
        tmp = t_2
    else if (c0 <= 2.25d-76) then
        tmp = 0.0d0
    else if (c0 <= 7d+98) then
        tmp = t_2
    else if (c0 <= 3d+144) then
        tmp = 0.0d0
    else
        tmp = t_1 * (2.0d0 * (t_0 * ((d_1 * (d_1 / d)) / d)))
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 / w) / h;
	double t_1 = (c0 / w) / 2.0;
	double t_2 = t_1 * (2.0 * (t_0 * ((d / D) * (d / D))));
	double tmp;
	if (c0 <= -1.5e-115) {
		tmp = t_2;
	} else if (c0 <= 2.25e-76) {
		tmp = 0.0;
	} else if (c0 <= 7e+98) {
		tmp = t_2;
	} else if (c0 <= 3e+144) {
		tmp = 0.0;
	} else {
		tmp = t_1 * (2.0 * (t_0 * ((d * (d / D)) / D)));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 / w) / h
	t_1 = (c0 / w) / 2.0
	t_2 = t_1 * (2.0 * (t_0 * ((d / D) * (d / D))))
	tmp = 0
	if c0 <= -1.5e-115:
		tmp = t_2
	elif c0 <= 2.25e-76:
		tmp = 0.0
	elif c0 <= 7e+98:
		tmp = t_2
	elif c0 <= 3e+144:
		tmp = 0.0
	else:
		tmp = t_1 * (2.0 * (t_0 * ((d * (d / D)) / D)))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 / w) / h)
	t_1 = Float64(Float64(c0 / w) / 2.0)
	t_2 = Float64(t_1 * Float64(2.0 * Float64(t_0 * Float64(Float64(d / D) * Float64(d / D)))))
	tmp = 0.0
	if (c0 <= -1.5e-115)
		tmp = t_2;
	elseif (c0 <= 2.25e-76)
		tmp = 0.0;
	elseif (c0 <= 7e+98)
		tmp = t_2;
	elseif (c0 <= 3e+144)
		tmp = 0.0;
	else
		tmp = Float64(t_1 * Float64(2.0 * Float64(t_0 * Float64(Float64(d * Float64(d / D)) / D))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (c0 / w) / h;
	t_1 = (c0 / w) / 2.0;
	t_2 = t_1 * (2.0 * (t_0 * ((d / D) * (d / D))));
	tmp = 0.0;
	if (c0 <= -1.5e-115)
		tmp = t_2;
	elseif (c0 <= 2.25e-76)
		tmp = 0.0;
	elseif (c0 <= 7e+98)
		tmp = t_2;
	elseif (c0 <= 3e+144)
		tmp = 0.0;
	else
		tmp = t_1 * (2.0 * (t_0 * ((d * (d / D)) / D)));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / w), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(2.0 * N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -1.5e-115], t$95$2, If[LessEqual[c0, 2.25e-76], 0.0, If[LessEqual[c0, 7e+98], t$95$2, If[LessEqual[c0, 3e+144], 0.0, N[(t$95$1 * N[(2.0 * N[(t$95$0 * N[(N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\frac{c0}{w}}{h}\\
t_1 := \frac{\frac{c0}{w}}{2}\\
t_2 := t\_1 \cdot \left(2 \cdot \left(t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\
\mathbf{if}\;c0 \leq -1.5 \cdot 10^{-115}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;c0 \leq 2.25 \cdot 10^{-76}:\\
\;\;\;\;0\\

\mathbf{elif}\;c0 \leq 7 \cdot 10^{+98}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;c0 \leq 3 \cdot 10^{+144}:\\
\;\;\;\;0\\

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(2 \cdot \left(t\_0 \cdot \frac{d \cdot \frac{d}{D}}{D}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c0 < -1.5000000000000001e-115 or 2.25e-76 < c0 < 7e98

    1. Initial program 30.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. Simplified37.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right)\right) \]
    16. Applied egg-rr51.1%

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

    if -1.5000000000000001e-115 < c0 < 2.25e-76 or 7e98 < c0 < 2.9999999999999999e144

    1. Initial program 16.1%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{0} \]
    8. Taylor expanded in c0 around 0 47.5%

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

    if 2.9999999999999999e144 < c0

    1. Initial program 35.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. Simplified52.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \color{blue}{\frac{\frac{d}{D} \cdot d}{D}}\right)\right) \]
    16. Applied egg-rr66.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -1.5 \cdot 10^{-115}:\\ \;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\ \mathbf{elif}\;c0 \leq 2.25 \cdot 10^{-76}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \leq 7 \cdot 10^{+98}:\\ \;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\ \mathbf{elif}\;c0 \leq 3 \cdot 10^{+144}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c0}{w}}{2} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \frac{d \cdot \frac{d}{D}}{D}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 33.6% accurate, 12.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 3.25 \cdot 10^{+212}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c0 \cdot M}{w}\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (if (<= M 3.25e+212) 0.0 (* -0.5 (/ (* c0 M) w))))
double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if (M <= 3.25e+212) {
		tmp = 0.0;
	} else {
		tmp = -0.5 * ((c0 * M) / w);
	}
	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 (m <= 3.25d+212) then
        tmp = 0.0d0
    else
        tmp = (-0.5d0) * ((c0 * m) / w)
    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 (M <= 3.25e+212) {
		tmp = 0.0;
	} else {
		tmp = -0.5 * ((c0 * M) / w);
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	tmp = 0
	if M <= 3.25e+212:
		tmp = 0.0
	else:
		tmp = -0.5 * ((c0 * M) / w)
	return tmp
function code(c0, w, h, D, d, M)
	tmp = 0.0
	if (M <= 3.25e+212)
		tmp = 0.0;
	else
		tmp = Float64(-0.5 * Float64(Float64(c0 * M) / w));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	tmp = 0.0;
	if (M <= 3.25e+212)
		tmp = 0.0;
	else
		tmp = -0.5 * ((c0 * M) / w);
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 3.25e+212], 0.0, N[(-0.5 * N[(N[(c0 * M), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \leq 3.25 \cdot 10^{+212}:\\
\;\;\;\;0\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c0 \cdot M}{w}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 3.24999999999999999e212

    1. Initial program 27.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{0} \]
    8. Taylor expanded in c0 around 0 31.9%

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

    if 3.24999999999999999e212 < M

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-0.5 \cdot \frac{M \cdot c0}{w}} \]
    12. Step-by-step derivation
      1. *-commutative3.9%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{c0 \cdot M}}{w} \]
    13. Simplified3.9%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{c0 \cdot M}{w}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification31.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 3.25 \cdot 10^{+212}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c0 \cdot M}{w}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 35.1% accurate, 12.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 5.2 \cdot 10^{+80}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{c0 \cdot M}{w}\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (if (<= M 5.2e+80) 0.0 (* 0.5 (/ (* c0 M) w))))
double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if (M <= 5.2e+80) {
		tmp = 0.0;
	} else {
		tmp = 0.5 * ((c0 * M) / w);
	}
	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 (m <= 5.2d+80) then
        tmp = 0.0d0
    else
        tmp = 0.5d0 * ((c0 * m) / w)
    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 (M <= 5.2e+80) {
		tmp = 0.0;
	} else {
		tmp = 0.5 * ((c0 * M) / w);
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	tmp = 0
	if M <= 5.2e+80:
		tmp = 0.0
	else:
		tmp = 0.5 * ((c0 * M) / w)
	return tmp
function code(c0, w, h, D, d, M)
	tmp = 0.0
	if (M <= 5.2e+80)
		tmp = 0.0;
	else
		tmp = Float64(0.5 * Float64(Float64(c0 * M) / w));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	tmp = 0.0;
	if (M <= 5.2e+80)
		tmp = 0.0;
	else
		tmp = 0.5 * ((c0 * M) / w);
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 5.2e+80], 0.0, N[(0.5 * N[(N[(c0 * M), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \leq 5.2 \cdot 10^{+80}:\\
\;\;\;\;0\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{c0 \cdot M}{w}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 5.19999999999999963e80

    1. Initial program 27.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{0} \]
    8. Taylor expanded in c0 around 0 34.1%

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

    if 5.19999999999999963e80 < M

    1. Initial program 25.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \frac{M \cdot c0}{w}} \]
    12. Step-by-step derivation
      1. *-commutative27.3%

        \[\leadsto 0.5 \cdot \frac{\color{blue}{c0 \cdot M}}{w} \]
    13. Simplified27.3%

      \[\leadsto \color{blue}{0.5 \cdot \frac{c0 \cdot M}{w}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification33.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 5.2 \cdot 10^{+80}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{c0 \cdot M}{w}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 33.7% accurate, 151.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (c0 w h D d M) :precision binary64 0.0)
double code(double c0, double w, double h, double D, double d, double M) {
	return 0.0;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    code = 0.0d0
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	return 0.0;
}
def code(c0, w, h, D, d, M):
	return 0.0
function code(c0, w, h, D, d, M)
	return 0.0
end
function tmp = code(c0, w, h, D, d, M)
	tmp = 0.0;
end
code[c0_, w_, h_, D_, d_, M_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 27.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. +-commutative27.2%

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

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

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

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

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

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

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

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

    \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{0} \]
  8. Taylor expanded in c0 around 0 31.1%

    \[\leadsto \color{blue}{0} \]
  9. Final simplification31.1%

    \[\leadsto 0 \]
  10. Add Preprocessing

Reproduce

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