Henrywood and Agarwal, Equation (13)

Percentage Accurate: 25.5% → 55.8%
Time: 35.5s
Alternatives: 8
Speedup: 151.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 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.5% accurate, 1.0× speedup?

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

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

Alternative 1: 55.8% accurate, 0.2× speedup?

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

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

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

\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_0 \cdot \left(2 \cdot \frac{c0}{h \cdot \left(w \cdot {\left(\frac{d}{D}\right)}^{-2}\right)}\right)\\

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


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

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0000000000000002e-142 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < 0.0

    1. Initial program 44.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. Simplified17.3%

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \left(\left(-c0\right) \cdot \color{blue}{0} + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      6. distribute-lft-neg-in75.4%

        \[\leadsto \frac{\frac{c0}{w}}{2} \cdot \left(\color{blue}{\left(-c0 \cdot 0\right)} + 0.5 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}}\right) \]
      7. distribute-rgt-neg-in75.4%

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

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

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

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

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

    1. Initial program 79.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-c0\right) \cdot \color{blue}{0}\right) \]
      6. distribute-lft-neg-in35.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-c0 \cdot 0\right)} \]
      7. distribute-rgt-neg-in35.7%

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

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

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

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

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

Alternative 2: 55.4% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 76.4%

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-c0\right) \cdot \color{blue}{0}\right) \]
      6. distribute-lft-neg-in35.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-c0 \cdot 0\right)} \]
      7. distribute-rgt-neg-in35.7%

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

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

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

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

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

Alternative 3: 38.6% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 7.2 \cdot 10^{-247}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.25 \cdot 10^{-160} \lor \neg \left(M \leq 5000000000\right):\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{c0}{h \cdot \left(w \cdot {\left(\frac{d}{D}\right)}^{-2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (if (<= M 7.2e-247)
   0.0
   (if (or (<= M 2.25e-160) (not (<= M 5000000000.0)))
     (* (/ c0 (* 2.0 w)) (* 2.0 (/ c0 (* h (* w (pow (/ d D) -2.0))))))
     0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if (M <= 7.2e-247) {
		tmp = 0.0;
	} else if ((M <= 2.25e-160) || !(M <= 5000000000.0)) {
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 / (h * (w * pow((d / D), -2.0)))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: tmp
    if (m <= 7.2d-247) then
        tmp = 0.0d0
    else if ((m <= 2.25d-160) .or. (.not. (m <= 5000000000.0d0))) then
        tmp = (c0 / (2.0d0 * w)) * (2.0d0 * (c0 / (h * (w * ((d_1 / d) ** (-2.0d0))))))
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if (M <= 7.2e-247) {
		tmp = 0.0;
	} else if ((M <= 2.25e-160) || !(M <= 5000000000.0)) {
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 / (h * (w * Math.pow((d / D), -2.0)))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	tmp = 0
	if M <= 7.2e-247:
		tmp = 0.0
	elif (M <= 2.25e-160) or not (M <= 5000000000.0):
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 / (h * (w * math.pow((d / D), -2.0)))))
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	tmp = 0.0
	if (M <= 7.2e-247)
		tmp = 0.0;
	elseif ((M <= 2.25e-160) || !(M <= 5000000000.0))
		tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(c0 / Float64(h * Float64(w * (Float64(d / D) ^ -2.0))))));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	tmp = 0.0;
	if (M <= 7.2e-247)
		tmp = 0.0;
	elseif ((M <= 2.25e-160) || ~((M <= 5000000000.0)))
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 / (h * (w * ((d / D) ^ -2.0)))));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 7.2e-247], 0.0, If[Or[LessEqual[M, 2.25e-160], N[Not[LessEqual[M, 5000000000.0]], $MachinePrecision]], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(c0 / N[(h * N[(w * N[Power[N[(d / D), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \leq 7.2 \cdot 10^{-247}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 2.25 \cdot 10^{-160} \lor \neg \left(M \leq 5000000000\right):\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{c0}{h \cdot \left(w \cdot {\left(\frac{d}{D}\right)}^{-2}\right)}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 7.1999999999999994e-247 or 2.25000000000000013e-160 < M < 5e9

    1. Initial program 19.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-c0\right) \cdot \color{blue}{0}\right) \]
      6. distribute-lft-neg-in32.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-c0 \cdot 0\right)} \]
      7. distribute-rgt-neg-in32.5%

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

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

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

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

    if 7.1999999999999994e-247 < M < 2.25000000000000013e-160 or 5e9 < M

    1. Initial program 27.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 7.2 \cdot 10^{-247}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.25 \cdot 10^{-160} \lor \neg \left(M \leq 5000000000\right):\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{c0}{h \cdot \left(w \cdot {\left(\frac{d}{D}\right)}^{-2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 38.6% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\frac{d}{D}\right)}^{-2}\\ \mathbf{if}\;M \leq 3.2 \cdot 10^{-246}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 3.2 \cdot 10^{-160}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{c0}{h \cdot \left(w \cdot t\_0\right)}\right)\\ \mathbf{elif}\;M \leq 98000000:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0 \cdot \left(2 \cdot \frac{\frac{c0}{h \cdot t\_0}}{w}\right)}{2 \cdot w}\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (pow (/ d D) -2.0)))
   (if (<= M 3.2e-246)
     0.0
     (if (<= M 3.2e-160)
       (* (/ c0 (* 2.0 w)) (* 2.0 (/ c0 (* h (* w t_0)))))
       (if (<= M 98000000.0)
         0.0
         (/ (* c0 (* 2.0 (/ (/ c0 (* h t_0)) w))) (* 2.0 w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = pow((d / D), -2.0);
	double tmp;
	if (M <= 3.2e-246) {
		tmp = 0.0;
	} else if (M <= 3.2e-160) {
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 / (h * (w * t_0))));
	} else if (M <= 98000000.0) {
		tmp = 0.0;
	} else {
		tmp = (c0 * (2.0 * ((c0 / (h * t_0)) / w))) / (2.0 * w);
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (d_1 / d) ** (-2.0d0)
    if (m <= 3.2d-246) then
        tmp = 0.0d0
    else if (m <= 3.2d-160) then
        tmp = (c0 / (2.0d0 * w)) * (2.0d0 * (c0 / (h * (w * t_0))))
    else if (m <= 98000000.0d0) then
        tmp = 0.0d0
    else
        tmp = (c0 * (2.0d0 * ((c0 / (h * t_0)) / w))) / (2.0d0 * w)
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = Math.pow((d / D), -2.0);
	double tmp;
	if (M <= 3.2e-246) {
		tmp = 0.0;
	} else if (M <= 3.2e-160) {
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 / (h * (w * t_0))));
	} else if (M <= 98000000.0) {
		tmp = 0.0;
	} else {
		tmp = (c0 * (2.0 * ((c0 / (h * t_0)) / w))) / (2.0 * w);
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = math.pow((d / D), -2.0)
	tmp = 0
	if M <= 3.2e-246:
		tmp = 0.0
	elif M <= 3.2e-160:
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 / (h * (w * t_0))))
	elif M <= 98000000.0:
		tmp = 0.0
	else:
		tmp = (c0 * (2.0 * ((c0 / (h * t_0)) / w))) / (2.0 * w)
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(d / D) ^ -2.0
	tmp = 0.0
	if (M <= 3.2e-246)
		tmp = 0.0;
	elseif (M <= 3.2e-160)
		tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(c0 / Float64(h * Float64(w * t_0)))));
	elseif (M <= 98000000.0)
		tmp = 0.0;
	else
		tmp = Float64(Float64(c0 * Float64(2.0 * Float64(Float64(c0 / Float64(h * t_0)) / w))) / Float64(2.0 * w));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (d / D) ^ -2.0;
	tmp = 0.0;
	if (M <= 3.2e-246)
		tmp = 0.0;
	elseif (M <= 3.2e-160)
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 / (h * (w * t_0))));
	elseif (M <= 98000000.0)
		tmp = 0.0;
	else
		tmp = (c0 * (2.0 * ((c0 / (h * t_0)) / w))) / (2.0 * w);
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[Power[N[(d / D), $MachinePrecision], -2.0], $MachinePrecision]}, If[LessEqual[M, 3.2e-246], 0.0, If[LessEqual[M, 3.2e-160], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(c0 / N[(h * N[(w * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 98000000.0], 0.0, N[(N[(c0 * N[(2.0 * N[(N[(c0 / N[(h * t$95$0), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{-2}\\
\mathbf{if}\;M \leq 3.2 \cdot 10^{-246}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 3.2 \cdot 10^{-160}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{c0}{h \cdot \left(w \cdot t\_0\right)}\right)\\

\mathbf{elif}\;M \leq 98000000:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 3.2000000000000001e-246 or 3.20000000000000009e-160 < M < 9.8e7

    1. Initial program 19.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-c0\right) \cdot \color{blue}{0}\right) \]
      6. distribute-lft-neg-in32.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-c0 \cdot 0\right)} \]
      7. distribute-rgt-neg-in32.5%

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

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

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

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

    if 3.2000000000000001e-246 < M < 3.20000000000000009e-160

    1. Initial program 67.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. Simplified67.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.8e7 < M

    1. Initial program 14.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. Simplified14.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 38.5% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\frac{d}{D}\right)}^{-2}\\ \mathbf{if}\;M \leq 4 \cdot 10^{-248}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.8 \cdot 10^{-160}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{c0}{h \cdot \left(w \cdot t\_0\right)}\right)\\ \mathbf{elif}\;M \leq 2450000000:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(c0 \cdot 2\right) \cdot \frac{c0}{h \cdot t\_0}}{w}}{2 \cdot w}\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (pow (/ d D) -2.0)))
   (if (<= M 4e-248)
     0.0
     (if (<= M 2.8e-160)
       (* (/ c0 (* 2.0 w)) (* 2.0 (/ c0 (* h (* w t_0)))))
       (if (<= M 2450000000.0)
         0.0
         (/ (/ (* (* c0 2.0) (/ c0 (* h t_0))) w) (* 2.0 w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = pow((d / D), -2.0);
	double tmp;
	if (M <= 4e-248) {
		tmp = 0.0;
	} else if (M <= 2.8e-160) {
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 / (h * (w * t_0))));
	} else if (M <= 2450000000.0) {
		tmp = 0.0;
	} else {
		tmp = (((c0 * 2.0) * (c0 / (h * t_0))) / w) / (2.0 * w);
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (d_1 / d) ** (-2.0d0)
    if (m <= 4d-248) then
        tmp = 0.0d0
    else if (m <= 2.8d-160) then
        tmp = (c0 / (2.0d0 * w)) * (2.0d0 * (c0 / (h * (w * t_0))))
    else if (m <= 2450000000.0d0) then
        tmp = 0.0d0
    else
        tmp = (((c0 * 2.0d0) * (c0 / (h * t_0))) / w) / (2.0d0 * w)
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = Math.pow((d / D), -2.0);
	double tmp;
	if (M <= 4e-248) {
		tmp = 0.0;
	} else if (M <= 2.8e-160) {
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 / (h * (w * t_0))));
	} else if (M <= 2450000000.0) {
		tmp = 0.0;
	} else {
		tmp = (((c0 * 2.0) * (c0 / (h * t_0))) / w) / (2.0 * w);
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = math.pow((d / D), -2.0)
	tmp = 0
	if M <= 4e-248:
		tmp = 0.0
	elif M <= 2.8e-160:
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 / (h * (w * t_0))))
	elif M <= 2450000000.0:
		tmp = 0.0
	else:
		tmp = (((c0 * 2.0) * (c0 / (h * t_0))) / w) / (2.0 * w)
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(d / D) ^ -2.0
	tmp = 0.0
	if (M <= 4e-248)
		tmp = 0.0;
	elseif (M <= 2.8e-160)
		tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(c0 / Float64(h * Float64(w * t_0)))));
	elseif (M <= 2450000000.0)
		tmp = 0.0;
	else
		tmp = Float64(Float64(Float64(Float64(c0 * 2.0) * Float64(c0 / Float64(h * t_0))) / w) / Float64(2.0 * w));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (d / D) ^ -2.0;
	tmp = 0.0;
	if (M <= 4e-248)
		tmp = 0.0;
	elseif (M <= 2.8e-160)
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 / (h * (w * t_0))));
	elseif (M <= 2450000000.0)
		tmp = 0.0;
	else
		tmp = (((c0 * 2.0) * (c0 / (h * t_0))) / w) / (2.0 * w);
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[Power[N[(d / D), $MachinePrecision], -2.0], $MachinePrecision]}, If[LessEqual[M, 4e-248], 0.0, If[LessEqual[M, 2.8e-160], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(c0 / N[(h * N[(w * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 2450000000.0], 0.0, N[(N[(N[(N[(c0 * 2.0), $MachinePrecision] * N[(c0 / N[(h * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{-2}\\
\mathbf{if}\;M \leq 4 \cdot 10^{-248}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 2.8 \cdot 10^{-160}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{c0}{h \cdot \left(w \cdot t\_0\right)}\right)\\

\mathbf{elif}\;M \leq 2450000000:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 3.99999999999999992e-248 or 2.80000000000000016e-160 < M < 2.45e9

    1. Initial program 19.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-c0\right) \cdot \color{blue}{0}\right) \]
      6. distribute-lft-neg-in32.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-c0 \cdot 0\right)} \]
      7. distribute-rgt-neg-in32.5%

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

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

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

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

    if 3.99999999999999992e-248 < M < 2.80000000000000016e-160

    1. Initial program 67.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. Simplified67.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.45e9 < M

    1. Initial program 14.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. Simplified14.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 4 \cdot 10^{-248}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.8 \cdot 10^{-160}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{c0}{h \cdot \left(w \cdot {\left(\frac{d}{D}\right)}^{-2}\right)}\right)\\ \mathbf{elif}\;M \leq 2450000000:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(c0 \cdot 2\right) \cdot \frac{c0}{h \cdot {\left(\frac{d}{D}\right)}^{-2}}}{w}}{2 \cdot w}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 38.3% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 7.5 \cdot 10^{-249}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.2 \cdot 10^{-160} \lor \neg \left(M \leq 1500000000\right):\\ \;\;\;\;\frac{c0}{w} \cdot \frac{\frac{\frac{c0}{h}}{{\left(\frac{d}{D}\right)}^{-2}}}{w}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (if (<= M 7.5e-249)
   0.0
   (if (or (<= M 2.2e-160) (not (<= M 1500000000.0)))
     (* (/ c0 w) (/ (/ (/ c0 h) (pow (/ d D) -2.0)) w))
     0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if (M <= 7.5e-249) {
		tmp = 0.0;
	} else if ((M <= 2.2e-160) || !(M <= 1500000000.0)) {
		tmp = (c0 / w) * (((c0 / h) / pow((d / D), -2.0)) / w);
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: tmp
    if (m <= 7.5d-249) then
        tmp = 0.0d0
    else if ((m <= 2.2d-160) .or. (.not. (m <= 1500000000.0d0))) then
        tmp = (c0 / w) * (((c0 / h) / ((d_1 / d) ** (-2.0d0))) / w)
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if (M <= 7.5e-249) {
		tmp = 0.0;
	} else if ((M <= 2.2e-160) || !(M <= 1500000000.0)) {
		tmp = (c0 / w) * (((c0 / h) / Math.pow((d / D), -2.0)) / w);
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	tmp = 0
	if M <= 7.5e-249:
		tmp = 0.0
	elif (M <= 2.2e-160) or not (M <= 1500000000.0):
		tmp = (c0 / w) * (((c0 / h) / math.pow((d / D), -2.0)) / w)
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	tmp = 0.0
	if (M <= 7.5e-249)
		tmp = 0.0;
	elseif ((M <= 2.2e-160) || !(M <= 1500000000.0))
		tmp = Float64(Float64(c0 / w) * Float64(Float64(Float64(c0 / h) / (Float64(d / D) ^ -2.0)) / w));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	tmp = 0.0;
	if (M <= 7.5e-249)
		tmp = 0.0;
	elseif ((M <= 2.2e-160) || ~((M <= 1500000000.0)))
		tmp = (c0 / w) * (((c0 / h) / ((d / D) ^ -2.0)) / w);
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 7.5e-249], 0.0, If[Or[LessEqual[M, 2.2e-160], N[Not[LessEqual[M, 1500000000.0]], $MachinePrecision]], N[(N[(c0 / w), $MachinePrecision] * N[(N[(N[(c0 / h), $MachinePrecision] / N[Power[N[(d / D), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \leq 7.5 \cdot 10^{-249}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 2.2 \cdot 10^{-160} \lor \neg \left(M \leq 1500000000\right):\\
\;\;\;\;\frac{c0}{w} \cdot \frac{\frac{\frac{c0}{h}}{{\left(\frac{d}{D}\right)}^{-2}}}{w}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 7.50000000000000034e-249 or 2.2e-160 < M < 1.5e9

    1. Initial program 19.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-c0\right) \cdot \color{blue}{0}\right) \]
      6. distribute-lft-neg-in32.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-c0 \cdot 0\right)} \]
      7. distribute-rgt-neg-in32.5%

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

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

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

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

    if 7.50000000000000034e-249 < M < 2.2e-160 or 1.5e9 < M

    1. Initial program 27.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 7.5 \cdot 10^{-249}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.2 \cdot 10^{-160} \lor \neg \left(M \leq 1500000000\right):\\ \;\;\;\;\frac{c0}{w} \cdot \frac{\frac{\frac{c0}{h}}{{\left(\frac{d}{D}\right)}^{-2}}}{w}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 38.3% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 5 \cdot 10^{-248}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 1.9 \cdot 10^{-160} \lor \neg \left(M \leq 21500000\right):\\ \;\;\;\;\frac{c0}{w} \cdot \frac{\frac{c0}{h}}{w \cdot {\left(\frac{d}{D}\right)}^{-2}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (if (<= M 5e-248)
   0.0
   (if (or (<= M 1.9e-160) (not (<= M 21500000.0)))
     (* (/ c0 w) (/ (/ c0 h) (* w (pow (/ d D) -2.0))))
     0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if (M <= 5e-248) {
		tmp = 0.0;
	} else if ((M <= 1.9e-160) || !(M <= 21500000.0)) {
		tmp = (c0 / w) * ((c0 / h) / (w * pow((d / D), -2.0)));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: tmp
    if (m <= 5d-248) then
        tmp = 0.0d0
    else if ((m <= 1.9d-160) .or. (.not. (m <= 21500000.0d0))) then
        tmp = (c0 / w) * ((c0 / h) / (w * ((d_1 / d) ** (-2.0d0))))
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if (M <= 5e-248) {
		tmp = 0.0;
	} else if ((M <= 1.9e-160) || !(M <= 21500000.0)) {
		tmp = (c0 / w) * ((c0 / h) / (w * Math.pow((d / D), -2.0)));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	tmp = 0
	if M <= 5e-248:
		tmp = 0.0
	elif (M <= 1.9e-160) or not (M <= 21500000.0):
		tmp = (c0 / w) * ((c0 / h) / (w * math.pow((d / D), -2.0)))
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	tmp = 0.0
	if (M <= 5e-248)
		tmp = 0.0;
	elseif ((M <= 1.9e-160) || !(M <= 21500000.0))
		tmp = Float64(Float64(c0 / w) * Float64(Float64(c0 / h) / Float64(w * (Float64(d / D) ^ -2.0))));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	tmp = 0.0;
	if (M <= 5e-248)
		tmp = 0.0;
	elseif ((M <= 1.9e-160) || ~((M <= 21500000.0)))
		tmp = (c0 / w) * ((c0 / h) / (w * ((d / D) ^ -2.0)));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 5e-248], 0.0, If[Or[LessEqual[M, 1.9e-160], N[Not[LessEqual[M, 21500000.0]], $MachinePrecision]], N[(N[(c0 / w), $MachinePrecision] * N[(N[(c0 / h), $MachinePrecision] / N[(w * N[Power[N[(d / D), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \leq 5 \cdot 10^{-248}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 1.9 \cdot 10^{-160} \lor \neg \left(M \leq 21500000\right):\\
\;\;\;\;\frac{c0}{w} \cdot \frac{\frac{c0}{h}}{w \cdot {\left(\frac{d}{D}\right)}^{-2}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 5.0000000000000001e-248 or 1.8999999999999999e-160 < M < 2.15e7

    1. Initial program 19.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-c0\right) \cdot \color{blue}{0}\right) \]
      6. distribute-lft-neg-in32.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-c0 \cdot 0\right)} \]
      7. distribute-rgt-neg-in32.5%

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

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

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

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

    if 5.0000000000000001e-248 < M < 1.8999999999999999e-160 or 2.15e7 < M

    1. Initial program 27.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 5 \cdot 10^{-248}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 1.9 \cdot 10^{-160} \lor \neg \left(M \leq 21500000\right):\\ \;\;\;\;\frac{c0}{w} \cdot \frac{\frac{c0}{h}}{w \cdot {\left(\frac{d}{D}\right)}^{-2}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 33.5% accurate, 151.0× speedup?

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

\\
0
\end{array}
Derivation
  1. Initial program 22.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. Simplified22.5%

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-c0\right) \cdot \color{blue}{0}\right) \]
    6. distribute-lft-neg-in28.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-c0 \cdot 0\right)} \]
    7. distribute-rgt-neg-in28.1%

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

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

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

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

    \[\leadsto 0 \]
  9. Add Preprocessing

Reproduce

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