Henrywood and Agarwal, Equation (13)

Percentage Accurate: 23.7% → 53.3%
Time: 28.1s
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: 23.7% accurate, 1.0× speedup?

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

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

Alternative 1: 53.3% accurate, 0.9× 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)}\\ \mathbf{if}\;t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right) \leq \infty:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \left(\left(d \cdot d\right) \cdot \frac{\frac{c0}{D \cdot D}}{w \cdot h}\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)))))
   (if (<= (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M))))) INFINITY)
     (* t_0 (* 2.0 (* (* d d) (/ (/ c0 (* D D)) (* w h)))))
     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 tmp;
	if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= ((double) INFINITY)) {
		tmp = t_0 * (2.0 * ((d * d) * ((c0 / (D * D)) / (w * h))));
	} 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 tmp;
	if ((t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))))) <= Double.POSITIVE_INFINITY) {
		tmp = t_0 * (2.0 * ((d * d) * ((c0 / (D * D)) / (w * h))));
	} 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))
	tmp = 0
	if (t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))) <= math.inf:
		tmp = t_0 * (2.0 * ((d * d) * ((c0 / (D * D)) / (w * h))))
	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)))
	tmp = 0.0
	if (Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= Inf)
		tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(d * d) * Float64(Float64(c0 / Float64(D * D)) / Float64(w * h)))));
	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));
	tmp = 0.0;
	if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= Inf)
		tmp = t_0 * (2.0 * ((d * d) * ((c0 / (D * D)) / (w * h))));
	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]}, If[LessEqual[N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 * N[(2.0 * N[(N[(d * d), $MachinePrecision] * N[(N[(c0 / N[(D * D), $MachinePrecision]), $MachinePrecision] / N[(w * h), $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)}\\
\mathbf{if}\;t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(\left(d \cdot d\right) \cdot \frac{\frac{c0}{D \cdot D}}{w \cdot h}\right)\right)\\

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


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

    1. Initial program 73.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. Simplified72.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{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around inf 79.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)} \]
    4. Step-by-step derivation
      1. associate-*r/79.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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)} \]
    4. Step-by-step derivation
      1. mul-1-neg1.4%

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

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

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

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

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

Alternative 2: 42.1% accurate, 5.2× speedup?

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

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

\mathbf{elif}\;c0 \leq 6.2 \cdot 10^{-220}:\\
\;\;\;\;\frac{\frac{c0}{D} \cdot \frac{c0}{D}}{h} \cdot \left(d \cdot \frac{d}{w \cdot w}\right)\\

\mathbf{elif}\;c0 \leq 2.9 \cdot 10^{+200} \lor \neg \left(c0 \leq 3.5 \cdot 10^{+236}\right):\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c0 < -2.30000000000000011e-55 or 6.20000000000000023e-220 < c0 < 2.8999999999999999e200 or 3.49999999999999979e236 < c0

    1. Initial program 30.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. Simplified31.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{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around inf 40.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)} \]
    4. Step-by-step derivation
      1. associate-*r/40.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.30000000000000011e-55 < c0 < 6.20000000000000023e-220

    1. Initial program 18.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. Simplified18.7%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around inf 25.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)} \]
    4. Step-by-step derivation
      1. associate-*r/25.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.8999999999999999e200 < c0 < 3.49999999999999979e236

    1. Initial program 10.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. Simplified20.0%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around -inf 10.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)} \]
    4. Step-by-step derivation
      1. mul-1-neg10.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -2.3 \cdot 10^{-55}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w \cdot h}\right)\right)\\ \mathbf{elif}\;c0 \leq 6.2 \cdot 10^{-220}:\\ \;\;\;\;\frac{\frac{c0}{D} \cdot \frac{c0}{D}}{h} \cdot \left(d \cdot \frac{d}{w \cdot w}\right)\\ \mathbf{elif}\;c0 \leq 2.9 \cdot 10^{+200} \lor \neg \left(c0 \leq 3.5 \cdot 10^{+236}\right):\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w \cdot h}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 3: 37.0% accurate, 5.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0}{D \cdot D} \cdot \frac{d \cdot d}{w \cdot h}\right)\right)\\ \mathbf{if}\;M \leq 4.3 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 7.5 \cdot 10^{-96}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;M \leq 1.85 \cdot 10^{-69}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.1 \cdot 10^{-42}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;M \leq 0.0005:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{D} \cdot \left(\frac{c0}{D} \cdot \frac{d \cdot \frac{d}{w \cdot w}}{h}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0
         (* (/ c0 (* 2.0 w)) (* 2.0 (* (/ c0 (* D D)) (/ (* d d) (* w h)))))))
   (if (<= M 4.3e-169)
     0.0
     (if (<= M 7.5e-96)
       t_0
       (if (<= M 1.85e-69)
         0.0
         (if (<= M 2.1e-42)
           t_0
           (if (<= M 0.0005)
             0.0
             (* (/ c0 D) (* (/ c0 D) (/ (* d (/ d (* w w))) h))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 / (2.0 * w)) * (2.0 * ((c0 / (D * D)) * ((d * d) / (w * h))));
	double tmp;
	if (M <= 4.3e-169) {
		tmp = 0.0;
	} else if (M <= 7.5e-96) {
		tmp = t_0;
	} else if (M <= 1.85e-69) {
		tmp = 0.0;
	} else if (M <= 2.1e-42) {
		tmp = t_0;
	} else if (M <= 0.0005) {
		tmp = 0.0;
	} else {
		tmp = (c0 / D) * ((c0 / D) * ((d * (d / (w * w))) / h));
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (c0 / (2.0d0 * w)) * (2.0d0 * ((c0 / (d * d)) * ((d_1 * d_1) / (w * h))))
    if (m <= 4.3d-169) then
        tmp = 0.0d0
    else if (m <= 7.5d-96) then
        tmp = t_0
    else if (m <= 1.85d-69) then
        tmp = 0.0d0
    else if (m <= 2.1d-42) then
        tmp = t_0
    else if (m <= 0.0005d0) then
        tmp = 0.0d0
    else
        tmp = (c0 / d) * ((c0 / d) * ((d_1 * (d_1 / (w * w))) / h))
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 / (2.0 * w)) * (2.0 * ((c0 / (D * D)) * ((d * d) / (w * h))));
	double tmp;
	if (M <= 4.3e-169) {
		tmp = 0.0;
	} else if (M <= 7.5e-96) {
		tmp = t_0;
	} else if (M <= 1.85e-69) {
		tmp = 0.0;
	} else if (M <= 2.1e-42) {
		tmp = t_0;
	} else if (M <= 0.0005) {
		tmp = 0.0;
	} else {
		tmp = (c0 / D) * ((c0 / D) * ((d * (d / (w * w))) / h));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 / (2.0 * w)) * (2.0 * ((c0 / (D * D)) * ((d * d) / (w * h))))
	tmp = 0
	if M <= 4.3e-169:
		tmp = 0.0
	elif M <= 7.5e-96:
		tmp = t_0
	elif M <= 1.85e-69:
		tmp = 0.0
	elif M <= 2.1e-42:
		tmp = t_0
	elif M <= 0.0005:
		tmp = 0.0
	else:
		tmp = (c0 / D) * ((c0 / D) * ((d * (d / (w * w))) / h))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(Float64(c0 / Float64(D * D)) * Float64(Float64(d * d) / Float64(w * h)))))
	tmp = 0.0
	if (M <= 4.3e-169)
		tmp = 0.0;
	elseif (M <= 7.5e-96)
		tmp = t_0;
	elseif (M <= 1.85e-69)
		tmp = 0.0;
	elseif (M <= 2.1e-42)
		tmp = t_0;
	elseif (M <= 0.0005)
		tmp = 0.0;
	else
		tmp = Float64(Float64(c0 / D) * Float64(Float64(c0 / D) * Float64(Float64(d * Float64(d / Float64(w * w))) / h)));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (c0 / (2.0 * w)) * (2.0 * ((c0 / (D * D)) * ((d * d) / (w * h))));
	tmp = 0.0;
	if (M <= 4.3e-169)
		tmp = 0.0;
	elseif (M <= 7.5e-96)
		tmp = t_0;
	elseif (M <= 1.85e-69)
		tmp = 0.0;
	elseif (M <= 2.1e-42)
		tmp = t_0;
	elseif (M <= 0.0005)
		tmp = 0.0;
	else
		tmp = (c0 / D) * ((c0 / D) * ((d * (d / (w * w))) / h));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(c0 / N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 4.3e-169], 0.0, If[LessEqual[M, 7.5e-96], t$95$0, If[LessEqual[M, 1.85e-69], 0.0, If[LessEqual[M, 2.1e-42], t$95$0, If[LessEqual[M, 0.0005], 0.0, N[(N[(c0 / D), $MachinePrecision] * N[(N[(c0 / D), $MachinePrecision] * N[(N[(d * N[(d / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;M \leq 7.5 \cdot 10^{-96}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;M \leq 1.85 \cdot 10^{-69}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 2.1 \cdot 10^{-42}:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 4.29999999999999984e-169 or 7.5e-96 < M < 1.8500000000000001e-69 or 2.10000000000000006e-42 < M < 5.0000000000000001e-4

    1. Initial program 26.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. 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{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around -inf 2.5%

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

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

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

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

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

    if 4.29999999999999984e-169 < M < 7.5e-96 or 1.8500000000000001e-69 < M < 2.10000000000000006e-42

    1. Initial program 45.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. Simplified45.6%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around inf 50.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)} \]
    4. Step-by-step derivation
      1. associate-*r/50.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000001e-4 < M

    1. Initial program 17.2%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified17.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{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around inf 36.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)} \]
    4. Step-by-step derivation
      1. associate-*r/36.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 4.3 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 7.5 \cdot 10^{-96}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0}{D \cdot D} \cdot \frac{d \cdot d}{w \cdot h}\right)\right)\\ \mathbf{elif}\;M \leq 1.85 \cdot 10^{-69}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.1 \cdot 10^{-42}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0}{D \cdot D} \cdot \frac{d \cdot d}{w \cdot h}\right)\right)\\ \mathbf{elif}\;M \leq 0.0005:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{D} \cdot \left(\frac{c0}{D} \cdot \frac{d \cdot \frac{d}{w \cdot w}}{h}\right)\\ \end{array} \]

Alternative 4: 44.4% accurate, 5.2× speedup?

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

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

\mathbf{elif}\;c0 \leq 3.1 \cdot 10^{-267}:\\
\;\;\;\;0\\

\mathbf{elif}\;c0 \leq 7 \cdot 10^{+201}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c0 \leq 4.2 \cdot 10^{+236}:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c0 < -4.1000000000000002e-131 or 3.1000000000000001e-267 < c0 < 7.0000000000000004e201

    1. Initial program 29.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. Simplified30.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{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around inf 39.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.1000000000000002e-131 < c0 < 3.1000000000000001e-267 or 7.0000000000000004e201 < c0 < 4.20000000000000011e236

    1. Initial program 12.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified14.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{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around -inf 4.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)} \]
    4. Step-by-step derivation
      1. mul-1-neg4.1%

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

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

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

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

    if 4.20000000000000011e236 < c0

    1. Initial program 31.3%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified31.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{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around inf 38.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)} \]
    4. Step-by-step derivation
      1. associate-*r/38.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -4.1 \cdot 10^{-131}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\ \mathbf{elif}\;c0 \leq 3.1 \cdot 10^{-267}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \leq 7 \cdot 10^{+201}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\ \mathbf{elif}\;c0 \leq 4.2 \cdot 10^{+236}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w \cdot h}\right)\right)\\ \end{array} \]

Alternative 5: 37.5% accurate, 5.5× speedup?

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

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

\mathbf{elif}\;M \leq 10^{-106} \lor \neg \left(M \leq 1.65 \cdot 10^{-69} \lor \neg \left(M \leq 1.22 \cdot 10^{-42}\right) \land M \leq 0.00023\right):\\
\;\;\;\;\left(c0 \cdot \frac{c0}{D}\right) \cdot \frac{\frac{d \cdot \frac{d}{w \cdot w}}{h}}{D}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 3.10000000000000011e-130 or 9.99999999999999941e-107 < M < 1.65e-69 or 1.22000000000000007e-42 < M < 2.3000000000000001e-4

    1. Initial program 27.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. Simplified28.6%

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

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

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

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

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

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

    if 3.10000000000000011e-130 < M < 9.99999999999999941e-107 or 1.65e-69 < M < 1.22000000000000007e-42 or 2.3000000000000001e-4 < M

    1. Initial program 23.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. Simplified23.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{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around inf 41.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{c0 \cdot c0}}{D} \cdot \frac{\frac{d}{h} \cdot \frac{d}{w \cdot w}}{D} \]
      4. associate-*r/43.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 3.1 \cdot 10^{-130}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 10^{-106} \lor \neg \left(M \leq 1.65 \cdot 10^{-69} \lor \neg \left(M \leq 1.22 \cdot 10^{-42}\right) \land M \leq 0.00023\right):\\ \;\;\;\;\left(c0 \cdot \frac{c0}{D}\right) \cdot \frac{\frac{d \cdot \frac{d}{w \cdot w}}{h}}{D}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 6: 43.5% accurate, 5.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{d}{w \cdot w}\\ \mathbf{if}\;w \leq -2.55 \cdot 10^{+148}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq -3.5 \cdot 10^{-91}:\\ \;\;\;\;t_0 \cdot \left(\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \frac{d}{h}\right)\\ \mathbf{elif}\;w \leq 6.2 \cdot 10^{-105} \lor \neg \left(w \leq 470\right) \land w \leq 4.4 \cdot 10^{+42}:\\ \;\;\;\;\frac{c0}{D} \cdot \left(\frac{c0}{D} \cdot \frac{d \cdot t_0}{h}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ d (* w w))))
   (if (<= w -2.55e+148)
     0.0
     (if (<= w -3.5e-91)
       (* t_0 (* (* (/ c0 D) (/ c0 D)) (/ d h)))
       (if (or (<= w 6.2e-105) (and (not (<= w 470.0)) (<= w 4.4e+42)))
         (* (/ c0 D) (* (/ c0 D) (/ (* d t_0) h)))
         0.0)))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = d / (w * w);
	double tmp;
	if (w <= -2.55e+148) {
		tmp = 0.0;
	} else if (w <= -3.5e-91) {
		tmp = t_0 * (((c0 / D) * (c0 / D)) * (d / h));
	} else if ((w <= 6.2e-105) || (!(w <= 470.0) && (w <= 4.4e+42))) {
		tmp = (c0 / D) * ((c0 / D) * ((d * t_0) / h));
	} 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) :: t_0
    real(8) :: tmp
    t_0 = d_1 / (w * w)
    if (w <= (-2.55d+148)) then
        tmp = 0.0d0
    else if (w <= (-3.5d-91)) then
        tmp = t_0 * (((c0 / d) * (c0 / d)) * (d_1 / h))
    else if ((w <= 6.2d-105) .or. (.not. (w <= 470.0d0)) .and. (w <= 4.4d+42)) then
        tmp = (c0 / d) * ((c0 / d) * ((d_1 * t_0) / h))
    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 t_0 = d / (w * w);
	double tmp;
	if (w <= -2.55e+148) {
		tmp = 0.0;
	} else if (w <= -3.5e-91) {
		tmp = t_0 * (((c0 / D) * (c0 / D)) * (d / h));
	} else if ((w <= 6.2e-105) || (!(w <= 470.0) && (w <= 4.4e+42))) {
		tmp = (c0 / D) * ((c0 / D) * ((d * t_0) / h));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = d / (w * w)
	tmp = 0
	if w <= -2.55e+148:
		tmp = 0.0
	elif w <= -3.5e-91:
		tmp = t_0 * (((c0 / D) * (c0 / D)) * (d / h))
	elif (w <= 6.2e-105) or (not (w <= 470.0) and (w <= 4.4e+42)):
		tmp = (c0 / D) * ((c0 / D) * ((d * t_0) / h))
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(d / Float64(w * w))
	tmp = 0.0
	if (w <= -2.55e+148)
		tmp = 0.0;
	elseif (w <= -3.5e-91)
		tmp = Float64(t_0 * Float64(Float64(Float64(c0 / D) * Float64(c0 / D)) * Float64(d / h)));
	elseif ((w <= 6.2e-105) || (!(w <= 470.0) && (w <= 4.4e+42)))
		tmp = Float64(Float64(c0 / D) * Float64(Float64(c0 / D) * Float64(Float64(d * t_0) / h)));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = d / (w * w);
	tmp = 0.0;
	if (w <= -2.55e+148)
		tmp = 0.0;
	elseif (w <= -3.5e-91)
		tmp = t_0 * (((c0 / D) * (c0 / D)) * (d / h));
	elseif ((w <= 6.2e-105) || (~((w <= 470.0)) && (w <= 4.4e+42)))
		tmp = (c0 / D) * ((c0 / D) * ((d * t_0) / h));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(d / N[(w * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -2.55e+148], 0.0, If[LessEqual[w, -3.5e-91], N[(t$95$0 * N[(N[(N[(c0 / D), $MachinePrecision] * N[(c0 / D), $MachinePrecision]), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[w, 6.2e-105], And[N[Not[LessEqual[w, 470.0]], $MachinePrecision], LessEqual[w, 4.4e+42]]], N[(N[(c0 / D), $MachinePrecision] * N[(N[(c0 / D), $MachinePrecision] * N[(N[(d * t$95$0), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{d}{w \cdot w}\\
\mathbf{if}\;w \leq -2.55 \cdot 10^{+148}:\\
\;\;\;\;0\\

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

\mathbf{elif}\;w \leq 6.2 \cdot 10^{-105} \lor \neg \left(w \leq 470\right) \land w \leq 4.4 \cdot 10^{+42}:\\
\;\;\;\;\frac{c0}{D} \cdot \left(\frac{c0}{D} \cdot \frac{d \cdot t_0}{h}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if w < -2.54999999999999993e148 or 6.20000000000000029e-105 < w < 470 or 4.4000000000000003e42 < w

    1. Initial program 18.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. Simplified18.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{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around -inf 3.7%

      \[\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)} \]
    4. Step-by-step derivation
      1. mul-1-neg3.7%

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

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

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

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

    if -2.54999999999999993e148 < w < -3.4999999999999999e-91

    1. Initial program 18.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. Simplified20.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{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around inf 32.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)} \]
    4. Step-by-step derivation
      1. associate-*r/32.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.4999999999999999e-91 < w < 6.20000000000000029e-105 or 470 < w < 4.4000000000000003e42

    1. Initial program 38.0%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified39.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{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around inf 46.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)} \]
    4. Step-by-step derivation
      1. associate-*r/46.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -2.55 \cdot 10^{+148}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq -3.5 \cdot 10^{-91}:\\ \;\;\;\;\frac{d}{w \cdot w} \cdot \left(\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \frac{d}{h}\right)\\ \mathbf{elif}\;w \leq 6.2 \cdot 10^{-105} \lor \neg \left(w \leq 470\right) \land w \leq 4.4 \cdot 10^{+42}:\\ \;\;\;\;\frac{c0}{D} \cdot \left(\frac{c0}{D} \cdot \frac{d \cdot \frac{d}{w \cdot w}}{h}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 7: 37.4% accurate, 5.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{d}{w \cdot w}\\ t_1 := t_0 \cdot \left(\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \frac{d}{h}\right)\\ \mathbf{if}\;M \leq 3.2 \cdot 10^{-130}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.5 \cdot 10^{-106}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;M \leq 1.35 \cdot 10^{-69}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 1.16 \cdot 10^{-42}:\\ \;\;\;\;\left(c0 \cdot \frac{c0}{D}\right) \cdot \frac{\frac{d \cdot t_0}{h}}{D}\\ \mathbf{elif}\;M \leq 0.00035:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ d (* w w))) (t_1 (* t_0 (* (* (/ c0 D) (/ c0 D)) (/ d h)))))
   (if (<= M 3.2e-130)
     0.0
     (if (<= M 2.5e-106)
       t_1
       (if (<= M 1.35e-69)
         0.0
         (if (<= M 1.16e-42)
           (* (* c0 (/ c0 D)) (/ (/ (* d t_0) h) D))
           (if (<= M 0.00035) 0.0 t_1)))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = d / (w * w);
	double t_1 = t_0 * (((c0 / D) * (c0 / D)) * (d / h));
	double tmp;
	if (M <= 3.2e-130) {
		tmp = 0.0;
	} else if (M <= 2.5e-106) {
		tmp = t_1;
	} else if (M <= 1.35e-69) {
		tmp = 0.0;
	} else if (M <= 1.16e-42) {
		tmp = (c0 * (c0 / D)) * (((d * t_0) / h) / D);
	} else if (M <= 0.00035) {
		tmp = 0.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = d_1 / (w * w)
    t_1 = t_0 * (((c0 / d) * (c0 / d)) * (d_1 / h))
    if (m <= 3.2d-130) then
        tmp = 0.0d0
    else if (m <= 2.5d-106) then
        tmp = t_1
    else if (m <= 1.35d-69) then
        tmp = 0.0d0
    else if (m <= 1.16d-42) then
        tmp = (c0 * (c0 / d)) * (((d_1 * t_0) / h) / d)
    else if (m <= 0.00035d0) then
        tmp = 0.0d0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = d / (w * w);
	double t_1 = t_0 * (((c0 / D) * (c0 / D)) * (d / h));
	double tmp;
	if (M <= 3.2e-130) {
		tmp = 0.0;
	} else if (M <= 2.5e-106) {
		tmp = t_1;
	} else if (M <= 1.35e-69) {
		tmp = 0.0;
	} else if (M <= 1.16e-42) {
		tmp = (c0 * (c0 / D)) * (((d * t_0) / h) / D);
	} else if (M <= 0.00035) {
		tmp = 0.0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = d / (w * w)
	t_1 = t_0 * (((c0 / D) * (c0 / D)) * (d / h))
	tmp = 0
	if M <= 3.2e-130:
		tmp = 0.0
	elif M <= 2.5e-106:
		tmp = t_1
	elif M <= 1.35e-69:
		tmp = 0.0
	elif M <= 1.16e-42:
		tmp = (c0 * (c0 / D)) * (((d * t_0) / h) / D)
	elif M <= 0.00035:
		tmp = 0.0
	else:
		tmp = t_1
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(d / Float64(w * w))
	t_1 = Float64(t_0 * Float64(Float64(Float64(c0 / D) * Float64(c0 / D)) * Float64(d / h)))
	tmp = 0.0
	if (M <= 3.2e-130)
		tmp = 0.0;
	elseif (M <= 2.5e-106)
		tmp = t_1;
	elseif (M <= 1.35e-69)
		tmp = 0.0;
	elseif (M <= 1.16e-42)
		tmp = Float64(Float64(c0 * Float64(c0 / D)) * Float64(Float64(Float64(d * t_0) / h) / D));
	elseif (M <= 0.00035)
		tmp = 0.0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = d / (w * w);
	t_1 = t_0 * (((c0 / D) * (c0 / D)) * (d / h));
	tmp = 0.0;
	if (M <= 3.2e-130)
		tmp = 0.0;
	elseif (M <= 2.5e-106)
		tmp = t_1;
	elseif (M <= 1.35e-69)
		tmp = 0.0;
	elseif (M <= 1.16e-42)
		tmp = (c0 * (c0 / D)) * (((d * t_0) / h) / D);
	elseif (M <= 0.00035)
		tmp = 0.0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(d / N[(w * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[(c0 / D), $MachinePrecision] * N[(c0 / D), $MachinePrecision]), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 3.2e-130], 0.0, If[LessEqual[M, 2.5e-106], t$95$1, If[LessEqual[M, 1.35e-69], 0.0, If[LessEqual[M, 1.16e-42], N[(N[(c0 * N[(c0 / D), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(d * t$95$0), $MachinePrecision] / h), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 0.00035], 0.0, t$95$1]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{d}{w \cdot w}\\
t_1 := t_0 \cdot \left(\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \frac{d}{h}\right)\\
\mathbf{if}\;M \leq 3.2 \cdot 10^{-130}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 2.5 \cdot 10^{-106}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;M \leq 1.35 \cdot 10^{-69}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 1.16 \cdot 10^{-42}:\\
\;\;\;\;\left(c0 \cdot \frac{c0}{D}\right) \cdot \frac{\frac{d \cdot t_0}{h}}{D}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 3.2e-130 or 2.49999999999999991e-106 < M < 1.3499999999999999e-69 or 1.1600000000000001e-42 < M < 3.49999999999999996e-4

    1. Initial program 27.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. Simplified28.6%

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

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

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

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

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

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

    if 3.2e-130 < M < 2.49999999999999991e-106 or 3.49999999999999996e-4 < M

    1. Initial program 21.3%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified21.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{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around inf 38.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.3499999999999999e-69 < M < 1.1600000000000001e-42

    1. Initial program 50.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{c0 \cdot c0}}{D} \cdot \frac{\frac{d}{h} \cdot \frac{d}{w \cdot w}}{D} \]
      4. associate-*r/26.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 3.2 \cdot 10^{-130}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.5 \cdot 10^{-106}:\\ \;\;\;\;\frac{d}{w \cdot w} \cdot \left(\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \frac{d}{h}\right)\\ \mathbf{elif}\;M \leq 1.35 \cdot 10^{-69}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 1.16 \cdot 10^{-42}:\\ \;\;\;\;\left(c0 \cdot \frac{c0}{D}\right) \cdot \frac{\frac{d \cdot \frac{d}{w \cdot w}}{h}}{D}\\ \mathbf{elif}\;M \leq 0.00035:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{w \cdot w} \cdot \left(\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \frac{d}{h}\right)\\ \end{array} \]

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

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

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

    \[\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)} \]
  4. Step-by-step derivation
    1. mul-1-neg2.4%

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

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

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

    \[\leadsto \color{blue}{0} \]
  7. Final simplification33.4%

    \[\leadsto 0 \]

Reproduce

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