Henrywood and Agarwal, Equation (13)

Percentage Accurate: 24.7% → 55.0%
Time: 26.3s
Alternatives: 9
Speedup: 16.8×

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.7% 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.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := \left(w \cdot h\right) \cdot \left(D \cdot D\right)\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{t_0}\\
\mathbf{if}\;t_1 \cdot \left(t_2 + \sqrt{t_2 \cdot t_2 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;t_1 \cdot \mathsf{fma}\left(2, d \cdot \left(d \cdot \frac{c0}{t_0}\right), 0.5 \cdot \frac{D \cdot D}{\frac{d \cdot d}{w \cdot \left(h \cdot 0\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\


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

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. times-frac74.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) \]
      2. fma-def74.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0 \cdot \color{blue}{\left(c0 \cdot 0\right)}}{w \cdot 2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification58.9%

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

Alternative 2: 41.9% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0 \cdot \left(2 \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)}{2 \cdot w}\\ \mathbf{if}\;c0 \leq -2.2 \cdot 10^{-99}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c0 \leq 1.55 \cdot 10^{-186}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(c0 \cdot 0\right)\\ \mathbf{elif}\;c0 \leq 3.1 \cdot 10^{+52} \lor \neg \left(c0 \leq 9.5 \cdot 10^{+190}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0
         (/ (* c0 (* 2.0 (* (/ c0 (* w h)) (pow (/ d D) 2.0)))) (* 2.0 w))))
   (if (<= c0 -2.2e-99)
     t_0
     (if (<= c0 1.55e-186)
       (* (/ c0 (* 2.0 w)) (* c0 0.0))
       (if (or (<= c0 3.1e+52) (not (<= c0 9.5e+190)))
         t_0
         (/ (* c0 (* c0 0.0)) (* 2.0 w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * (2.0 * ((c0 / (w * h)) * pow((d / D), 2.0)))) / (2.0 * w);
	double tmp;
	if (c0 <= -2.2e-99) {
		tmp = t_0;
	} else if (c0 <= 1.55e-186) {
		tmp = (c0 / (2.0 * w)) * (c0 * 0.0);
	} else if ((c0 <= 3.1e+52) || !(c0 <= 9.5e+190)) {
		tmp = t_0;
	} else {
		tmp = (c0 * (c0 * 0.0)) / (2.0 * 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) :: t_0
    real(8) :: tmp
    t_0 = (c0 * (2.0d0 * ((c0 / (w * h)) * ((d_1 / d) ** 2.0d0)))) / (2.0d0 * w)
    if (c0 <= (-2.2d-99)) then
        tmp = t_0
    else if (c0 <= 1.55d-186) then
        tmp = (c0 / (2.0d0 * w)) * (c0 * 0.0d0)
    else if ((c0 <= 3.1d+52) .or. (.not. (c0 <= 9.5d+190))) then
        tmp = t_0
    else
        tmp = (c0 * (c0 * 0.0d0)) / (2.0d0 * w)
    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 * (2.0 * ((c0 / (w * h)) * Math.pow((d / D), 2.0)))) / (2.0 * w);
	double tmp;
	if (c0 <= -2.2e-99) {
		tmp = t_0;
	} else if (c0 <= 1.55e-186) {
		tmp = (c0 / (2.0 * w)) * (c0 * 0.0);
	} else if ((c0 <= 3.1e+52) || !(c0 <= 9.5e+190)) {
		tmp = t_0;
	} else {
		tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 * (2.0 * ((c0 / (w * h)) * math.pow((d / D), 2.0)))) / (2.0 * w)
	tmp = 0
	if c0 <= -2.2e-99:
		tmp = t_0
	elif c0 <= 1.55e-186:
		tmp = (c0 / (2.0 * w)) * (c0 * 0.0)
	elif (c0 <= 3.1e+52) or not (c0 <= 9.5e+190):
		tmp = t_0
	else:
		tmp = (c0 * (c0 * 0.0)) / (2.0 * w)
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 * Float64(2.0 * Float64(Float64(c0 / Float64(w * h)) * (Float64(d / D) ^ 2.0)))) / Float64(2.0 * w))
	tmp = 0.0
	if (c0 <= -2.2e-99)
		tmp = t_0;
	elseif (c0 <= 1.55e-186)
		tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(c0 * 0.0));
	elseif ((c0 <= 3.1e+52) || !(c0 <= 9.5e+190))
		tmp = t_0;
	else
		tmp = Float64(Float64(c0 * Float64(c0 * 0.0)) / Float64(2.0 * w));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (c0 * (2.0 * ((c0 / (w * h)) * ((d / D) ^ 2.0)))) / (2.0 * w);
	tmp = 0.0;
	if (c0 <= -2.2e-99)
		tmp = t_0;
	elseif (c0 <= 1.55e-186)
		tmp = (c0 / (2.0 * w)) * (c0 * 0.0);
	elseif ((c0 <= 3.1e+52) || ~((c0 <= 9.5e+190)))
		tmp = t_0;
	else
		tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(2.0 * N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -2.2e-99], t$95$0, If[LessEqual[c0, 1.55e-186], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[c0, 3.1e+52], N[Not[LessEqual[c0, 9.5e+190]], $MachinePrecision]], t$95$0, N[(N[(c0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(2 \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)}{2 \cdot w}\\
\mathbf{if}\;c0 \leq -2.2 \cdot 10^{-99}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;c0 \leq 1.55 \cdot 10^{-186}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(c0 \cdot 0\right)\\

\mathbf{elif}\;c0 \leq 3.1 \cdot 10^{+52} \lor \neg \left(c0 \leq 9.5 \cdot 10^{+190}\right):\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c0 < -2.20000000000000004e-99 or 1.55000000000000005e-186 < c0 < 3.1e52 or 9.4999999999999995e190 < c0

    1. Initial program 35.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. associate-*l*34.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.20000000000000004e-99 < c0 < 1.55000000000000005e-186

    1. Initial program 13.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. times-frac9.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) \]
      2. fma-def9.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.1e52 < c0 < 9.4999999999999995e190

    1. Initial program 22.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. associate-*l*22.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0 \cdot \color{blue}{\left(c0 \cdot 0\right)}}{w \cdot 2} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification55.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -2.2 \cdot 10^{-99}:\\ \;\;\;\;\frac{c0 \cdot \left(2 \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)}{2 \cdot w}\\ \mathbf{elif}\;c0 \leq 1.55 \cdot 10^{-186}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(c0 \cdot 0\right)\\ \mathbf{elif}\;c0 \leq 3.1 \cdot 10^{+52} \lor \neg \left(c0 \leq 9.5 \cdot 10^{+190}\right):\\ \;\;\;\;\frac{c0 \cdot \left(2 \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)}{2 \cdot w}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\ \end{array} \]

Alternative 3: 37.5% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ \mathbf{if}\;c0 \leq -2.55 \cdot 10^{-96}:\\ \;\;\;\;\frac{{\left(\frac{d}{D}\right)}^{2}}{w \cdot w} \cdot \frac{c0}{\frac{h}{c0}}\\ \mathbf{elif}\;c0 \leq 3.35 \cdot 10^{-130}:\\ \;\;\;\;t_0 \cdot \left(c0 \cdot 0\right)\\ \mathbf{elif}\;c0 \leq 2.7 \cdot 10^{+54}:\\ \;\;\;\;\frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot w\right)} \cdot \frac{c0 \cdot c0}{h}\\ \mathbf{elif}\;c0 \leq 3.6 \cdot 10^{+169}:\\ \;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ c0 (* 2.0 w))))
   (if (<= c0 -2.55e-96)
     (* (/ (pow (/ d D) 2.0) (* w w)) (/ c0 (/ h c0)))
     (if (<= c0 3.35e-130)
       (* t_0 (* c0 0.0))
       (if (<= c0 2.7e+54)
         (* (/ (* d d) (* (* D D) (* w w))) (/ (* c0 c0) h))
         (if (<= c0 3.6e+169)
           (/ (* c0 (* c0 0.0)) (* 2.0 w))
           (* t_0 (/ (* 2.0 (* c0 (* d d))) (* (* w h) (* D D))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (2.0 * w);
	double tmp;
	if (c0 <= -2.55e-96) {
		tmp = (pow((d / D), 2.0) / (w * w)) * (c0 / (h / c0));
	} else if (c0 <= 3.35e-130) {
		tmp = t_0 * (c0 * 0.0);
	} else if (c0 <= 2.7e+54) {
		tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h);
	} else if (c0 <= 3.6e+169) {
		tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
	} else {
		tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (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) :: tmp
    t_0 = c0 / (2.0d0 * w)
    if (c0 <= (-2.55d-96)) then
        tmp = (((d_1 / d) ** 2.0d0) / (w * w)) * (c0 / (h / c0))
    else if (c0 <= 3.35d-130) then
        tmp = t_0 * (c0 * 0.0d0)
    else if (c0 <= 2.7d+54) then
        tmp = ((d_1 * d_1) / ((d * d) * (w * w))) * ((c0 * c0) / h)
    else if (c0 <= 3.6d+169) then
        tmp = (c0 * (c0 * 0.0d0)) / (2.0d0 * w)
    else
        tmp = t_0 * ((2.0d0 * (c0 * (d_1 * d_1))) / ((w * h) * (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 / (2.0 * w);
	double tmp;
	if (c0 <= -2.55e-96) {
		tmp = (Math.pow((d / D), 2.0) / (w * w)) * (c0 / (h / c0));
	} else if (c0 <= 3.35e-130) {
		tmp = t_0 * (c0 * 0.0);
	} else if (c0 <= 2.7e+54) {
		tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h);
	} else if (c0 <= 3.6e+169) {
		tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
	} else {
		tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D)));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = c0 / (2.0 * w)
	tmp = 0
	if c0 <= -2.55e-96:
		tmp = (math.pow((d / D), 2.0) / (w * w)) * (c0 / (h / c0))
	elif c0 <= 3.35e-130:
		tmp = t_0 * (c0 * 0.0)
	elif c0 <= 2.7e+54:
		tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h)
	elif c0 <= 3.6e+169:
		tmp = (c0 * (c0 * 0.0)) / (2.0 * w)
	else:
		tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D)))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(c0 / Float64(2.0 * w))
	tmp = 0.0
	if (c0 <= -2.55e-96)
		tmp = Float64(Float64((Float64(d / D) ^ 2.0) / Float64(w * w)) * Float64(c0 / Float64(h / c0)));
	elseif (c0 <= 3.35e-130)
		tmp = Float64(t_0 * Float64(c0 * 0.0));
	elseif (c0 <= 2.7e+54)
		tmp = Float64(Float64(Float64(d * d) / Float64(Float64(D * D) * Float64(w * w))) * Float64(Float64(c0 * c0) / h));
	elseif (c0 <= 3.6e+169)
		tmp = Float64(Float64(c0 * Float64(c0 * 0.0)) / Float64(2.0 * w));
	else
		tmp = Float64(t_0 * Float64(Float64(2.0 * Float64(c0 * Float64(d * d))) / Float64(Float64(w * h) * Float64(D * D))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = c0 / (2.0 * w);
	tmp = 0.0;
	if (c0 <= -2.55e-96)
		tmp = (((d / D) ^ 2.0) / (w * w)) * (c0 / (h / c0));
	elseif (c0 <= 3.35e-130)
		tmp = t_0 * (c0 * 0.0);
	elseif (c0 <= 2.7e+54)
		tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h);
	elseif (c0 <= 3.6e+169)
		tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
	else
		tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D)));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -2.55e-96], N[(N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision] * N[(c0 / N[(h / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 3.35e-130], N[(t$95$0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 2.7e+54], N[(N[(N[(d * d), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * c0), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 3.6e+169], N[(N[(c0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(2.0 * N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;c0 \leq -2.55 \cdot 10^{-96}:\\
\;\;\;\;\frac{{\left(\frac{d}{D}\right)}^{2}}{w \cdot w} \cdot \frac{c0}{\frac{h}{c0}}\\

\mathbf{elif}\;c0 \leq 3.35 \cdot 10^{-130}:\\
\;\;\;\;t_0 \cdot \left(c0 \cdot 0\right)\\

\mathbf{elif}\;c0 \leq 2.7 \cdot 10^{+54}:\\
\;\;\;\;\frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot w\right)} \cdot \frac{c0 \cdot c0}{h}\\

\mathbf{elif}\;c0 \leq 3.6 \cdot 10^{+169}:\\
\;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\

\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if c0 < -2.54999999999999986e-96

    1. Initial program 33.5%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot \left(w \cdot w\right)\right) \cdot h}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity36.3%

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

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

      \[\leadsto \color{blue}{1 \cdot \left(\frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot w\right)} \cdot \frac{c0 \cdot c0}{h}\right)} \]
    9. Step-by-step derivation
      1. *-lft-identity36.4%

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

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

        \[\leadsto \frac{d \cdot d}{{D}^{2} \cdot \color{blue}{{w}^{2}}} \cdot \frac{c0 \cdot c0}{h} \]
      4. unpow236.4%

        \[\leadsto \frac{\color{blue}{{d}^{2}}}{{D}^{2} \cdot {w}^{2}} \cdot \frac{c0 \cdot c0}{h} \]
      5. associate-/r*36.5%

        \[\leadsto \color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{{w}^{2}}} \cdot \frac{c0 \cdot c0}{h} \]
      6. unpow236.5%

        \[\leadsto \frac{\frac{\color{blue}{d \cdot d}}{{D}^{2}}}{{w}^{2}} \cdot \frac{c0 \cdot c0}{h} \]
      7. unpow236.5%

        \[\leadsto \frac{\frac{d \cdot d}{\color{blue}{D \cdot D}}}{{w}^{2}} \cdot \frac{c0 \cdot c0}{h} \]
      8. times-frac52.9%

        \[\leadsto \frac{\color{blue}{\frac{d}{D} \cdot \frac{d}{D}}}{{w}^{2}} \cdot \frac{c0 \cdot c0}{h} \]
      9. unpow252.9%

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

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

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

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

    if -2.54999999999999986e-96 < c0 < 3.34999999999999993e-130

    1. Initial program 15.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.34999999999999993e-130 < c0 < 2.70000000000000011e54

    1. Initial program 34.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.70000000000000011e54 < c0 < 3.6000000000000001e169

    1. Initial program 20.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.6000000000000001e169 < c0

    1. Initial program 40.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -2.55 \cdot 10^{-96}:\\ \;\;\;\;\frac{{\left(\frac{d}{D}\right)}^{2}}{w \cdot w} \cdot \frac{c0}{\frac{h}{c0}}\\ \mathbf{elif}\;c0 \leq 3.35 \cdot 10^{-130}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(c0 \cdot 0\right)\\ \mathbf{elif}\;c0 \leq 2.7 \cdot 10^{+54}:\\ \;\;\;\;\frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot w\right)} \cdot \frac{c0 \cdot c0}{h}\\ \mathbf{elif}\;c0 \leq 3.6 \cdot 10^{+169}:\\ \;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \end{array} \]

Alternative 4: 37.1% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ \mathbf{if}\;c0 \leq -1.05 \cdot 10^{-102}:\\ \;\;\;\;{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\ \mathbf{elif}\;c0 \leq 3.2 \cdot 10^{-133}:\\ \;\;\;\;t_0 \cdot \left(c0 \cdot 0\right)\\ \mathbf{elif}\;c0 \leq 6.6 \cdot 10^{+54}:\\ \;\;\;\;\frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot w\right)} \cdot \frac{c0 \cdot c0}{h}\\ \mathbf{elif}\;c0 \leq 2.2 \cdot 10^{+169}:\\ \;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ c0 (* 2.0 w))))
   (if (<= c0 -1.05e-102)
     (* (pow (/ d D) 2.0) (/ (* c0 c0) (* h (* w w))))
     (if (<= c0 3.2e-133)
       (* t_0 (* c0 0.0))
       (if (<= c0 6.6e+54)
         (* (/ (* d d) (* (* D D) (* w w))) (/ (* c0 c0) h))
         (if (<= c0 2.2e+169)
           (/ (* c0 (* c0 0.0)) (* 2.0 w))
           (* t_0 (/ (* 2.0 (* c0 (* d d))) (* (* w h) (* D D))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (2.0 * w);
	double tmp;
	if (c0 <= -1.05e-102) {
		tmp = pow((d / D), 2.0) * ((c0 * c0) / (h * (w * w)));
	} else if (c0 <= 3.2e-133) {
		tmp = t_0 * (c0 * 0.0);
	} else if (c0 <= 6.6e+54) {
		tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h);
	} else if (c0 <= 2.2e+169) {
		tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
	} else {
		tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (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) :: tmp
    t_0 = c0 / (2.0d0 * w)
    if (c0 <= (-1.05d-102)) then
        tmp = ((d_1 / d) ** 2.0d0) * ((c0 * c0) / (h * (w * w)))
    else if (c0 <= 3.2d-133) then
        tmp = t_0 * (c0 * 0.0d0)
    else if (c0 <= 6.6d+54) then
        tmp = ((d_1 * d_1) / ((d * d) * (w * w))) * ((c0 * c0) / h)
    else if (c0 <= 2.2d+169) then
        tmp = (c0 * (c0 * 0.0d0)) / (2.0d0 * w)
    else
        tmp = t_0 * ((2.0d0 * (c0 * (d_1 * d_1))) / ((w * h) * (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 / (2.0 * w);
	double tmp;
	if (c0 <= -1.05e-102) {
		tmp = Math.pow((d / D), 2.0) * ((c0 * c0) / (h * (w * w)));
	} else if (c0 <= 3.2e-133) {
		tmp = t_0 * (c0 * 0.0);
	} else if (c0 <= 6.6e+54) {
		tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h);
	} else if (c0 <= 2.2e+169) {
		tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
	} else {
		tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D)));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = c0 / (2.0 * w)
	tmp = 0
	if c0 <= -1.05e-102:
		tmp = math.pow((d / D), 2.0) * ((c0 * c0) / (h * (w * w)))
	elif c0 <= 3.2e-133:
		tmp = t_0 * (c0 * 0.0)
	elif c0 <= 6.6e+54:
		tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h)
	elif c0 <= 2.2e+169:
		tmp = (c0 * (c0 * 0.0)) / (2.0 * w)
	else:
		tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D)))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(c0 / Float64(2.0 * w))
	tmp = 0.0
	if (c0 <= -1.05e-102)
		tmp = Float64((Float64(d / D) ^ 2.0) * Float64(Float64(c0 * c0) / Float64(h * Float64(w * w))));
	elseif (c0 <= 3.2e-133)
		tmp = Float64(t_0 * Float64(c0 * 0.0));
	elseif (c0 <= 6.6e+54)
		tmp = Float64(Float64(Float64(d * d) / Float64(Float64(D * D) * Float64(w * w))) * Float64(Float64(c0 * c0) / h));
	elseif (c0 <= 2.2e+169)
		tmp = Float64(Float64(c0 * Float64(c0 * 0.0)) / Float64(2.0 * w));
	else
		tmp = Float64(t_0 * Float64(Float64(2.0 * Float64(c0 * Float64(d * d))) / Float64(Float64(w * h) * Float64(D * D))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = c0 / (2.0 * w);
	tmp = 0.0;
	if (c0 <= -1.05e-102)
		tmp = ((d / D) ^ 2.0) * ((c0 * c0) / (h * (w * w)));
	elseif (c0 <= 3.2e-133)
		tmp = t_0 * (c0 * 0.0);
	elseif (c0 <= 6.6e+54)
		tmp = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h);
	elseif (c0 <= 2.2e+169)
		tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
	else
		tmp = t_0 * ((2.0 * (c0 * (d * d))) / ((w * h) * (D * D)));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -1.05e-102], N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(c0 * c0), $MachinePrecision] / N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 3.2e-133], N[(t$95$0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 6.6e+54], N[(N[(N[(d * d), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * c0), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 2.2e+169], N[(N[(c0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(2.0 * N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;c0 \leq -1.05 \cdot 10^{-102}:\\
\;\;\;\;{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\

\mathbf{elif}\;c0 \leq 3.2 \cdot 10^{-133}:\\
\;\;\;\;t_0 \cdot \left(c0 \cdot 0\right)\\

\mathbf{elif}\;c0 \leq 6.6 \cdot 10^{+54}:\\
\;\;\;\;\frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot w\right)} \cdot \frac{c0 \cdot c0}{h}\\

\mathbf{elif}\;c0 \leq 2.2 \cdot 10^{+169}:\\
\;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\

\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if c0 < -1.05e-102

    1. Initial program 33.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}} \]
      2. unpow237.6%

        \[\leadsto \frac{\color{blue}{d \cdot d}}{{D}^{2}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]
      3. unpow237.6%

        \[\leadsto \frac{d \cdot d}{\color{blue}{D \cdot D}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]
      4. times-frac52.9%

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

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

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

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

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

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

    if -1.05e-102 < c0 < 3.20000000000000013e-133

    1. Initial program 15.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.20000000000000013e-133 < c0 < 6.6e54

    1. Initial program 34.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.6e54 < c0 < 2.2e169

    1. Initial program 20.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.2e169 < c0

    1. Initial program 40.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -1.05 \cdot 10^{-102}:\\ \;\;\;\;{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\ \mathbf{elif}\;c0 \leq 3.2 \cdot 10^{-133}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(c0 \cdot 0\right)\\ \mathbf{elif}\;c0 \leq 6.6 \cdot 10^{+54}:\\ \;\;\;\;\frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot w\right)} \cdot \frac{c0 \cdot c0}{h}\\ \mathbf{elif}\;c0 \leq 2.2 \cdot 10^{+169}:\\ \;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \end{array} \]

Alternative 5: 33.4% accurate, 6.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot w\right)} \cdot \frac{c0 \cdot c0}{h}\\ \mathbf{if}\;c0 \leq -6.8 \cdot 10^{+22}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c0 \leq 4.2 \cdot 10^{-130}:\\ \;\;\;\;\frac{-0.5 \cdot \left(0 \cdot \left(c0 \cdot c0\right)\right)}{w}\\ \mathbf{elif}\;c0 \leq 7.2 \cdot 10^{+54} \lor \neg \left(c0 \leq 2.8 \cdot 10^{+191}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (* (/ (* d d) (* (* D D) (* w w))) (/ (* c0 c0) h))))
   (if (<= c0 -6.8e+22)
     t_0
     (if (<= c0 4.2e-130)
       (/ (* -0.5 (* 0.0 (* c0 c0))) w)
       (if (or (<= c0 7.2e+54) (not (<= c0 2.8e+191)))
         t_0
         (/ (* c0 (* c0 0.0)) (* 2.0 w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h);
	double tmp;
	if (c0 <= -6.8e+22) {
		tmp = t_0;
	} else if (c0 <= 4.2e-130) {
		tmp = (-0.5 * (0.0 * (c0 * c0))) / w;
	} else if ((c0 <= 7.2e+54) || !(c0 <= 2.8e+191)) {
		tmp = t_0;
	} else {
		tmp = (c0 * (c0 * 0.0)) / (2.0 * 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) :: t_0
    real(8) :: tmp
    t_0 = ((d_1 * d_1) / ((d * d) * (w * w))) * ((c0 * c0) / h)
    if (c0 <= (-6.8d+22)) then
        tmp = t_0
    else if (c0 <= 4.2d-130) then
        tmp = ((-0.5d0) * (0.0d0 * (c0 * c0))) / w
    else if ((c0 <= 7.2d+54) .or. (.not. (c0 <= 2.8d+191))) then
        tmp = t_0
    else
        tmp = (c0 * (c0 * 0.0d0)) / (2.0d0 * w)
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h);
	double tmp;
	if (c0 <= -6.8e+22) {
		tmp = t_0;
	} else if (c0 <= 4.2e-130) {
		tmp = (-0.5 * (0.0 * (c0 * c0))) / w;
	} else if ((c0 <= 7.2e+54) || !(c0 <= 2.8e+191)) {
		tmp = t_0;
	} else {
		tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h)
	tmp = 0
	if c0 <= -6.8e+22:
		tmp = t_0
	elif c0 <= 4.2e-130:
		tmp = (-0.5 * (0.0 * (c0 * c0))) / w
	elif (c0 <= 7.2e+54) or not (c0 <= 2.8e+191):
		tmp = t_0
	else:
		tmp = (c0 * (c0 * 0.0)) / (2.0 * w)
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(Float64(d * d) / Float64(Float64(D * D) * Float64(w * w))) * Float64(Float64(c0 * c0) / h))
	tmp = 0.0
	if (c0 <= -6.8e+22)
		tmp = t_0;
	elseif (c0 <= 4.2e-130)
		tmp = Float64(Float64(-0.5 * Float64(0.0 * Float64(c0 * c0))) / w);
	elseif ((c0 <= 7.2e+54) || !(c0 <= 2.8e+191))
		tmp = t_0;
	else
		tmp = Float64(Float64(c0 * Float64(c0 * 0.0)) / Float64(2.0 * w));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = ((d * d) / ((D * D) * (w * w))) * ((c0 * c0) / h);
	tmp = 0.0;
	if (c0 <= -6.8e+22)
		tmp = t_0;
	elseif (c0 <= 4.2e-130)
		tmp = (-0.5 * (0.0 * (c0 * c0))) / w;
	elseif ((c0 <= 7.2e+54) || ~((c0 <= 2.8e+191)))
		tmp = t_0;
	else
		tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(N[(d * d), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * c0), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -6.8e+22], t$95$0, If[LessEqual[c0, 4.2e-130], N[(N[(-0.5 * N[(0.0 * N[(c0 * c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision], If[Or[LessEqual[c0, 7.2e+54], N[Not[LessEqual[c0, 2.8e+191]], $MachinePrecision]], t$95$0, N[(N[(c0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot w\right)} \cdot \frac{c0 \cdot c0}{h}\\
\mathbf{if}\;c0 \leq -6.8 \cdot 10^{+22}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;c0 \leq 4.2 \cdot 10^{-130}:\\
\;\;\;\;\frac{-0.5 \cdot \left(0 \cdot \left(c0 \cdot c0\right)\right)}{w}\\

\mathbf{elif}\;c0 \leq 7.2 \cdot 10^{+54} \lor \neg \left(c0 \leq 2.8 \cdot 10^{+191}\right):\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c0 < -6.8e22 or 4.20000000000000004e-130 < c0 < 7.2000000000000003e54 or 2.7999999999999999e191 < c0

    1. Initial program 37.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.8e22 < c0 < 4.20000000000000004e-130

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-0.5 \cdot \left(\left(c0 \cdot c0\right) \cdot 0\right)}{w}} \]

    if 7.2000000000000003e54 < c0 < 2.7999999999999999e191

    1. Initial program 21.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. associate-*l*21.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0 \cdot \color{blue}{\left(c0 \cdot 0\right)}}{w \cdot 2} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification44.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -6.8 \cdot 10^{+22}:\\ \;\;\;\;\frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot w\right)} \cdot \frac{c0 \cdot c0}{h}\\ \mathbf{elif}\;c0 \leq 4.2 \cdot 10^{-130}:\\ \;\;\;\;\frac{-0.5 \cdot \left(0 \cdot \left(c0 \cdot c0\right)\right)}{w}\\ \mathbf{elif}\;c0 \leq 7.2 \cdot 10^{+54} \lor \neg \left(c0 \leq 2.8 \cdot 10^{+191}\right):\\ \;\;\;\;\frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot w\right)} \cdot \frac{c0 \cdot c0}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\ \end{array} \]

Alternative 6: 34.1% accurate, 6.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq 9.2 \cdot 10^{-147} \lor \neg \left(d \leq 1.2 \cdot 10^{+243}\right):\\
\;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\

\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 9.19999999999999962e-147 or 1.2e243 < d

    1. Initial program 23.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. associate-*l*22.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.19999999999999962e-147 < d < 1.2e243

    1. Initial program 38.5%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 9.2 \cdot 10^{-147} \lor \neg \left(d \leq 1.2 \cdot 10^{+243}\right):\\ \;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \end{array} \]

Alternative 7: 33.3% accurate, 7.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq 8.2 \cdot 10^{-153} \lor \neg \left(d \leq 1.05 \cdot 10^{+244}\right):\\
\;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{h \cdot \left(D \cdot \left(D \cdot \left(w \cdot w\right)\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 8.2e-153 or 1.05e244 < d

    1. Initial program 24.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.2e-153 < d < 1.05e244

    1. Initial program 38.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq 8.2 \cdot 10^{-153} \lor \neg \left(d \leq 1.05 \cdot 10^{+244}\right):\\ \;\;\;\;\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{h \cdot \left(D \cdot \left(D \cdot \left(w \cdot w\right)\right)\right)}\\ \end{array} \]

Alternative 8: 29.3% accurate, 16.8× speedup?

\[\begin{array}{l} \\ \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot 0\right) \end{array} \]
(FPCore (c0 w h D d M) :precision binary64 (* (/ c0 (* 2.0 w)) (* c0 0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
	return (c0 / (2.0 * w)) * (c0 * 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 = (c0 / (2.0d0 * w)) * (c0 * 0.0d0)
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	return (c0 / (2.0 * w)) * (c0 * 0.0);
}
def code(c0, w, h, D, d, M):
	return (c0 / (2.0 * w)) * (c0 * 0.0)
function code(c0, w, h, D, d, M)
	return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(c0 * 0.0))
end
function tmp = code(c0, w, h, D, d, M)
	tmp = (c0 / (2.0 * w)) * (c0 * 0.0);
end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{c0}{2 \cdot w} \cdot \left(c0 \cdot 0\right)
\end{array}
Derivation
  1. Initial program 28.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot 0\right) \]

Alternative 9: 33.6% accurate, 16.8× speedup?

\[\begin{array}{l} \\ \frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w} \end{array} \]
(FPCore (c0 w h D d M) :precision binary64 (/ (* c0 (* c0 0.0)) (* 2.0 w)))
double code(double c0, double w, double h, double D, double d, double M) {
	return (c0 * (c0 * 0.0)) / (2.0 * w);
}
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 = (c0 * (c0 * 0.0d0)) / (2.0d0 * w)
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	return (c0 * (c0 * 0.0)) / (2.0 * w);
}
def code(c0, w, h, D, d, M):
	return (c0 * (c0 * 0.0)) / (2.0 * w)
function code(c0, w, h, D, d, M)
	return Float64(Float64(c0 * Float64(c0 * 0.0)) / Float64(2.0 * w))
end
function tmp = code(c0, w, h, D, d, M)
	tmp = (c0 * (c0 * 0.0)) / (2.0 * w);
end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 * N[(c0 * 0.0), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w}
\end{array}
Derivation
  1. Initial program 28.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{c0 \cdot \color{blue}{\left(c0 \cdot 0\right)}}{w \cdot 2} \]
  8. Final simplification32.5%

    \[\leadsto \frac{c0 \cdot \left(c0 \cdot 0\right)}{2 \cdot w} \]

Reproduce

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