Henrywood and Agarwal, Equation (13)

Percentage Accurate: 24.5% → 56.0%
Time: 28.0s
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: 24.5% accurate, 1.0× speedup?

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

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

Alternative 1: 56.0% 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:\\ \;\;\;\;\frac{t_0}{\frac{D}{d}} \cdot \frac{c0 \cdot 2}{\frac{h \cdot D}{\frac{d}{w}}}\\ \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 (/ D d)) (/ (* c0 2.0) (/ (* h D) (/ d w))))
     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 / (D / d)) * ((c0 * 2.0) / ((h * D) / (d / w)));
	} 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 / (D / d)) * ((c0 * 2.0) / ((h * D) / (d / w)));
	} 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 / (D / d)) * ((c0 * 2.0) / ((h * D) / (d / w)))
	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(Float64(t_0 / Float64(D / d)) * Float64(Float64(c0 * 2.0) / Float64(Float64(h * D) / Float64(d / w))));
	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 / (D / d)) * ((c0 * 2.0) / ((h * D) / (d / w)));
	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[(N[(t$95$0 / N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * 2.0), $MachinePrecision] / N[(N[(h * D), $MachinePrecision] / N[(d / w), $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:\\
\;\;\;\;\frac{t_0}{\frac{D}{d}} \cdot \frac{c0 \cdot 2}{\frac{h \cdot D}{\frac{d}{w}}}\\

\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 74.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. Simplified63.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{c0}{2 \cdot w}}{\frac{D}{d}} \cdot \frac{c0 \cdot 2}{\color{blue}{\frac{h \cdot D}{\frac{d}{w}}}} \]
      6. *-commutative76.1%

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

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

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

    1. Initial program 0.0%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified1.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.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-neg2.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-in0.2%

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

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

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

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

Alternative 2: 41.3% accurate, 4.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0 \cdot d}{D}\\ \mathbf{if}\;c0 \leq -3.5 \cdot 10^{+182}:\\ \;\;\;\;\frac{\frac{t_0 \cdot t_0}{w \cdot w}}{h}\\ \mathbf{elif}\;c0 \leq -1.35 \cdot 10^{+83}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \leq -3.6 \cdot 10^{-80} \lor \neg \left(c0 \leq 9.8 \cdot 10^{-87}\right) \land \left(c0 \leq 4.2 \cdot 10^{+244} \lor \neg \left(c0 \leq 2.5 \cdot 10^{+265}\right)\right):\\ \;\;\;\;\left(\left(2 \cdot \frac{c0}{2 \cdot w}\right) \cdot \frac{\frac{c0}{w}}{h}\right) \cdot \frac{d \cdot \frac{d}{D}}{D}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (* c0 d) D)))
   (if (<= c0 -3.5e+182)
     (/ (/ (* t_0 t_0) (* w w)) h)
     (if (<= c0 -1.35e+83)
       0.0
       (if (or (<= c0 -3.6e-80)
               (and (not (<= c0 9.8e-87))
                    (or (<= c0 4.2e+244) (not (<= c0 2.5e+265)))))
         (* (* (* 2.0 (/ c0 (* 2.0 w))) (/ (/ c0 w) h)) (/ (* d (/ d D)) D))
         0.0)))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * d) / D;
	double tmp;
	if (c0 <= -3.5e+182) {
		tmp = ((t_0 * t_0) / (w * w)) / h;
	} else if (c0 <= -1.35e+83) {
		tmp = 0.0;
	} else if ((c0 <= -3.6e-80) || (!(c0 <= 9.8e-87) && ((c0 <= 4.2e+244) || !(c0 <= 2.5e+265)))) {
		tmp = ((2.0 * (c0 / (2.0 * w))) * ((c0 / w) / h)) * ((d * (d / D)) / D);
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (c0 * d_1) / d
    if (c0 <= (-3.5d+182)) then
        tmp = ((t_0 * t_0) / (w * w)) / h
    else if (c0 <= (-1.35d+83)) then
        tmp = 0.0d0
    else if ((c0 <= (-3.6d-80)) .or. (.not. (c0 <= 9.8d-87)) .and. (c0 <= 4.2d+244) .or. (.not. (c0 <= 2.5d+265))) then
        tmp = ((2.0d0 * (c0 / (2.0d0 * w))) * ((c0 / w) / h)) * ((d_1 * (d_1 / d)) / 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 t_0 = (c0 * d) / D;
	double tmp;
	if (c0 <= -3.5e+182) {
		tmp = ((t_0 * t_0) / (w * w)) / h;
	} else if (c0 <= -1.35e+83) {
		tmp = 0.0;
	} else if ((c0 <= -3.6e-80) || (!(c0 <= 9.8e-87) && ((c0 <= 4.2e+244) || !(c0 <= 2.5e+265)))) {
		tmp = ((2.0 * (c0 / (2.0 * w))) * ((c0 / w) / h)) * ((d * (d / D)) / D);
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 * d) / D
	tmp = 0
	if c0 <= -3.5e+182:
		tmp = ((t_0 * t_0) / (w * w)) / h
	elif c0 <= -1.35e+83:
		tmp = 0.0
	elif (c0 <= -3.6e-80) or (not (c0 <= 9.8e-87) and ((c0 <= 4.2e+244) or not (c0 <= 2.5e+265))):
		tmp = ((2.0 * (c0 / (2.0 * w))) * ((c0 / w) / h)) * ((d * (d / D)) / D)
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 * d) / D)
	tmp = 0.0
	if (c0 <= -3.5e+182)
		tmp = Float64(Float64(Float64(t_0 * t_0) / Float64(w * w)) / h);
	elseif (c0 <= -1.35e+83)
		tmp = 0.0;
	elseif ((c0 <= -3.6e-80) || (!(c0 <= 9.8e-87) && ((c0 <= 4.2e+244) || !(c0 <= 2.5e+265))))
		tmp = Float64(Float64(Float64(2.0 * Float64(c0 / Float64(2.0 * w))) * Float64(Float64(c0 / w) / h)) * Float64(Float64(d * Float64(d / D)) / D));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (c0 * d) / D;
	tmp = 0.0;
	if (c0 <= -3.5e+182)
		tmp = ((t_0 * t_0) / (w * w)) / h;
	elseif (c0 <= -1.35e+83)
		tmp = 0.0;
	elseif ((c0 <= -3.6e-80) || (~((c0 <= 9.8e-87)) && ((c0 <= 4.2e+244) || ~((c0 <= 2.5e+265)))))
		tmp = ((2.0 * (c0 / (2.0 * w))) * ((c0 / w) / h)) * ((d * (d / D)) / D);
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * d), $MachinePrecision] / D), $MachinePrecision]}, If[LessEqual[c0, -3.5e+182], N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[c0, -1.35e+83], 0.0, If[Or[LessEqual[c0, -3.6e-80], And[N[Not[LessEqual[c0, 9.8e-87]], $MachinePrecision], Or[LessEqual[c0, 4.2e+244], N[Not[LessEqual[c0, 2.5e+265]], $MachinePrecision]]]], N[(N[(N[(2.0 * N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision] * N[(N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], 0.0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0 \cdot d}{D}\\
\mathbf{if}\;c0 \leq -3.5 \cdot 10^{+182}:\\
\;\;\;\;\frac{\frac{t_0 \cdot t_0}{w \cdot w}}{h}\\

\mathbf{elif}\;c0 \leq -1.35 \cdot 10^{+83}:\\
\;\;\;\;0\\

\mathbf{elif}\;c0 \leq -3.6 \cdot 10^{-80} \lor \neg \left(c0 \leq 9.8 \cdot 10^{-87}\right) \land \left(c0 \leq 4.2 \cdot 10^{+244} \lor \neg \left(c0 \leq 2.5 \cdot 10^{+265}\right)\right):\\
\;\;\;\;\left(\left(2 \cdot \frac{c0}{2 \cdot w}\right) \cdot \frac{\frac{c0}{w}}{h}\right) \cdot \frac{d \cdot \frac{d}{D}}{D}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c0 < -3.50000000000000023e182

    1. Initial program 24.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. Simplified24.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 35.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. unpow235.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D}}{w \cdot w}}{h}} \]

    if -3.50000000000000023e182 < c0 < -1.35000000000000003e83 or -3.6e-80 < c0 < 9.7999999999999994e-87 or 4.2000000000000002e244 < c0 < 2.5000000000000001e265

    1. Initial program 20.1%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified21.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 5.9%

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

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

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

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

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

    if -1.35000000000000003e83 < c0 < -3.6e-80 or 9.7999999999999994e-87 < c0 < 4.2000000000000002e244 or 2.5000000000000001e265 < c0

    1. Initial program 33.1%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified35.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 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. unpow236.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -3.5 \cdot 10^{+182}:\\ \;\;\;\;\frac{\frac{\frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D}}{w \cdot w}}{h}\\ \mathbf{elif}\;c0 \leq -1.35 \cdot 10^{+83}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \leq -3.6 \cdot 10^{-80} \lor \neg \left(c0 \leq 9.8 \cdot 10^{-87}\right) \land \left(c0 \leq 4.2 \cdot 10^{+244} \lor \neg \left(c0 \leq 2.5 \cdot 10^{+265}\right)\right):\\ \;\;\;\;\left(\left(2 \cdot \frac{c0}{2 \cdot w}\right) \cdot \frac{\frac{c0}{w}}{h}\right) \cdot \frac{d \cdot \frac{d}{D}}{D}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 3: 41.9% accurate, 4.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0 \cdot d}{D}\\ t_1 := \frac{c0}{2 \cdot w}\\ \mathbf{if}\;c0 \leq -9.8 \cdot 10^{+182}:\\ \;\;\;\;\frac{\frac{t_0 \cdot t_0}{w \cdot w}}{h}\\ \mathbf{elif}\;c0 \leq -5.5 \cdot 10^{+83}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \leq -1.6 \cdot 10^{-72}:\\ \;\;\;\;\left(\left(2 \cdot t_1\right) \cdot \frac{\frac{c0}{w}}{h}\right) \cdot \frac{d \cdot \frac{d}{D}}{D}\\ \mathbf{elif}\;c0 \leq 9.5 \cdot 10^{-86}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \leq 3.8 \cdot 10^{+245} \lor \neg \left(c0 \leq 2.15 \cdot 10^{+266}\right):\\ \;\;\;\;t_1 \cdot \left(2 \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (* c0 d) D)) (t_1 (/ c0 (* 2.0 w))))
   (if (<= c0 -9.8e+182)
     (/ (/ (* t_0 t_0) (* w w)) h)
     (if (<= c0 -5.5e+83)
       0.0
       (if (<= c0 -1.6e-72)
         (* (* (* 2.0 t_1) (/ (/ c0 w) h)) (/ (* d (/ d D)) D))
         (if (<= c0 9.5e-86)
           0.0
           (if (or (<= c0 3.8e+245) (not (<= c0 2.15e+266)))
             (* t_1 (* 2.0 (* (/ (/ c0 h) w) (* (/ d D) (/ d D)))))
             0.0)))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * d) / D;
	double t_1 = c0 / (2.0 * w);
	double tmp;
	if (c0 <= -9.8e+182) {
		tmp = ((t_0 * t_0) / (w * w)) / h;
	} else if (c0 <= -5.5e+83) {
		tmp = 0.0;
	} else if (c0 <= -1.6e-72) {
		tmp = ((2.0 * t_1) * ((c0 / w) / h)) * ((d * (d / D)) / D);
	} else if (c0 <= 9.5e-86) {
		tmp = 0.0;
	} else if ((c0 <= 3.8e+245) || !(c0 <= 2.15e+266)) {
		tmp = t_1 * (2.0 * (((c0 / h) / w) * ((d / D) * (d / D))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (c0 * d_1) / d
    t_1 = c0 / (2.0d0 * w)
    if (c0 <= (-9.8d+182)) then
        tmp = ((t_0 * t_0) / (w * w)) / h
    else if (c0 <= (-5.5d+83)) then
        tmp = 0.0d0
    else if (c0 <= (-1.6d-72)) then
        tmp = ((2.0d0 * t_1) * ((c0 / w) / h)) * ((d_1 * (d_1 / d)) / d)
    else if (c0 <= 9.5d-86) then
        tmp = 0.0d0
    else if ((c0 <= 3.8d+245) .or. (.not. (c0 <= 2.15d+266))) then
        tmp = t_1 * (2.0d0 * (((c0 / h) / w) * ((d_1 / d) * (d_1 / d))))
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * d) / D;
	double t_1 = c0 / (2.0 * w);
	double tmp;
	if (c0 <= -9.8e+182) {
		tmp = ((t_0 * t_0) / (w * w)) / h;
	} else if (c0 <= -5.5e+83) {
		tmp = 0.0;
	} else if (c0 <= -1.6e-72) {
		tmp = ((2.0 * t_1) * ((c0 / w) / h)) * ((d * (d / D)) / D);
	} else if (c0 <= 9.5e-86) {
		tmp = 0.0;
	} else if ((c0 <= 3.8e+245) || !(c0 <= 2.15e+266)) {
		tmp = t_1 * (2.0 * (((c0 / h) / w) * ((d / D) * (d / D))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 * d) / D
	t_1 = c0 / (2.0 * w)
	tmp = 0
	if c0 <= -9.8e+182:
		tmp = ((t_0 * t_0) / (w * w)) / h
	elif c0 <= -5.5e+83:
		tmp = 0.0
	elif c0 <= -1.6e-72:
		tmp = ((2.0 * t_1) * ((c0 / w) / h)) * ((d * (d / D)) / D)
	elif c0 <= 9.5e-86:
		tmp = 0.0
	elif (c0 <= 3.8e+245) or not (c0 <= 2.15e+266):
		tmp = t_1 * (2.0 * (((c0 / h) / w) * ((d / D) * (d / D))))
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 * d) / D)
	t_1 = Float64(c0 / Float64(2.0 * w))
	tmp = 0.0
	if (c0 <= -9.8e+182)
		tmp = Float64(Float64(Float64(t_0 * t_0) / Float64(w * w)) / h);
	elseif (c0 <= -5.5e+83)
		tmp = 0.0;
	elseif (c0 <= -1.6e-72)
		tmp = Float64(Float64(Float64(2.0 * t_1) * Float64(Float64(c0 / w) / h)) * Float64(Float64(d * Float64(d / D)) / D));
	elseif (c0 <= 9.5e-86)
		tmp = 0.0;
	elseif ((c0 <= 3.8e+245) || !(c0 <= 2.15e+266))
		tmp = Float64(t_1 * Float64(2.0 * Float64(Float64(Float64(c0 / h) / w) * Float64(Float64(d / D) * Float64(d / D)))));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (c0 * d) / D;
	t_1 = c0 / (2.0 * w);
	tmp = 0.0;
	if (c0 <= -9.8e+182)
		tmp = ((t_0 * t_0) / (w * w)) / h;
	elseif (c0 <= -5.5e+83)
		tmp = 0.0;
	elseif (c0 <= -1.6e-72)
		tmp = ((2.0 * t_1) * ((c0 / w) / h)) * ((d * (d / D)) / D);
	elseif (c0 <= 9.5e-86)
		tmp = 0.0;
	elseif ((c0 <= 3.8e+245) || ~((c0 <= 2.15e+266)))
		tmp = t_1 * (2.0 * (((c0 / h) / w) * ((d / D) * (d / D))));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * d), $MachinePrecision] / D), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -9.8e+182], N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[c0, -5.5e+83], 0.0, If[LessEqual[c0, -1.6e-72], N[(N[(N[(2.0 * t$95$1), $MachinePrecision] * N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision] * N[(N[(d * N[(d / D), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 9.5e-86], 0.0, If[Or[LessEqual[c0, 3.8e+245], N[Not[LessEqual[c0, 2.15e+266]], $MachinePrecision]], N[(t$95$1 * N[(2.0 * N[(N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0 \cdot d}{D}\\
t_1 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;c0 \leq -9.8 \cdot 10^{+182}:\\
\;\;\;\;\frac{\frac{t_0 \cdot t_0}{w \cdot w}}{h}\\

\mathbf{elif}\;c0 \leq -5.5 \cdot 10^{+83}:\\
\;\;\;\;0\\

\mathbf{elif}\;c0 \leq -1.6 \cdot 10^{-72}:\\
\;\;\;\;\left(\left(2 \cdot t_1\right) \cdot \frac{\frac{c0}{w}}{h}\right) \cdot \frac{d \cdot \frac{d}{D}}{D}\\

\mathbf{elif}\;c0 \leq 9.5 \cdot 10^{-86}:\\
\;\;\;\;0\\

\mathbf{elif}\;c0 \leq 3.8 \cdot 10^{+245} \lor \neg \left(c0 \leq 2.15 \cdot 10^{+266}\right):\\
\;\;\;\;t_1 \cdot \left(2 \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c0 < -9.7999999999999999e182

    1. Initial program 24.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. Simplified24.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 35.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. unpow235.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D}}{w \cdot w}}{h}} \]

    if -9.7999999999999999e182 < c0 < -5.4999999999999996e83 or -1.6e-72 < c0 < 9.4999999999999996e-86 or 3.8e245 < c0 < 2.1500000000000001e266

    1. Initial program 20.1%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified21.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 5.9%

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

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

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

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

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

    if -5.4999999999999996e83 < c0 < -1.6e-72

    1. Initial program 39.1%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. 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 43.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. unpow243.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.4999999999999996e-86 < c0 < 3.8e245 or 2.1500000000000001e266 < c0

    1. Initial program 31.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. Simplified34.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 34.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \left(\frac{\frac{c0}{h}}{w} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)} \]
    6. Step-by-step derivation
      1. pow248.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-rr49.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -9.8 \cdot 10^{+182}:\\ \;\;\;\;\frac{\frac{\frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D}}{w \cdot w}}{h}\\ \mathbf{elif}\;c0 \leq -5.5 \cdot 10^{+83}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \leq -1.6 \cdot 10^{-72}:\\ \;\;\;\;\left(\left(2 \cdot \frac{c0}{2 \cdot w}\right) \cdot \frac{\frac{c0}{w}}{h}\right) \cdot \frac{d \cdot \frac{d}{D}}{D}\\ \mathbf{elif}\;c0 \leq 9.5 \cdot 10^{-86}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \leq 3.8 \cdot 10^{+245} \lor \neg \left(c0 \leq 2.15 \cdot 10^{+266}\right):\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 4: 41.8% accurate, 4.5× speedup?

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

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

\mathbf{elif}\;c0 \leq -5.2 \cdot 10^{+82}:\\
\;\;\;\;0\\

\mathbf{elif}\;c0 \leq -1.75 \cdot 10^{-78}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;c0 \leq 5.8 \cdot 10^{-87}:\\
\;\;\;\;0\\

\mathbf{elif}\;c0 \leq 2.65 \cdot 10^{+246}:\\
\;\;\;\;t_1 \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 5.5 \cdot 10^{+265}:\\
\;\;\;\;0\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c0 < -1.25000000000000002e183

    1. Initial program 24.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. Simplified24.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 35.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. unpow235.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D}}{w \cdot w}}{h}} \]

    if -1.25000000000000002e183 < c0 < -5.1999999999999997e82 or -1.75e-78 < c0 < 5.7999999999999998e-87 or 2.64999999999999988e246 < c0 < 5.4999999999999997e265

    1. Initial program 20.1%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified21.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 5.9%

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

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

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

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

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

    if -5.1999999999999997e82 < c0 < -1.75e-78 or 5.4999999999999997e265 < c0

    1. Initial program 40.3%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified40.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 43.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.7999999999999998e-87 < c0 < 2.64999999999999988e246

    1. Initial program 29.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. Simplified33.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 33.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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) \]
    8. Applied egg-rr46.5%

      \[\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 4 regimes into one program.
  4. Final simplification53.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -1.25 \cdot 10^{+183}:\\ \;\;\;\;\frac{\frac{\frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D}}{w \cdot w}}{h}\\ \mathbf{elif}\;c0 \leq -5.2 \cdot 10^{+82}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \leq -1.75 \cdot 10^{-78}:\\ \;\;\;\;\left(\left(2 \cdot \frac{c0}{2 \cdot w}\right) \cdot \frac{\frac{c0}{w}}{h}\right) \cdot \frac{d \cdot \frac{d}{D}}{D}\\ \mathbf{elif}\;c0 \leq 5.8 \cdot 10^{-87}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \leq 2.65 \cdot 10^{+246}:\\ \;\;\;\;\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 5.5 \cdot 10^{+265}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(\left(2 \cdot \frac{c0}{2 \cdot w}\right) \cdot \frac{\frac{c0}{w}}{h}\right) \cdot \frac{d \cdot \frac{d}{D}}{D}\\ \end{array} \]

Alternative 5: 42.7% accurate, 4.5× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{c0 \cdot d}{D}\\
t_1 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;c0 \leq -3.5 \cdot 10^{+182}:\\
\;\;\;\;\frac{\frac{t_0 \cdot t_0}{w \cdot w}}{h}\\

\mathbf{elif}\;c0 \leq -8 \cdot 10^{+82}:\\
\;\;\;\;0\\

\mathbf{elif}\;c0 \leq -6.3 \cdot 10^{-75}:\\
\;\;\;\;\left(\left(2 \cdot t_1\right) \cdot \frac{\frac{c0}{w}}{h}\right) \cdot \frac{d \cdot \frac{d}{D}}{D}\\

\mathbf{elif}\;c0 \leq 6 \cdot 10^{-97}:\\
\;\;\;\;0\\

\mathbf{elif}\;c0 \leq 1.25 \cdot 10^{+246}:\\
\;\;\;\;t_1 \cdot \frac{c0 \cdot 2}{\frac{D}{d} \cdot \frac{h \cdot D}{\frac{d}{w}}}\\

\mathbf{elif}\;c0 \leq 2.15 \cdot 10^{+266}:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if c0 < -3.50000000000000023e182

    1. Initial program 24.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. Simplified24.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 35.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. unpow235.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D}}{w \cdot w}}{h}} \]

    if -3.50000000000000023e182 < c0 < -7.9999999999999997e82 or -6.29999999999999983e-75 < c0 < 6.00000000000000048e-97 or 1.24999999999999994e246 < c0 < 2.1500000000000001e266

    1. Initial program 19.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. Simplified20.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 6.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-neg6.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-in6.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. Simplified49.7%

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

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

    if -7.9999999999999997e82 < c0 < -6.29999999999999983e-75

    1. Initial program 39.1%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. 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 43.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. unpow243.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.00000000000000048e-97 < c0 < 1.24999999999999994e246

    1. Initial program 29.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. Simplified39.6%

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

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

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

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

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

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

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

      \[\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)} \]
    8. Step-by-step derivation
      1. *-commutative33.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.1500000000000001e266 < c0

    1. Initial program 44.4%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified44.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 44.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -3.5 \cdot 10^{+182}:\\ \;\;\;\;\frac{\frac{\frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D}}{w \cdot w}}{h}\\ \mathbf{elif}\;c0 \leq -8 \cdot 10^{+82}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \leq -6.3 \cdot 10^{-75}:\\ \;\;\;\;\left(\left(2 \cdot \frac{c0}{2 \cdot w}\right) \cdot \frac{\frac{c0}{w}}{h}\right) \cdot \frac{d \cdot \frac{d}{D}}{D}\\ \mathbf{elif}\;c0 \leq 6 \cdot 10^{-97}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \leq 1.25 \cdot 10^{+246}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{c0 \cdot 2}{\frac{D}{d} \cdot \frac{h \cdot D}{\frac{d}{w}}}\\ \mathbf{elif}\;c0 \leq 2.15 \cdot 10^{+266}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right)\right)\\ \end{array} \]

Alternative 6: 38.2% accurate, 4.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0 \cdot d}{D}\\ t_1 := \frac{\frac{t_0 \cdot t_0}{w \cdot w}}{h}\\ \mathbf{if}\;M \leq 4.1 \cdot 10^{-184}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.35 \cdot 10^{-110}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;M \leq 1.9 \cdot 10^{-71}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.2 \cdot 10^{-54}:\\ \;\;\;\;\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{h} \cdot \frac{d}{w \cdot w}\right)\\ \mathbf{elif}\;M \leq 5.8 \cdot 10^{-13}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 3.7 \cdot 10^{+36} \lor \neg \left(M \leq 3.8 \cdot 10^{+66}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (* c0 d) D)) (t_1 (/ (/ (* t_0 t_0) (* w w)) h)))
   (if (<= M 4.1e-184)
     0.0
     (if (<= M 2.35e-110)
       t_1
       (if (<= M 1.9e-71)
         0.0
         (if (<= M 2.2e-54)
           (* (* (/ c0 D) (/ c0 D)) (* (/ d h) (/ d (* w w))))
           (if (<= M 5.8e-13)
             0.0
             (if (or (<= M 3.7e+36) (not (<= M 3.8e+66))) t_1 0.0))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * d) / D;
	double t_1 = ((t_0 * t_0) / (w * w)) / h;
	double tmp;
	if (M <= 4.1e-184) {
		tmp = 0.0;
	} else if (M <= 2.35e-110) {
		tmp = t_1;
	} else if (M <= 1.9e-71) {
		tmp = 0.0;
	} else if (M <= 2.2e-54) {
		tmp = ((c0 / D) * (c0 / D)) * ((d / h) * (d / (w * w)));
	} else if (M <= 5.8e-13) {
		tmp = 0.0;
	} else if ((M <= 3.7e+36) || !(M <= 3.8e+66)) {
		tmp = t_1;
	} 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) :: t_1
    real(8) :: tmp
    t_0 = (c0 * d_1) / d
    t_1 = ((t_0 * t_0) / (w * w)) / h
    if (m <= 4.1d-184) then
        tmp = 0.0d0
    else if (m <= 2.35d-110) then
        tmp = t_1
    else if (m <= 1.9d-71) then
        tmp = 0.0d0
    else if (m <= 2.2d-54) then
        tmp = ((c0 / d) * (c0 / d)) * ((d_1 / h) * (d_1 / (w * w)))
    else if (m <= 5.8d-13) then
        tmp = 0.0d0
    else if ((m <= 3.7d+36) .or. (.not. (m <= 3.8d+66))) then
        tmp = t_1
    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 * d) / D;
	double t_1 = ((t_0 * t_0) / (w * w)) / h;
	double tmp;
	if (M <= 4.1e-184) {
		tmp = 0.0;
	} else if (M <= 2.35e-110) {
		tmp = t_1;
	} else if (M <= 1.9e-71) {
		tmp = 0.0;
	} else if (M <= 2.2e-54) {
		tmp = ((c0 / D) * (c0 / D)) * ((d / h) * (d / (w * w)));
	} else if (M <= 5.8e-13) {
		tmp = 0.0;
	} else if ((M <= 3.7e+36) || !(M <= 3.8e+66)) {
		tmp = t_1;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 * d) / D
	t_1 = ((t_0 * t_0) / (w * w)) / h
	tmp = 0
	if M <= 4.1e-184:
		tmp = 0.0
	elif M <= 2.35e-110:
		tmp = t_1
	elif M <= 1.9e-71:
		tmp = 0.0
	elif M <= 2.2e-54:
		tmp = ((c0 / D) * (c0 / D)) * ((d / h) * (d / (w * w)))
	elif M <= 5.8e-13:
		tmp = 0.0
	elif (M <= 3.7e+36) or not (M <= 3.8e+66):
		tmp = t_1
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 * d) / D)
	t_1 = Float64(Float64(Float64(t_0 * t_0) / Float64(w * w)) / h)
	tmp = 0.0
	if (M <= 4.1e-184)
		tmp = 0.0;
	elseif (M <= 2.35e-110)
		tmp = t_1;
	elseif (M <= 1.9e-71)
		tmp = 0.0;
	elseif (M <= 2.2e-54)
		tmp = Float64(Float64(Float64(c0 / D) * Float64(c0 / D)) * Float64(Float64(d / h) * Float64(d / Float64(w * w))));
	elseif (M <= 5.8e-13)
		tmp = 0.0;
	elseif ((M <= 3.7e+36) || !(M <= 3.8e+66))
		tmp = t_1;
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (c0 * d) / D;
	t_1 = ((t_0 * t_0) / (w * w)) / h;
	tmp = 0.0;
	if (M <= 4.1e-184)
		tmp = 0.0;
	elseif (M <= 2.35e-110)
		tmp = t_1;
	elseif (M <= 1.9e-71)
		tmp = 0.0;
	elseif (M <= 2.2e-54)
		tmp = ((c0 / D) * (c0 / D)) * ((d / h) * (d / (w * w)));
	elseif (M <= 5.8e-13)
		tmp = 0.0;
	elseif ((M <= 3.7e+36) || ~((M <= 3.8e+66)))
		tmp = t_1;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * d), $MachinePrecision] / D), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[M, 4.1e-184], 0.0, If[LessEqual[M, 2.35e-110], t$95$1, If[LessEqual[M, 1.9e-71], 0.0, If[LessEqual[M, 2.2e-54], N[(N[(N[(c0 / D), $MachinePrecision] * N[(c0 / D), $MachinePrecision]), $MachinePrecision] * N[(N[(d / h), $MachinePrecision] * N[(d / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 5.8e-13], 0.0, If[Or[LessEqual[M, 3.7e+36], N[Not[LessEqual[M, 3.8e+66]], $MachinePrecision]], t$95$1, 0.0]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0 \cdot d}{D}\\
t_1 := \frac{\frac{t_0 \cdot t_0}{w \cdot w}}{h}\\
\mathbf{if}\;M \leq 4.1 \cdot 10^{-184}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 2.35 \cdot 10^{-110}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;M \leq 1.9 \cdot 10^{-71}:\\
\;\;\;\;0\\

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

\mathbf{elif}\;M \leq 5.8 \cdot 10^{-13}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 3.7 \cdot 10^{+36} \lor \neg \left(M \leq 3.8 \cdot 10^{+66}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 4.1e-184 or 2.34999999999999996e-110 < M < 1.89999999999999996e-71 or 2.2e-54 < M < 5.7999999999999995e-13 or 3.70000000000000029e36 < M < 3.8000000000000002e66

    1. Initial program 26.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. Simplified26.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 6.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-neg6.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-in4.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. Simplified37.1%

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

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

    if 4.1e-184 < M < 2.34999999999999996e-110 or 5.7999999999999995e-13 < M < 3.70000000000000029e36 or 3.8000000000000002e66 < M

    1. Initial program 27.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. Simplified30.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 29.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. unpow229.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{\frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D}}{w \cdot w}}{h}} \]

    if 1.89999999999999996e-71 < M < 2.2e-54

    1. Initial program 66.1%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified66.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 67.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot c0}{D \cdot D} \cdot \frac{d \cdot d}{h \cdot \color{blue}{\left(w \cdot w\right)}} \]
    8. Simplified67.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. times-frac67.4%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 4.1 \cdot 10^{-184}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.35 \cdot 10^{-110}:\\ \;\;\;\;\frac{\frac{\frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D}}{w \cdot w}}{h}\\ \mathbf{elif}\;M \leq 1.9 \cdot 10^{-71}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.2 \cdot 10^{-54}:\\ \;\;\;\;\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{h} \cdot \frac{d}{w \cdot w}\right)\\ \mathbf{elif}\;M \leq 5.8 \cdot 10^{-13}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 3.7 \cdot 10^{+36} \lor \neg \left(M \leq 3.8 \cdot 10^{+66}\right):\\ \;\;\;\;\frac{\frac{\frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D}}{w \cdot w}}{h}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 7: 42.2% accurate, 6.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;w \leq -2.9 \cdot 10^{+149}:\\
\;\;\;\;0\\

\mathbf{elif}\;w \leq -1.25 \cdot 10^{-134} \lor \neg \left(w \leq -6.2 \cdot 10^{-180}\right) \land w \leq 1.2 \cdot 10^{+51}:\\
\;\;\;\;\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{h} \cdot \frac{d}{w \cdot w}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < -2.9000000000000002e149 or -1.2500000000000001e-134 < w < -6.1999999999999998e-180 or 1.1999999999999999e51 < w

    1. Initial program 17.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.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 7.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-neg7.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-in7.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. Simplified47.8%

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

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

    if -2.9000000000000002e149 < w < -1.2500000000000001e-134 or -6.1999999999999998e-180 < w < 1.1999999999999999e51

    1. Initial program 31.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. Simplified32.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 35.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. times-frac37.2%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -2.9 \cdot 10^{+149}:\\ \;\;\;\;0\\ \mathbf{elif}\;w \leq -1.25 \cdot 10^{-134} \lor \neg \left(w \leq -6.2 \cdot 10^{-180}\right) \land w \leq 1.2 \cdot 10^{+51}:\\ \;\;\;\;\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{h} \cdot \frac{d}{w \cdot w}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 8: 33.7% accurate, 151.0× speedup?

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

\\
0
\end{array}
Derivation
  1. Initial program 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. Simplified28.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 5.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-neg5.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-in3.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. Simplified32.5%

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

    \[\leadsto \color{blue}{0} \]
  7. Final simplification35.5%

    \[\leadsto 0 \]

Reproduce

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