Henrywood and Agarwal, Equation (13)

Percentage Accurate: 25.8% → 55.2%
Time: 31.3s
Alternatives: 9
Speedup: 30.2×

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: 25.8% accurate, 1.0× speedup?

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

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

Alternative 1: 55.2% accurate, 0.6× speedup?

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

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{0}{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 77.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-frac69.1%

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d}{D} \cdot \frac{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. Simplified65.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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)} \]
    9. Step-by-step derivation
      1. associate-/r*74.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    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-squares7.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*7.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*7.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. Simplified7.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 0.0%

      \[\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. *-commutative0.0%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{{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)}}{w} \]
      2. unpow20.0%

        \[\leadsto -0.5 \cdot \frac{\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)}{w} \]
      3. distribute-rgt1-in0.0%

        \[\leadsto -0.5 \cdot \frac{\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)}}{w} \]
      4. metadata-eval0.0%

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{w} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification56.5%

    \[\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{\left(c0 \cdot 2\right) \cdot \frac{\frac{d \cdot \left(c0 \cdot d\right)}{w} \cdot {D}^{-2}}{h}}{2 \cdot w}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{0}{w}\\ \end{array} \]

Alternative 2: 46.0% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;w \leq -3.3 \cdot 10^{+81} \lor \neg \left(w \leq 1.32 \cdot 10^{+65}\right):\\
\;\;\;\;-0.5 \cdot \frac{0}{w}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < -3.3e81 or 1.31999999999999995e65 < w

    1. Initial program 11.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*6.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-squares8.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*8.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*10.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)}{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. Simplified10.0%

      \[\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 8.1%

      \[\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. *-commutative8.1%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{{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)}}{w} \]
      2. unpow28.1%

        \[\leadsto -0.5 \cdot \frac{\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)}{w} \]
      3. distribute-rgt1-in8.1%

        \[\leadsto -0.5 \cdot \frac{\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)}}{w} \]
      4. metadata-eval8.1%

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{w} \]

    if -3.3e81 < w < 1.31999999999999995e65

    1. Initial program 36.8%

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

        \[\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*33.2%

        \[\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-squares38.6%

        \[\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. Simplified41.9%

      \[\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 40.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -3.3 \cdot 10^{+81} \lor \neg \left(w \leq 1.32 \cdot 10^{+65}\right):\\ \;\;\;\;-0.5 \cdot \frac{0}{w}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0 \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)}{2 \cdot w}\\ \end{array} \]

Alternative 3: 43.9% accurate, 5.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq -1.5 \cdot 10^{+81} \lor \neg \left(w \leq 2.65 \cdot 10^{-132} \lor \neg \left(w \leq 1.55 \cdot 10^{-34}\right) \land w \leq 3.1 \cdot 10^{+66}\right):\\ \;\;\;\;-0.5 \cdot \frac{0}{w}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w \cdot h}\right)\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (if (or (<= w -1.5e+81)
         (not
          (or (<= w 2.65e-132) (and (not (<= w 1.55e-34)) (<= w 3.1e+66)))))
   (* -0.5 (/ 0.0 w))
   (* (/ c0 (* 2.0 w)) (* 2.0 (* (* (/ d D) (/ d D)) (/ c0 (* w h)))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if ((w <= -1.5e+81) || !((w <= 2.65e-132) || (!(w <= 1.55e-34) && (w <= 3.1e+66)))) {
		tmp = -0.5 * (0.0 / w);
	} else {
		tmp = (c0 / (2.0 * w)) * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))));
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: tmp
    if ((w <= (-1.5d+81)) .or. (.not. (w <= 2.65d-132) .or. (.not. (w <= 1.55d-34)) .and. (w <= 3.1d+66))) then
        tmp = (-0.5d0) * (0.0d0 / w)
    else
        tmp = (c0 / (2.0d0 * w)) * (2.0d0 * (((d_1 / d) * (d_1 / d)) * (c0 / (w * h))))
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if ((w <= -1.5e+81) || !((w <= 2.65e-132) || (!(w <= 1.55e-34) && (w <= 3.1e+66)))) {
		tmp = -0.5 * (0.0 / w);
	} else {
		tmp = (c0 / (2.0 * w)) * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	tmp = 0
	if (w <= -1.5e+81) or not ((w <= 2.65e-132) or (not (w <= 1.55e-34) and (w <= 3.1e+66))):
		tmp = -0.5 * (0.0 / w)
	else:
		tmp = (c0 / (2.0 * w)) * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))))
	return tmp
function code(c0, w, h, D, d, M)
	tmp = 0.0
	if ((w <= -1.5e+81) || !((w <= 2.65e-132) || (!(w <= 1.55e-34) && (w <= 3.1e+66))))
		tmp = Float64(-0.5 * Float64(0.0 / w));
	else
		tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(c0 / Float64(w * h)))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	tmp = 0.0;
	if ((w <= -1.5e+81) || ~(((w <= 2.65e-132) || (~((w <= 1.55e-34)) && (w <= 3.1e+66)))))
		tmp = -0.5 * (0.0 / w);
	else
		tmp = (c0 / (2.0 * w)) * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[w, -1.5e+81], N[Not[Or[LessEqual[w, 2.65e-132], And[N[Not[LessEqual[w, 1.55e-34]], $MachinePrecision], LessEqual[w, 3.1e+66]]]], $MachinePrecision]], N[(-0.5 * N[(0.0 / w), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.5 \cdot 10^{+81} \lor \neg \left(w \leq 2.65 \cdot 10^{-132} \lor \neg \left(w \leq 1.55 \cdot 10^{-34}\right) \land w \leq 3.1 \cdot 10^{+66}\right):\\
\;\;\;\;-0.5 \cdot \frac{0}{w}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < -1.49999999999999999e81 or 2.65000000000000015e-132 < w < 1.5499999999999999e-34 or 3.10000000000000019e66 < w

    1. Initial program 14.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*10.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-squares12.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*12.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*14.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. Simplified14.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. Taylor expanded in c0 around -inf 7.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. *-commutative7.3%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{{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)}}{w} \]
      2. unpow27.3%

        \[\leadsto -0.5 \cdot \frac{\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)}{w} \]
      3. distribute-rgt1-in7.3%

        \[\leadsto -0.5 \cdot \frac{\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)}}{w} \]
      4. metadata-eval7.3%

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{w} \]

    if -1.49999999999999999e81 < w < 2.65000000000000015e-132 or 1.5499999999999999e-34 < w < 3.10000000000000019e66

    1. Initial program 38.4%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      2. fma-def34.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*34.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-squares41.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -1.5 \cdot 10^{+81} \lor \neg \left(w \leq 2.65 \cdot 10^{-132} \lor \neg \left(w \leq 1.55 \cdot 10^{-34}\right) \land w \leq 3.1 \cdot 10^{+66}\right):\\ \;\;\;\;-0.5 \cdot \frac{0}{w}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w \cdot h}\right)\right)\\ \end{array} \]

Alternative 4: 43.7% accurate, 5.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ t_1 := -0.5 \cdot \frac{0}{w}\\ \mathbf{if}\;w \leq -1.55 \cdot 10^{+80}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;w \leq 9.2 \cdot 10^{-138}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w \cdot h}\right)\right)\\ \mathbf{elif}\;w \leq 2.4 \cdot 10^{-28} \lor \neg \left(w \leq 3.7 \cdot 10^{+64}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{w} \cdot \frac{d}{D \cdot \left(h \cdot D\right)}\right)\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ c0 (* 2.0 w))) (t_1 (* -0.5 (/ 0.0 w))))
   (if (<= w -1.55e+80)
     t_1
     (if (<= w 9.2e-138)
       (* t_0 (* 2.0 (* (* (/ d D) (/ d D)) (/ c0 (* w h)))))
       (if (or (<= w 2.4e-28) (not (<= w 3.7e+64)))
         t_1
         (* t_0 (* 2.0 (* (/ (* c0 d) w) (/ d (* D (* h D)))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (2.0 * w);
	double t_1 = -0.5 * (0.0 / w);
	double tmp;
	if (w <= -1.55e+80) {
		tmp = t_1;
	} else if (w <= 9.2e-138) {
		tmp = t_0 * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))));
	} else if ((w <= 2.4e-28) || !(w <= 3.7e+64)) {
		tmp = t_1;
	} else {
		tmp = t_0 * (2.0 * (((c0 * d) / w) * (d / (D * (h * D)))));
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = c0 / (2.0d0 * w)
    t_1 = (-0.5d0) * (0.0d0 / w)
    if (w <= (-1.55d+80)) then
        tmp = t_1
    else if (w <= 9.2d-138) then
        tmp = t_0 * (2.0d0 * (((d_1 / d) * (d_1 / d)) * (c0 / (w * h))))
    else if ((w <= 2.4d-28) .or. (.not. (w <= 3.7d+64))) then
        tmp = t_1
    else
        tmp = t_0 * (2.0d0 * (((c0 * d_1) / w) * (d_1 / (d * (h * 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 t_1 = -0.5 * (0.0 / w);
	double tmp;
	if (w <= -1.55e+80) {
		tmp = t_1;
	} else if (w <= 9.2e-138) {
		tmp = t_0 * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))));
	} else if ((w <= 2.4e-28) || !(w <= 3.7e+64)) {
		tmp = t_1;
	} else {
		tmp = t_0 * (2.0 * (((c0 * d) / w) * (d / (D * (h * D)))));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = c0 / (2.0 * w)
	t_1 = -0.5 * (0.0 / w)
	tmp = 0
	if w <= -1.55e+80:
		tmp = t_1
	elif w <= 9.2e-138:
		tmp = t_0 * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))))
	elif (w <= 2.4e-28) or not (w <= 3.7e+64):
		tmp = t_1
	else:
		tmp = t_0 * (2.0 * (((c0 * d) / w) * (d / (D * (h * D)))))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(c0 / Float64(2.0 * w))
	t_1 = Float64(-0.5 * Float64(0.0 / w))
	tmp = 0.0
	if (w <= -1.55e+80)
		tmp = t_1;
	elseif (w <= 9.2e-138)
		tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(c0 / Float64(w * h)))));
	elseif ((w <= 2.4e-28) || !(w <= 3.7e+64))
		tmp = t_1;
	else
		tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(c0 * d) / w) * Float64(d / Float64(D * Float64(h * D))))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = c0 / (2.0 * w);
	t_1 = -0.5 * (0.0 / w);
	tmp = 0.0;
	if (w <= -1.55e+80)
		tmp = t_1;
	elseif (w <= 9.2e-138)
		tmp = t_0 * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))));
	elseif ((w <= 2.4e-28) || ~((w <= 3.7e+64)))
		tmp = t_1;
	else
		tmp = t_0 * (2.0 * (((c0 * d) / w) * (d / (D * (h * 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]}, Block[{t$95$1 = N[(-0.5 * N[(0.0 / w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -1.55e+80], t$95$1, If[LessEqual[w, 9.2e-138], N[(t$95$0 * N[(2.0 * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[w, 2.4e-28], N[Not[LessEqual[w, 3.7e+64]], $MachinePrecision]], t$95$1, N[(t$95$0 * N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] / w), $MachinePrecision] * N[(d / N[(D * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := -0.5 \cdot \frac{0}{w}\\
\mathbf{if}\;w \leq -1.55 \cdot 10^{+80}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;w \leq 9.2 \cdot 10^{-138}:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w \cdot h}\right)\right)\\

\mathbf{elif}\;w \leq 2.4 \cdot 10^{-28} \lor \neg \left(w \leq 3.7 \cdot 10^{+64}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if w < -1.54999999999999994e80 or 9.1999999999999996e-138 < w < 2.4000000000000002e-28 or 3.69999999999999983e64 < w

    1. Initial program 14.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*10.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-squares12.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*12.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*14.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. Simplified14.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. Taylor expanded in c0 around -inf 7.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. *-commutative7.3%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{{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)}}{w} \]
      2. unpow27.3%

        \[\leadsto -0.5 \cdot \frac{\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)}{w} \]
      3. distribute-rgt1-in7.3%

        \[\leadsto -0.5 \cdot \frac{\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)}}{w} \]
      4. metadata-eval7.3%

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{w} \]

    if -1.54999999999999994e80 < w < 9.1999999999999996e-138

    1. Initial program 37.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-frac34.3%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      2. fma-def33.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*33.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-squares40.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. Simplified43.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 42.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.4000000000000002e-28 < w < 3.69999999999999983e64

    1. Initial program 47.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. times-frac43.1%

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{D}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. difference-of-squares43.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. Simplified47.9%

      \[\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.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -1.55 \cdot 10^{+80}:\\ \;\;\;\;-0.5 \cdot \frac{0}{w}\\ \mathbf{elif}\;w \leq 9.2 \cdot 10^{-138}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w \cdot h}\right)\right)\\ \mathbf{elif}\;w \leq 2.4 \cdot 10^{-28} \lor \neg \left(w \leq 3.7 \cdot 10^{+64}\right):\\ \;\;\;\;-0.5 \cdot \frac{0}{w}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{w} \cdot \frac{d}{D \cdot \left(h \cdot D\right)}\right)\right)\\ \end{array} \]

Alternative 5: 43.7% accurate, 5.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ t_1 := -0.5 \cdot \frac{0}{w}\\ \mathbf{if}\;w \leq -1.8 \cdot 10^{+81}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;w \leq 1.05 \cdot 10^{-134}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w \cdot h}\right)\right)\\ \mathbf{elif}\;w \leq 5.4 \cdot 10^{-37} \lor \neg \left(w \leq 1.5 \cdot 10^{+66}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \frac{d \cdot \left(c0 \cdot d\right)}{w \cdot \left(D \cdot \left(h \cdot D\right)\right)}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ c0 (* 2.0 w))) (t_1 (* -0.5 (/ 0.0 w))))
   (if (<= w -1.8e+81)
     t_1
     (if (<= w 1.05e-134)
       (* t_0 (* 2.0 (* (* (/ d D) (/ d D)) (/ c0 (* w h)))))
       (if (or (<= w 5.4e-37) (not (<= w 1.5e+66)))
         t_1
         (* t_0 (* 2.0 (/ (* d (* c0 d)) (* w (* D (* h D)))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (2.0 * w);
	double t_1 = -0.5 * (0.0 / w);
	double tmp;
	if (w <= -1.8e+81) {
		tmp = t_1;
	} else if (w <= 1.05e-134) {
		tmp = t_0 * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))));
	} else if ((w <= 5.4e-37) || !(w <= 1.5e+66)) {
		tmp = t_1;
	} else {
		tmp = t_0 * (2.0 * ((d * (c0 * d)) / (w * (D * (h * D)))));
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = c0 / (2.0d0 * w)
    t_1 = (-0.5d0) * (0.0d0 / w)
    if (w <= (-1.8d+81)) then
        tmp = t_1
    else if (w <= 1.05d-134) then
        tmp = t_0 * (2.0d0 * (((d_1 / d) * (d_1 / d)) * (c0 / (w * h))))
    else if ((w <= 5.4d-37) .or. (.not. (w <= 1.5d+66))) then
        tmp = t_1
    else
        tmp = t_0 * (2.0d0 * ((d_1 * (c0 * d_1)) / (w * (d * (h * 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 t_1 = -0.5 * (0.0 / w);
	double tmp;
	if (w <= -1.8e+81) {
		tmp = t_1;
	} else if (w <= 1.05e-134) {
		tmp = t_0 * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))));
	} else if ((w <= 5.4e-37) || !(w <= 1.5e+66)) {
		tmp = t_1;
	} else {
		tmp = t_0 * (2.0 * ((d * (c0 * d)) / (w * (D * (h * D)))));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = c0 / (2.0 * w)
	t_1 = -0.5 * (0.0 / w)
	tmp = 0
	if w <= -1.8e+81:
		tmp = t_1
	elif w <= 1.05e-134:
		tmp = t_0 * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))))
	elif (w <= 5.4e-37) or not (w <= 1.5e+66):
		tmp = t_1
	else:
		tmp = t_0 * (2.0 * ((d * (c0 * d)) / (w * (D * (h * D)))))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(c0 / Float64(2.0 * w))
	t_1 = Float64(-0.5 * Float64(0.0 / w))
	tmp = 0.0
	if (w <= -1.8e+81)
		tmp = t_1;
	elseif (w <= 1.05e-134)
		tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(c0 / Float64(w * h)))));
	elseif ((w <= 5.4e-37) || !(w <= 1.5e+66))
		tmp = t_1;
	else
		tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(d * Float64(c0 * d)) / Float64(w * Float64(D * Float64(h * D))))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = c0 / (2.0 * w);
	t_1 = -0.5 * (0.0 / w);
	tmp = 0.0;
	if (w <= -1.8e+81)
		tmp = t_1;
	elseif (w <= 1.05e-134)
		tmp = t_0 * (2.0 * (((d / D) * (d / D)) * (c0 / (w * h))));
	elseif ((w <= 5.4e-37) || ~((w <= 1.5e+66)))
		tmp = t_1;
	else
		tmp = t_0 * (2.0 * ((d * (c0 * d)) / (w * (D * (h * 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]}, Block[{t$95$1 = N[(-0.5 * N[(0.0 / w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -1.8e+81], t$95$1, If[LessEqual[w, 1.05e-134], N[(t$95$0 * N[(2.0 * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[w, 5.4e-37], N[Not[LessEqual[w, 1.5e+66]], $MachinePrecision]], t$95$1, N[(t$95$0 * N[(2.0 * N[(N[(d * N[(c0 * d), $MachinePrecision]), $MachinePrecision] / N[(w * N[(D * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := -0.5 \cdot \frac{0}{w}\\
\mathbf{if}\;w \leq -1.8 \cdot 10^{+81}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;w \leq 1.05 \cdot 10^{-134}:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w \cdot h}\right)\right)\\

\mathbf{elif}\;w \leq 5.4 \cdot 10^{-37} \lor \neg \left(w \leq 1.5 \cdot 10^{+66}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if w < -1.80000000000000003e81 or 1.05e-134 < w < 5.40000000000000032e-37 or 1.50000000000000001e66 < w

    1. Initial program 14.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*10.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-squares12.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*12.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*14.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. Simplified14.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. Taylor expanded in c0 around -inf 7.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. *-commutative7.3%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{{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)}}{w} \]
      2. unpow27.3%

        \[\leadsto -0.5 \cdot \frac{\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)}{w} \]
      3. distribute-rgt1-in7.3%

        \[\leadsto -0.5 \cdot \frac{\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)}}{w} \]
      4. metadata-eval7.3%

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{w} \]

    if -1.80000000000000003e81 < w < 1.05e-134

    1. Initial program 37.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-frac34.3%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      2. fma-def33.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*33.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-squares40.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. Simplified43.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 42.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.40000000000000032e-37 < w < 1.50000000000000001e66

    1. Initial program 47.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. times-frac43.1%

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{D}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. difference-of-squares43.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. Simplified47.9%

      \[\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.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -1.8 \cdot 10^{+81}:\\ \;\;\;\;-0.5 \cdot \frac{0}{w}\\ \mathbf{elif}\;w \leq 1.05 \cdot 10^{-134}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w \cdot h}\right)\right)\\ \mathbf{elif}\;w \leq 5.4 \cdot 10^{-37} \lor \neg \left(w \leq 1.5 \cdot 10^{+66}\right):\\ \;\;\;\;-0.5 \cdot \frac{0}{w}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{d \cdot \left(c0 \cdot d\right)}{w \cdot \left(D \cdot \left(h \cdot D\right)\right)}\right)\\ \end{array} \]

Alternative 6: 44.5% accurate, 5.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ t_1 := -0.5 \cdot \frac{0}{w}\\ \mathbf{if}\;w \leq -5.2 \cdot 10^{+74}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;w \leq 5 \cdot 10^{-266}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \frac{\frac{d}{\frac{D}{d}} \cdot \frac{c0}{D}}{w \cdot h}\right)\\ \mathbf{elif}\;w \leq 2.8 \cdot 10^{+63}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{w} \cdot \frac{d}{D \cdot \left(h \cdot D\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ c0 (* 2.0 w))) (t_1 (* -0.5 (/ 0.0 w))))
   (if (<= w -5.2e+74)
     t_1
     (if (<= w 5e-266)
       (* t_0 (* 2.0 (/ (* (/ d (/ D d)) (/ c0 D)) (* w h))))
       (if (<= w 2.8e+63)
         (* t_0 (* 2.0 (* (/ (* c0 d) w) (/ d (* D (* h D))))))
         t_1)))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (2.0 * w);
	double t_1 = -0.5 * (0.0 / w);
	double tmp;
	if (w <= -5.2e+74) {
		tmp = t_1;
	} else if (w <= 5e-266) {
		tmp = t_0 * (2.0 * (((d / (D / d)) * (c0 / D)) / (w * h)));
	} else if (w <= 2.8e+63) {
		tmp = t_0 * (2.0 * (((c0 * d) / w) * (d / (D * (h * D)))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = c0 / (2.0d0 * w)
    t_1 = (-0.5d0) * (0.0d0 / w)
    if (w <= (-5.2d+74)) then
        tmp = t_1
    else if (w <= 5d-266) then
        tmp = t_0 * (2.0d0 * (((d_1 / (d / d_1)) * (c0 / d)) / (w * h)))
    else if (w <= 2.8d+63) then
        tmp = t_0 * (2.0d0 * (((c0 * d_1) / w) * (d_1 / (d * (h * d)))))
    else
        tmp = t_1
    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 t_1 = -0.5 * (0.0 / w);
	double tmp;
	if (w <= -5.2e+74) {
		tmp = t_1;
	} else if (w <= 5e-266) {
		tmp = t_0 * (2.0 * (((d / (D / d)) * (c0 / D)) / (w * h)));
	} else if (w <= 2.8e+63) {
		tmp = t_0 * (2.0 * (((c0 * d) / w) * (d / (D * (h * D)))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = c0 / (2.0 * w)
	t_1 = -0.5 * (0.0 / w)
	tmp = 0
	if w <= -5.2e+74:
		tmp = t_1
	elif w <= 5e-266:
		tmp = t_0 * (2.0 * (((d / (D / d)) * (c0 / D)) / (w * h)))
	elif w <= 2.8e+63:
		tmp = t_0 * (2.0 * (((c0 * d) / w) * (d / (D * (h * D)))))
	else:
		tmp = t_1
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(c0 / Float64(2.0 * w))
	t_1 = Float64(-0.5 * Float64(0.0 / w))
	tmp = 0.0
	if (w <= -5.2e+74)
		tmp = t_1;
	elseif (w <= 5e-266)
		tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(d / Float64(D / d)) * Float64(c0 / D)) / Float64(w * h))));
	elseif (w <= 2.8e+63)
		tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(c0 * d) / w) * Float64(d / Float64(D * Float64(h * D))))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = c0 / (2.0 * w);
	t_1 = -0.5 * (0.0 / w);
	tmp = 0.0;
	if (w <= -5.2e+74)
		tmp = t_1;
	elseif (w <= 5e-266)
		tmp = t_0 * (2.0 * (((d / (D / d)) * (c0 / D)) / (w * h)));
	elseif (w <= 2.8e+63)
		tmp = t_0 * (2.0 * (((c0 * d) / w) * (d / (D * (h * D)))));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.5 * N[(0.0 / w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -5.2e+74], t$95$1, If[LessEqual[w, 5e-266], N[(t$95$0 * N[(2.0 * N[(N[(N[(d / N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(c0 / D), $MachinePrecision]), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, 2.8e+63], N[(t$95$0 * N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] / w), $MachinePrecision] * N[(d / N[(D * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0}{2 \cdot w}\\
t_1 := -0.5 \cdot \frac{0}{w}\\
\mathbf{if}\;w \leq -5.2 \cdot 10^{+74}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;w \leq 5 \cdot 10^{-266}:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \frac{\frac{d}{\frac{D}{d}} \cdot \frac{c0}{D}}{w \cdot h}\right)\\

\mathbf{elif}\;w \leq 2.8 \cdot 10^{+63}:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{w} \cdot \frac{d}{D \cdot \left(h \cdot D\right)}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if w < -5.2000000000000001e74 or 2.79999999999999987e63 < w

    1. Initial program 11.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*6.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-squares8.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*8.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*10.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)}{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. Simplified10.0%

      \[\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 8.1%

      \[\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. *-commutative8.1%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{{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)}}{w} \]
      2. unpow28.1%

        \[\leadsto -0.5 \cdot \frac{\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)}{w} \]
      3. distribute-rgt1-in8.1%

        \[\leadsto -0.5 \cdot \frac{\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)}}{w} \]
      4. metadata-eval8.1%

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{w} \]

    if -5.2000000000000001e74 < w < 4.99999999999999992e-266

    1. Initial program 38.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-frac35.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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)} \]
    9. Step-by-step derivation
      1. associate-/r*48.3%

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

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

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

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

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

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

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

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

    if 4.99999999999999992e-266 < w < 2.79999999999999987e63

    1. Initial program 34.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. times-frac31.1%

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

        \[\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*31.2%

        \[\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-squares35.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -5.2 \cdot 10^{+74}:\\ \;\;\;\;-0.5 \cdot \frac{0}{w}\\ \mathbf{elif}\;w \leq 5 \cdot 10^{-266}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\frac{d}{\frac{D}{d}} \cdot \frac{c0}{D}}{w \cdot h}\right)\\ \mathbf{elif}\;w \leq 2.8 \cdot 10^{+63}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{w} \cdot \frac{d}{D \cdot \left(h \cdot D\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{0}{w}\\ \end{array} \]

Alternative 7: 46.1% accurate, 6.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;w \leq -7.2 \cdot 10^{+78} \lor \neg \left(w \leq 2.3 \cdot 10^{+62}\right):\\
\;\;\;\;-0.5 \cdot \frac{0}{w}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < -7.20000000000000039e78 or 2.29999999999999984e62 < w

    1. Initial program 11.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*6.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-squares8.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*8.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*10.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)}{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. Simplified10.0%

      \[\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 8.1%

      \[\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. *-commutative8.1%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{{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)}}{w} \]
      2. unpow28.1%

        \[\leadsto -0.5 \cdot \frac{\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)}{w} \]
      3. distribute-rgt1-in8.1%

        \[\leadsto -0.5 \cdot \frac{\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)}}{w} \]
      4. metadata-eval8.1%

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{w} \]

    if -7.20000000000000039e78 < w < 2.29999999999999984e62

    1. Initial program 36.8%

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

        \[\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*33.2%

        \[\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-squares38.6%

        \[\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. Simplified41.9%

      \[\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 40.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -7.2 \cdot 10^{+78} \lor \neg \left(w \leq 2.3 \cdot 10^{+62}\right):\\ \;\;\;\;-0.5 \cdot \frac{0}{w}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \left(2 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\ \end{array} \]

Alternative 8: 40.4% accurate, 7.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c0 \leq -1.26 \cdot 10^{-8} \lor \neg \left(c0 \leq 2.35 \cdot 10^{-153}\right):\\
\;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c0 < -1.26e-8 or 2.35e-153 < c0

    1. Initial program 31.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. times-frac30.2%

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

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

        \[\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-squares34.3%

        \[\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. Simplified38.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.26e-8 < c0 < 2.35e-153

    1. Initial program 25.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*23.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-squares26.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*26.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.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. Simplified26.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. Taylor expanded in c0 around -inf 8.7%

      \[\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. *-commutative8.7%

        \[\leadsto -0.5 \cdot \frac{\color{blue}{{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)}}{w} \]
      2. unpow28.7%

        \[\leadsto -0.5 \cdot \frac{\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)}{w} \]
      3. distribute-rgt1-in8.7%

        \[\leadsto -0.5 \cdot \frac{\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)}}{w} \]
      4. metadata-eval8.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -1.26 \cdot 10^{-8} \lor \neg \left(c0 \leq 2.35 \cdot 10^{-153}\right):\\ \;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{0 \cdot \left(c0 \cdot c0\right)}{w}\\ \end{array} \]

Alternative 9: 33.5% accurate, 30.2× speedup?

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

\\
-0.5 \cdot \frac{0}{w}
\end{array}
Derivation
  1. Initial program 29.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*27.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-squares32.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*32.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*33.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)}{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. Simplified33.0%

    \[\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 5.9%

    \[\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. *-commutative5.9%

      \[\leadsto -0.5 \cdot \frac{\color{blue}{{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)}}{w} \]
    2. unpow25.9%

      \[\leadsto -0.5 \cdot \frac{\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)}{w} \]
    3. distribute-rgt1-in5.9%

      \[\leadsto -0.5 \cdot \frac{\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)}}{w} \]
    4. metadata-eval5.9%

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

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

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

    \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{w} \]
  8. Final simplification34.5%

    \[\leadsto -0.5 \cdot \frac{0}{w} \]

Reproduce

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