Henrywood and Agarwal, Equation (13)

Percentage Accurate: 25.0% → 64.9%
Time: 36.1s
Alternatives: 9
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 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 25.0% 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: 64.9% accurate, 0.6× 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(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \mathbf{if}\;t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right) \leq \infty:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \frac{d}{h \cdot \left(w \cdot D\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{M \cdot \left(h \cdot M\right)}{{\left(\frac{d}{D}\right)}^{2}}\\ \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)) (* (* w h) (* D D)))))
   (if (<= (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M))))) INFINITY)
     (* t_0 (* 2.0 (* (/ (* c0 d) D) (/ d (* h (* w D))))))
     (* 0.25 (/ (* M (* h M)) (pow (/ d D) 2.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)) / ((w * h) * (D * D));
	double tmp;
	if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= ((double) INFINITY)) {
		tmp = t_0 * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))));
	} else {
		tmp = 0.25 * ((M * (h * M)) / pow((d / D), 2.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)) / ((w * h) * (D * D));
	double tmp;
	if ((t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))))) <= Double.POSITIVE_INFINITY) {
		tmp = t_0 * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))));
	} else {
		tmp = 0.25 * ((M * (h * M)) / Math.pow((d / D), 2.0));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = c0 / (2.0 * w)
	t_1 = (c0 * (d * d)) / ((w * h) * (D * D))
	tmp = 0
	if (t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))) <= math.inf:
		tmp = t_0 * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))))
	else:
		tmp = 0.25 * ((M * (h * M)) / math.pow((d / D), 2.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(w * h) * Float64(D * D)))
	tmp = 0.0
	if (Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= Inf)
		tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(c0 * d) / D) * Float64(d / Float64(h * Float64(w * D))))));
	else
		tmp = Float64(0.25 * Float64(Float64(M * Float64(h * M)) / (Float64(d / D) ^ 2.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)) / ((w * h) * (D * D));
	tmp = 0.0;
	if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= Inf)
		tmp = t_0 * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))));
	else
		tmp = 0.25 * ((M * (h * M)) / ((d / D) ^ 2.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[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 * N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] / D), $MachinePrecision] * N[(d / N[(h * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] / N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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


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

    1. Initial program 73.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. Simplified74.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 74.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. unpow274.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. *-commutative74.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/75.2%

        \[\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. associate-*r*76.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \color{blue}{\sqrt[3]{\frac{\frac{d}{D}}{h \cdot w} \cdot \left(\frac{\frac{d}{D}}{h \cdot w} \cdot \frac{\frac{d}{D}}{h \cdot w}\right)}}\right)\right) \]
    10. Taylor expanded in d around 0 79.9%

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

      \[\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. Step-by-step derivation
      1. flip-+0.1%

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \frac{{M}^{2}}{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)} \]
    8. Step-by-step derivation
      1. mul-1-neg25.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-\frac{{M}^{2}}{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. associate-/r*25.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(-\color{blue}{\frac{\frac{{M}^{2}}{c0}}{-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) \]
      3. distribute-neg-frac25.4%

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{M}^{2} \cdot h}{\frac{{d}^{2}}{{D}^{2}}}} \]
      3. *-commutative40.1%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{h \cdot {M}^{2}}}{\frac{{d}^{2}}{{D}^{2}}} \]
      4. unpow240.1%

        \[\leadsto 0.25 \cdot \frac{h \cdot \color{blue}{\left(M \cdot M\right)}}{\frac{{d}^{2}}{{D}^{2}}} \]
      5. associate-*r*40.7%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{\left(h \cdot M\right) \cdot M}}{\frac{{d}^{2}}{{D}^{2}}} \]
      6. unpow240.7%

        \[\leadsto 0.25 \cdot \frac{\left(h \cdot M\right) \cdot M}{\frac{\color{blue}{d \cdot d}}{{D}^{2}}} \]
      7. unpow240.7%

        \[\leadsto 0.25 \cdot \frac{\left(h \cdot M\right) \cdot M}{\frac{d \cdot d}{\color{blue}{D \cdot D}}} \]
      8. times-frac58.3%

        \[\leadsto 0.25 \cdot \frac{\left(h \cdot M\right) \cdot M}{\color{blue}{\frac{d}{D} \cdot \frac{d}{D}}} \]
      9. unpow258.3%

        \[\leadsto 0.25 \cdot \frac{\left(h \cdot M\right) \cdot M}{\color{blue}{{\left(\frac{d}{D}\right)}^{2}}} \]
    12. Simplified58.3%

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

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

Alternative 2: 41.8% accurate, 4.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ t_1 := t_0 \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \frac{d}{h \cdot \left(w \cdot D\right)}\right)\right)\\ t_2 := 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \mathbf{if}\;h \leq -2.9 \cdot 10^{-290}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;h \leq 4 \cdot 10^{-295}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;h \leq 1.7 \cdot 10^{-154}:\\ \;\;\;\;\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{w} \cdot \frac{\frac{d}{w}}{h}\right)\\ \mathbf{elif}\;h \leq 2.8 \cdot 10^{+35}:\\ \;\;\;\;0\\ \mathbf{elif}\;h \leq 1.01 \cdot 10^{+180}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;h \leq 2.55 \cdot 10^{+210}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \left(\frac{\frac{d}{D}}{w \cdot h} \cdot \left(d \cdot \frac{c0}{D}\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ c0 (* 2.0 w)))
        (t_1 (* t_0 (* 2.0 (* (/ (* c0 d) D) (/ d (* h (* w D)))))))
        (t_2 (* 0.25 (/ (* D D) (/ (* d d) (* h (* M M)))))))
   (if (<= h -2.9e-290)
     t_1
     (if (<= h 4e-295)
       t_2
       (if (<= h 1.7e-154)
         (* (* (/ c0 D) (/ c0 D)) (* (/ d w) (/ (/ d w) h)))
         (if (<= h 2.8e+35)
           0.0
           (if (<= h 1.01e+180)
             t_1
             (if (<= h 2.55e+210)
               t_2
               (* t_0 (* 2.0 (* (/ (/ d D) (* w h)) (* d (/ c0 D)))))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (2.0 * w);
	double t_1 = t_0 * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))));
	double t_2 = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	double tmp;
	if (h <= -2.9e-290) {
		tmp = t_1;
	} else if (h <= 4e-295) {
		tmp = t_2;
	} else if (h <= 1.7e-154) {
		tmp = ((c0 / D) * (c0 / D)) * ((d / w) * ((d / w) / h));
	} else if (h <= 2.8e+35) {
		tmp = 0.0;
	} else if (h <= 1.01e+180) {
		tmp = t_1;
	} else if (h <= 2.55e+210) {
		tmp = t_2;
	} else {
		tmp = t_0 * (2.0 * (((d / D) / (w * h)) * (d * (c0 / 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) :: t_2
    real(8) :: tmp
    t_0 = c0 / (2.0d0 * w)
    t_1 = t_0 * (2.0d0 * (((c0 * d_1) / d) * (d_1 / (h * (w * d)))))
    t_2 = 0.25d0 * ((d * d) / ((d_1 * d_1) / (h * (m * m))))
    if (h <= (-2.9d-290)) then
        tmp = t_1
    else if (h <= 4d-295) then
        tmp = t_2
    else if (h <= 1.7d-154) then
        tmp = ((c0 / d) * (c0 / d)) * ((d_1 / w) * ((d_1 / w) / h))
    else if (h <= 2.8d+35) then
        tmp = 0.0d0
    else if (h <= 1.01d+180) then
        tmp = t_1
    else if (h <= 2.55d+210) then
        tmp = t_2
    else
        tmp = t_0 * (2.0d0 * (((d_1 / d) / (w * h)) * (d_1 * (c0 / d))))
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (2.0 * w);
	double t_1 = t_0 * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))));
	double t_2 = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	double tmp;
	if (h <= -2.9e-290) {
		tmp = t_1;
	} else if (h <= 4e-295) {
		tmp = t_2;
	} else if (h <= 1.7e-154) {
		tmp = ((c0 / D) * (c0 / D)) * ((d / w) * ((d / w) / h));
	} else if (h <= 2.8e+35) {
		tmp = 0.0;
	} else if (h <= 1.01e+180) {
		tmp = t_1;
	} else if (h <= 2.55e+210) {
		tmp = t_2;
	} else {
		tmp = t_0 * (2.0 * (((d / D) / (w * h)) * (d * (c0 / D))));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = c0 / (2.0 * w)
	t_1 = t_0 * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))))
	t_2 = 0.25 * ((D * D) / ((d * d) / (h * (M * M))))
	tmp = 0
	if h <= -2.9e-290:
		tmp = t_1
	elif h <= 4e-295:
		tmp = t_2
	elif h <= 1.7e-154:
		tmp = ((c0 / D) * (c0 / D)) * ((d / w) * ((d / w) / h))
	elif h <= 2.8e+35:
		tmp = 0.0
	elif h <= 1.01e+180:
		tmp = t_1
	elif h <= 2.55e+210:
		tmp = t_2
	else:
		tmp = t_0 * (2.0 * (((d / D) / (w * h)) * (d * (c0 / D))))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(c0 / Float64(2.0 * w))
	t_1 = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(c0 * d) / D) * Float64(d / Float64(h * Float64(w * D))))))
	t_2 = Float64(0.25 * Float64(Float64(D * D) / Float64(Float64(d * d) / Float64(h * Float64(M * M)))))
	tmp = 0.0
	if (h <= -2.9e-290)
		tmp = t_1;
	elseif (h <= 4e-295)
		tmp = t_2;
	elseif (h <= 1.7e-154)
		tmp = Float64(Float64(Float64(c0 / D) * Float64(c0 / D)) * Float64(Float64(d / w) * Float64(Float64(d / w) / h)));
	elseif (h <= 2.8e+35)
		tmp = 0.0;
	elseif (h <= 1.01e+180)
		tmp = t_1;
	elseif (h <= 2.55e+210)
		tmp = t_2;
	else
		tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(d / D) / Float64(w * h)) * Float64(d * Float64(c0 / D)))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = c0 / (2.0 * w);
	t_1 = t_0 * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))));
	t_2 = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	tmp = 0.0;
	if (h <= -2.9e-290)
		tmp = t_1;
	elseif (h <= 4e-295)
		tmp = t_2;
	elseif (h <= 1.7e-154)
		tmp = ((c0 / D) * (c0 / D)) * ((d / w) * ((d / w) / h));
	elseif (h <= 2.8e+35)
		tmp = 0.0;
	elseif (h <= 1.01e+180)
		tmp = t_1;
	elseif (h <= 2.55e+210)
		tmp = t_2;
	else
		tmp = t_0 * (2.0 * (((d / D) / (w * h)) * (d * (c0 / D))));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] / D), $MachinePrecision] * N[(d / N[(h * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] / N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -2.9e-290], t$95$1, If[LessEqual[h, 4e-295], t$95$2, If[LessEqual[h, 1.7e-154], N[(N[(N[(c0 / D), $MachinePrecision] * N[(c0 / D), $MachinePrecision]), $MachinePrecision] * N[(N[(d / w), $MachinePrecision] * N[(N[(d / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.8e+35], 0.0, If[LessEqual[h, 1.01e+180], t$95$1, If[LessEqual[h, 2.55e+210], t$95$2, N[(t$95$0 * N[(2.0 * N[(N[(N[(d / D), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(d * N[(c0 / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;h \leq 4 \cdot 10^{-295}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;h \leq 2.8 \cdot 10^{+35}:\\
\;\;\;\;0\\

\mathbf{elif}\;h \leq 1.01 \cdot 10^{+180}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;h \leq 2.55 \cdot 10^{+210}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if h < -2.89999999999999994e-290 or 2.79999999999999999e35 < h < 1.01000000000000003e180

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

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

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

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

        \[\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/36.2%

        \[\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. associate-*r*40.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \color{blue}{\sqrt[3]{\frac{\frac{d}{D}}{h \cdot w} \cdot \left(\frac{\frac{d}{D}}{h \cdot w} \cdot \frac{\frac{d}{D}}{h \cdot w}\right)}}\right)\right) \]
    10. Taylor expanded in d around 0 53.8%

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

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

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

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

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

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

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

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

    if -2.89999999999999994e-290 < h < 4.00000000000000024e-295 or 1.01000000000000003e180 < h < 2.55e210

    1. Initial program 5.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. Simplified5.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. Step-by-step derivation
      1. flip-+0.0%

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \frac{{M}^{2}}{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)} \]
    8. Step-by-step derivation
      1. mul-1-neg61.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-\frac{{M}^{2}}{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. associate-/r*61.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(-\color{blue}{\frac{\frac{{M}^{2}}{c0}}{-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) \]
      3. distribute-neg-frac61.1%

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. unpow288.8%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2}}{{M}^{2} \cdot h}} \]
      3. unpow288.8%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{\color{blue}{d \cdot d}}{{M}^{2} \cdot h}} \]
      4. *-commutative88.8%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{\color{blue}{h \cdot {M}^{2}}}} \]
      5. unpow288.8%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \color{blue}{\left(M \cdot M\right)}}} \]
    12. Simplified88.8%

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

    if 4.00000000000000024e-295 < h < 1.6999999999999999e-154

    1. Initial program 30.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified33.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 50.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. unpow250.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. *-commutative50.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/50.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. associate-*r*50.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.6999999999999999e-154 < h < 2.79999999999999999e35

    1. Initial program 12.9%

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

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

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

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

    if 2.55e210 < h

    1. Initial program 21.3%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified21.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 32.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. unpow232.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. *-commutative32.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/32.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. associate-*r*32.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -2.9 \cdot 10^{-290}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \frac{d}{h \cdot \left(w \cdot D\right)}\right)\right)\\ \mathbf{elif}\;h \leq 4 \cdot 10^{-295}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \mathbf{elif}\;h \leq 1.7 \cdot 10^{-154}:\\ \;\;\;\;\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{w} \cdot \frac{\frac{d}{w}}{h}\right)\\ \mathbf{elif}\;h \leq 2.8 \cdot 10^{+35}:\\ \;\;\;\;0\\ \mathbf{elif}\;h \leq 1.01 \cdot 10^{+180}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \frac{d}{h \cdot \left(w \cdot D\right)}\right)\right)\\ \mathbf{elif}\;h \leq 2.55 \cdot 10^{+210}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{d}{D}}{w \cdot h} \cdot \left(d \cdot \frac{c0}{D}\right)\right)\right)\\ \end{array} \]

Alternative 3: 41.8% accurate, 4.5× speedup?

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

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

\mathbf{elif}\;h \leq 2.1 \cdot 10^{-295}:\\
\;\;\;\;t_2\\

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

\mathbf{elif}\;h \leq 2.7 \cdot 10^{+34}:\\
\;\;\;\;0\\

\mathbf{elif}\;h \leq 2.9 \cdot 10^{+179}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;h \leq 1.55 \cdot 10^{+212}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if h < -2.60000000000000001e-290 or 2.7e34 < h < 2.90000000000000019e179

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

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

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

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

        \[\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/36.2%

        \[\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. associate-*r*40.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \color{blue}{\sqrt[3]{\frac{\frac{d}{D}}{h \cdot w} \cdot \left(\frac{\frac{d}{D}}{h \cdot w} \cdot \frac{\frac{d}{D}}{h \cdot w}\right)}}\right)\right) \]
    10. Taylor expanded in d around 0 53.8%

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

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

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

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

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

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

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

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

    if -2.60000000000000001e-290 < h < 2.09999999999999993e-295 or 2.90000000000000019e179 < h < 1.54999999999999999e212

    1. Initial program 5.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. Simplified5.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. Step-by-step derivation
      1. flip-+0.0%

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \frac{{M}^{2}}{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)} \]
    8. Step-by-step derivation
      1. mul-1-neg61.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-\frac{{M}^{2}}{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. associate-/r*61.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(-\color{blue}{\frac{\frac{{M}^{2}}{c0}}{-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) \]
      3. distribute-neg-frac61.1%

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. unpow288.8%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2}}{{M}^{2} \cdot h}} \]
      3. unpow288.8%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{\color{blue}{d \cdot d}}{{M}^{2} \cdot h}} \]
      4. *-commutative88.8%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{\color{blue}{h \cdot {M}^{2}}}} \]
      5. unpow288.8%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \color{blue}{\left(M \cdot M\right)}}} \]
    12. Simplified88.8%

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

    if 2.09999999999999993e-295 < h < 2.60000000000000008e-155

    1. Initial program 30.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified33.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 50.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. unpow250.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. *-commutative50.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/50.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. associate-*r*50.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.60000000000000008e-155 < h < 2.7e34

    1. Initial program 12.9%

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

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

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

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

    if 1.54999999999999999e212 < h

    1. Initial program 21.3%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified21.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 32.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. unpow232.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. *-commutative32.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/32.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. associate-*r*32.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -2.6 \cdot 10^{-290}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \frac{d}{h \cdot \left(w \cdot D\right)}\right)\right)\\ \mathbf{elif}\;h \leq 2.1 \cdot 10^{-295}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \mathbf{elif}\;h \leq 2.6 \cdot 10^{-155}:\\ \;\;\;\;\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{w} \cdot \frac{\frac{d}{w}}{h}\right)\\ \mathbf{elif}\;h \leq 2.7 \cdot 10^{+34}:\\ \;\;\;\;0\\ \mathbf{elif}\;h \leq 2.9 \cdot 10^{+179}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \frac{d}{h \cdot \left(w \cdot D\right)}\right)\right)\\ \mathbf{elif}\;h \leq 1.55 \cdot 10^{+212}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\frac{c0}{\frac{D}{d}} \cdot \frac{d}{w \cdot h}}{D}\right)\\ \end{array} \]

Alternative 4: 41.9% accurate, 4.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ t_1 := 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ t_2 := \frac{c0}{\frac{D}{d}}\\ \mathbf{if}\;h \leq -3.8 \cdot 10^{-290}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \frac{d}{h \cdot \left(w \cdot D\right)}\right)\right)\\ \mathbf{elif}\;h \leq 3.6 \cdot 10^{-295}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;h \leq 2.05 \cdot 10^{-155}:\\ \;\;\;\;\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{w} \cdot \frac{\frac{d}{w}}{h}\right)\\ \mathbf{elif}\;h \leq 2.55 \cdot 10^{+33}:\\ \;\;\;\;0\\ \mathbf{elif}\;h \leq 2.2 \cdot 10^{+186}:\\ \;\;\;\;\frac{c0 \cdot \left(2 \cdot \left(\frac{d}{w \cdot \left(h \cdot D\right)} \cdot t_2\right)\right)}{2 \cdot w}\\ \mathbf{elif}\;h \leq 3.4 \cdot 10^{+212}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \frac{t_2 \cdot \frac{d}{w \cdot h}}{D}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ c0 (* 2.0 w)))
        (t_1 (* 0.25 (/ (* D D) (/ (* d d) (* h (* M M))))))
        (t_2 (/ c0 (/ D d))))
   (if (<= h -3.8e-290)
     (* t_0 (* 2.0 (* (/ (* c0 d) D) (/ d (* h (* w D))))))
     (if (<= h 3.6e-295)
       t_1
       (if (<= h 2.05e-155)
         (* (* (/ c0 D) (/ c0 D)) (* (/ d w) (/ (/ d w) h)))
         (if (<= h 2.55e+33)
           0.0
           (if (<= h 2.2e+186)
             (/ (* c0 (* 2.0 (* (/ d (* w (* h D))) t_2))) (* 2.0 w))
             (if (<= h 3.4e+212)
               t_1
               (* t_0 (* 2.0 (/ (* t_2 (/ d (* w h))) D)))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (2.0 * w);
	double t_1 = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	double t_2 = c0 / (D / d);
	double tmp;
	if (h <= -3.8e-290) {
		tmp = t_0 * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))));
	} else if (h <= 3.6e-295) {
		tmp = t_1;
	} else if (h <= 2.05e-155) {
		tmp = ((c0 / D) * (c0 / D)) * ((d / w) * ((d / w) / h));
	} else if (h <= 2.55e+33) {
		tmp = 0.0;
	} else if (h <= 2.2e+186) {
		tmp = (c0 * (2.0 * ((d / (w * (h * D))) * t_2))) / (2.0 * w);
	} else if (h <= 3.4e+212) {
		tmp = t_1;
	} else {
		tmp = t_0 * (2.0 * ((t_2 * (d / (w * h))) / D));
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = c0 / (2.0d0 * w)
    t_1 = 0.25d0 * ((d * d) / ((d_1 * d_1) / (h * (m * m))))
    t_2 = c0 / (d / d_1)
    if (h <= (-3.8d-290)) then
        tmp = t_0 * (2.0d0 * (((c0 * d_1) / d) * (d_1 / (h * (w * d)))))
    else if (h <= 3.6d-295) then
        tmp = t_1
    else if (h <= 2.05d-155) then
        tmp = ((c0 / d) * (c0 / d)) * ((d_1 / w) * ((d_1 / w) / h))
    else if (h <= 2.55d+33) then
        tmp = 0.0d0
    else if (h <= 2.2d+186) then
        tmp = (c0 * (2.0d0 * ((d_1 / (w * (h * d))) * t_2))) / (2.0d0 * w)
    else if (h <= 3.4d+212) then
        tmp = t_1
    else
        tmp = t_0 * (2.0d0 * ((t_2 * (d_1 / (w * h))) / d))
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (2.0 * w);
	double t_1 = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	double t_2 = c0 / (D / d);
	double tmp;
	if (h <= -3.8e-290) {
		tmp = t_0 * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))));
	} else if (h <= 3.6e-295) {
		tmp = t_1;
	} else if (h <= 2.05e-155) {
		tmp = ((c0 / D) * (c0 / D)) * ((d / w) * ((d / w) / h));
	} else if (h <= 2.55e+33) {
		tmp = 0.0;
	} else if (h <= 2.2e+186) {
		tmp = (c0 * (2.0 * ((d / (w * (h * D))) * t_2))) / (2.0 * w);
	} else if (h <= 3.4e+212) {
		tmp = t_1;
	} else {
		tmp = t_0 * (2.0 * ((t_2 * (d / (w * h))) / D));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = c0 / (2.0 * w)
	t_1 = 0.25 * ((D * D) / ((d * d) / (h * (M * M))))
	t_2 = c0 / (D / d)
	tmp = 0
	if h <= -3.8e-290:
		tmp = t_0 * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))))
	elif h <= 3.6e-295:
		tmp = t_1
	elif h <= 2.05e-155:
		tmp = ((c0 / D) * (c0 / D)) * ((d / w) * ((d / w) / h))
	elif h <= 2.55e+33:
		tmp = 0.0
	elif h <= 2.2e+186:
		tmp = (c0 * (2.0 * ((d / (w * (h * D))) * t_2))) / (2.0 * w)
	elif h <= 3.4e+212:
		tmp = t_1
	else:
		tmp = t_0 * (2.0 * ((t_2 * (d / (w * h))) / D))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(c0 / Float64(2.0 * w))
	t_1 = Float64(0.25 * Float64(Float64(D * D) / Float64(Float64(d * d) / Float64(h * Float64(M * M)))))
	t_2 = Float64(c0 / Float64(D / d))
	tmp = 0.0
	if (h <= -3.8e-290)
		tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(Float64(c0 * d) / D) * Float64(d / Float64(h * Float64(w * D))))));
	elseif (h <= 3.6e-295)
		tmp = t_1;
	elseif (h <= 2.05e-155)
		tmp = Float64(Float64(Float64(c0 / D) * Float64(c0 / D)) * Float64(Float64(d / w) * Float64(Float64(d / w) / h)));
	elseif (h <= 2.55e+33)
		tmp = 0.0;
	elseif (h <= 2.2e+186)
		tmp = Float64(Float64(c0 * Float64(2.0 * Float64(Float64(d / Float64(w * Float64(h * D))) * t_2))) / Float64(2.0 * w));
	elseif (h <= 3.4e+212)
		tmp = t_1;
	else
		tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(t_2 * Float64(d / Float64(w * h))) / D)));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = c0 / (2.0 * w);
	t_1 = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	t_2 = c0 / (D / d);
	tmp = 0.0;
	if (h <= -3.8e-290)
		tmp = t_0 * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))));
	elseif (h <= 3.6e-295)
		tmp = t_1;
	elseif (h <= 2.05e-155)
		tmp = ((c0 / D) * (c0 / D)) * ((d / w) * ((d / w) / h));
	elseif (h <= 2.55e+33)
		tmp = 0.0;
	elseif (h <= 2.2e+186)
		tmp = (c0 * (2.0 * ((d / (w * (h * D))) * t_2))) / (2.0 * w);
	elseif (h <= 3.4e+212)
		tmp = t_1;
	else
		tmp = t_0 * (2.0 * ((t_2 * (d / (w * h))) / D));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] / N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(D / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -3.8e-290], N[(t$95$0 * N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] / D), $MachinePrecision] * N[(d / N[(h * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 3.6e-295], t$95$1, If[LessEqual[h, 2.05e-155], N[(N[(N[(c0 / D), $MachinePrecision] * N[(c0 / D), $MachinePrecision]), $MachinePrecision] * N[(N[(d / w), $MachinePrecision] * N[(N[(d / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.55e+33], 0.0, If[LessEqual[h, 2.2e+186], N[(N[(c0 * N[(2.0 * N[(N[(d / N[(w * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 3.4e+212], t$95$1, N[(t$95$0 * N[(2.0 * N[(N[(t$95$2 * N[(d / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;h \leq 3.6 \cdot 10^{-295}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;h \leq 2.55 \cdot 10^{+33}:\\
\;\;\;\;0\\

\mathbf{elif}\;h \leq 2.2 \cdot 10^{+186}:\\
\;\;\;\;\frac{c0 \cdot \left(2 \cdot \left(\frac{d}{w \cdot \left(h \cdot D\right)} \cdot t_2\right)\right)}{2 \cdot w}\\

\mathbf{elif}\;h \leq 3.4 \cdot 10^{+212}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 6 regimes
  2. if h < -3.79999999999999975e-290

    1. Initial program 26.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified28.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.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. unpow234.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. *-commutative34.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/35.5%

        \[\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. associate-*r*40.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \color{blue}{\sqrt[3]{\frac{\frac{d}{D}}{h \cdot w} \cdot \left(\frac{\frac{d}{D}}{h \cdot w} \cdot \frac{\frac{d}{D}}{h \cdot w}\right)}}\right)\right) \]
    10. Taylor expanded in d around 0 54.2%

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

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

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

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

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

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

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

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

    if -3.79999999999999975e-290 < h < 3.6000000000000001e-295 or 2.1999999999999998e186 < h < 3.40000000000000037e212

    1. Initial program 5.9%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \frac{{M}^{2}}{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)} \]
    8. Step-by-step derivation
      1. mul-1-neg64.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-\frac{{M}^{2}}{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. associate-/r*64.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(-\color{blue}{\frac{\frac{{M}^{2}}{c0}}{-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) \]
      3. distribute-neg-frac64.7%

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. unpow294.0%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2}}{{M}^{2} \cdot h}} \]
      3. unpow294.0%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{\color{blue}{d \cdot d}}{{M}^{2} \cdot h}} \]
      4. *-commutative94.0%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{\color{blue}{h \cdot {M}^{2}}}} \]
      5. unpow294.0%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \color{blue}{\left(M \cdot M\right)}}} \]
    12. Simplified94.0%

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

    if 3.6000000000000001e-295 < h < 2.0499999999999999e-155

    1. Initial program 30.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified33.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 50.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. unpow250.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. *-commutative50.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/50.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. associate-*r*50.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.0499999999999999e-155 < h < 2.5499999999999999e33

    1. Initial program 12.9%

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

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

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

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

    if 2.5499999999999999e33 < h < 2.1999999999999998e186

    1. Initial program 25.0%

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

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

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

        \[\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.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. associate-*r*41.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.40000000000000037e212 < h

    1. Initial program 21.3%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified21.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 32.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. unpow232.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. *-commutative32.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/32.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. associate-*r*32.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -3.8 \cdot 10^{-290}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \frac{d}{h \cdot \left(w \cdot D\right)}\right)\right)\\ \mathbf{elif}\;h \leq 3.6 \cdot 10^{-295}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \mathbf{elif}\;h \leq 2.05 \cdot 10^{-155}:\\ \;\;\;\;\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{w} \cdot \frac{\frac{d}{w}}{h}\right)\\ \mathbf{elif}\;h \leq 2.55 \cdot 10^{+33}:\\ \;\;\;\;0\\ \mathbf{elif}\;h \leq 2.2 \cdot 10^{+186}:\\ \;\;\;\;\frac{c0 \cdot \left(2 \cdot \left(\frac{d}{w \cdot \left(h \cdot D\right)} \cdot \frac{c0}{\frac{D}{d}}\right)\right)}{2 \cdot w}\\ \mathbf{elif}\;h \leq 3.4 \cdot 10^{+212}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\frac{c0}{\frac{D}{d}} \cdot \frac{d}{w \cdot h}}{D}\right)\\ \end{array} \]

Alternative 5: 41.9% accurate, 4.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{w} \cdot \frac{\frac{d}{w}}{h}\right)\\ t_1 := \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \frac{d}{h \cdot \left(w \cdot D\right)}\right)\right)\\ t_2 := 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \mathbf{if}\;h \leq -4.8 \cdot 10^{-289}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;h \leq 1.65 \cdot 10^{-294}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;h \leq 3.5 \cdot 10^{-155}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;h \leq 3.9 \cdot 10^{+33}:\\ \;\;\;\;0\\ \mathbf{elif}\;h \leq 2.45 \cdot 10^{+179}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;h \leq 4.6 \cdot 10^{+212}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (* (* (/ c0 D) (/ c0 D)) (* (/ d w) (/ (/ d w) h))))
        (t_1
         (* (/ c0 (* 2.0 w)) (* 2.0 (* (/ (* c0 d) D) (/ d (* h (* w D)))))))
        (t_2 (* 0.25 (/ (* D D) (/ (* d d) (* h (* M M)))))))
   (if (<= h -4.8e-289)
     t_1
     (if (<= h 1.65e-294)
       t_2
       (if (<= h 3.5e-155)
         t_0
         (if (<= h 3.9e+33)
           0.0
           (if (<= h 2.45e+179) t_1 (if (<= h 4.6e+212) t_2 t_0))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = ((c0 / D) * (c0 / D)) * ((d / w) * ((d / w) / h));
	double t_1 = (c0 / (2.0 * w)) * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))));
	double t_2 = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	double tmp;
	if (h <= -4.8e-289) {
		tmp = t_1;
	} else if (h <= 1.65e-294) {
		tmp = t_2;
	} else if (h <= 3.5e-155) {
		tmp = t_0;
	} else if (h <= 3.9e+33) {
		tmp = 0.0;
	} else if (h <= 2.45e+179) {
		tmp = t_1;
	} else if (h <= 4.6e+212) {
		tmp = t_2;
	} else {
		tmp = t_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) :: t_2
    real(8) :: tmp
    t_0 = ((c0 / d) * (c0 / d)) * ((d_1 / w) * ((d_1 / w) / h))
    t_1 = (c0 / (2.0d0 * w)) * (2.0d0 * (((c0 * d_1) / d) * (d_1 / (h * (w * d)))))
    t_2 = 0.25d0 * ((d * d) / ((d_1 * d_1) / (h * (m * m))))
    if (h <= (-4.8d-289)) then
        tmp = t_1
    else if (h <= 1.65d-294) then
        tmp = t_2
    else if (h <= 3.5d-155) then
        tmp = t_0
    else if (h <= 3.9d+33) then
        tmp = 0.0d0
    else if (h <= 2.45d+179) then
        tmp = t_1
    else if (h <= 4.6d+212) then
        tmp = t_2
    else
        tmp = t_0
    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) * (c0 / D)) * ((d / w) * ((d / w) / h));
	double t_1 = (c0 / (2.0 * w)) * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))));
	double t_2 = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	double tmp;
	if (h <= -4.8e-289) {
		tmp = t_1;
	} else if (h <= 1.65e-294) {
		tmp = t_2;
	} else if (h <= 3.5e-155) {
		tmp = t_0;
	} else if (h <= 3.9e+33) {
		tmp = 0.0;
	} else if (h <= 2.45e+179) {
		tmp = t_1;
	} else if (h <= 4.6e+212) {
		tmp = t_2;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = ((c0 / D) * (c0 / D)) * ((d / w) * ((d / w) / h))
	t_1 = (c0 / (2.0 * w)) * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))))
	t_2 = 0.25 * ((D * D) / ((d * d) / (h * (M * M))))
	tmp = 0
	if h <= -4.8e-289:
		tmp = t_1
	elif h <= 1.65e-294:
		tmp = t_2
	elif h <= 3.5e-155:
		tmp = t_0
	elif h <= 3.9e+33:
		tmp = 0.0
	elif h <= 2.45e+179:
		tmp = t_1
	elif h <= 4.6e+212:
		tmp = t_2
	else:
		tmp = t_0
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(Float64(c0 / D) * Float64(c0 / D)) * Float64(Float64(d / w) * Float64(Float64(d / w) / h)))
	t_1 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(Float64(Float64(c0 * d) / D) * Float64(d / Float64(h * Float64(w * D))))))
	t_2 = Float64(0.25 * Float64(Float64(D * D) / Float64(Float64(d * d) / Float64(h * Float64(M * M)))))
	tmp = 0.0
	if (h <= -4.8e-289)
		tmp = t_1;
	elseif (h <= 1.65e-294)
		tmp = t_2;
	elseif (h <= 3.5e-155)
		tmp = t_0;
	elseif (h <= 3.9e+33)
		tmp = 0.0;
	elseif (h <= 2.45e+179)
		tmp = t_1;
	elseif (h <= 4.6e+212)
		tmp = t_2;
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = ((c0 / D) * (c0 / D)) * ((d / w) * ((d / w) / h));
	t_1 = (c0 / (2.0 * w)) * (2.0 * (((c0 * d) / D) * (d / (h * (w * D)))));
	t_2 = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	tmp = 0.0;
	if (h <= -4.8e-289)
		tmp = t_1;
	elseif (h <= 1.65e-294)
		tmp = t_2;
	elseif (h <= 3.5e-155)
		tmp = t_0;
	elseif (h <= 3.9e+33)
		tmp = 0.0;
	elseif (h <= 2.45e+179)
		tmp = t_1;
	elseif (h <= 4.6e+212)
		tmp = t_2;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(N[(c0 / D), $MachinePrecision] * N[(c0 / D), $MachinePrecision]), $MachinePrecision] * N[(N[(d / w), $MachinePrecision] * N[(N[(d / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(N[(c0 * d), $MachinePrecision] / D), $MachinePrecision] * N[(d / N[(h * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] / N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -4.8e-289], t$95$1, If[LessEqual[h, 1.65e-294], t$95$2, If[LessEqual[h, 3.5e-155], t$95$0, If[LessEqual[h, 3.9e+33], 0.0, If[LessEqual[h, 2.45e+179], t$95$1, If[LessEqual[h, 4.6e+212], t$95$2, t$95$0]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;h \leq 1.65 \cdot 10^{-294}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;h \leq 3.5 \cdot 10^{-155}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;h \leq 3.9 \cdot 10^{+33}:\\
\;\;\;\;0\\

\mathbf{elif}\;h \leq 2.45 \cdot 10^{+179}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;h \leq 4.6 \cdot 10^{+212}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if h < -4.79999999999999988e-289 or 3.9000000000000002e33 < h < 2.4499999999999999e179

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

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

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

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

        \[\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/36.2%

        \[\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. associate-*r*40.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \color{blue}{\sqrt[3]{\frac{\frac{d}{D}}{h \cdot w} \cdot \left(\frac{\frac{d}{D}}{h \cdot w} \cdot \frac{\frac{d}{D}}{h \cdot w}\right)}}\right)\right) \]
    10. Taylor expanded in d around 0 53.8%

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

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

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

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

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

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

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

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

    if -4.79999999999999988e-289 < h < 1.65e-294 or 2.4499999999999999e179 < h < 4.5999999999999997e212

    1. Initial program 5.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. Simplified5.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. Step-by-step derivation
      1. flip-+0.0%

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \frac{{M}^{2}}{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)} \]
    8. Step-by-step derivation
      1. mul-1-neg61.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-\frac{{M}^{2}}{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. associate-/r*61.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(-\color{blue}{\frac{\frac{{M}^{2}}{c0}}{-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) \]
      3. distribute-neg-frac61.1%

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. unpow288.8%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2}}{{M}^{2} \cdot h}} \]
      3. unpow288.8%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{\color{blue}{d \cdot d}}{{M}^{2} \cdot h}} \]
      4. *-commutative88.8%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{\color{blue}{h \cdot {M}^{2}}}} \]
      5. unpow288.8%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \color{blue}{\left(M \cdot M\right)}}} \]
    12. Simplified88.8%

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

    if 1.65e-294 < h < 3.50000000000000015e-155 or 4.5999999999999997e212 < h

    1. Initial program 27.5%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Simplified29.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 44.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. unpow244.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. *-commutative44.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/44.2%

        \[\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. associate-*r*44.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.50000000000000015e-155 < h < 3.9000000000000002e33

    1. Initial program 12.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq -4.8 \cdot 10^{-289}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \frac{d}{h \cdot \left(w \cdot D\right)}\right)\right)\\ \mathbf{elif}\;h \leq 1.65 \cdot 10^{-294}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \mathbf{elif}\;h \leq 3.5 \cdot 10^{-155}:\\ \;\;\;\;\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{w} \cdot \frac{\frac{d}{w}}{h}\right)\\ \mathbf{elif}\;h \leq 3.9 \cdot 10^{+33}:\\ \;\;\;\;0\\ \mathbf{elif}\;h \leq 2.45 \cdot 10^{+179}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0 \cdot d}{D} \cdot \frac{d}{h \cdot \left(w \cdot D\right)}\right)\right)\\ \mathbf{elif}\;h \leq 4.6 \cdot 10^{+212}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{w} \cdot \frac{\frac{d}{w}}{h}\right)\\ \end{array} \]

Alternative 6: 39.6% accurate, 7.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c0 \leq -1.25 \cdot 10^{-107} \lor \neg \left(c0 \leq 1.8 \cdot 10^{-144}\right):\\ \;\;\;\;\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 (or (<= c0 -1.25e-107) (not (<= c0 1.8e-144)))
   (* (* (/ 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 ((c0 <= -1.25e-107) || !(c0 <= 1.8e-144)) {
		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 ((c0 <= (-1.25d-107)) .or. (.not. (c0 <= 1.8d-144))) 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 ((c0 <= -1.25e-107) || !(c0 <= 1.8e-144)) {
		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 (c0 <= -1.25e-107) or not (c0 <= 1.8e-144):
		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 ((c0 <= -1.25e-107) || !(c0 <= 1.8e-144))
		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 ((c0 <= -1.25e-107) || ~((c0 <= 1.8e-144)))
		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[Or[LessEqual[c0, -1.25e-107], N[Not[LessEqual[c0, 1.8e-144]], $MachinePrecision]], 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}\;c0 \leq -1.25 \cdot 10^{-107} \lor \neg \left(c0 \leq 1.8 \cdot 10^{-144}\right):\\
\;\;\;\;\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 c0 < -1.24999999999999993e-107 or 1.8e-144 < c0

    1. Initial program 23.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. Simplified24.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 37.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. unpow237.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. *-commutative37.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/38.3%

        \[\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. associate-*r*40.1%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. Step-by-step derivation
      1. times-frac44.4%

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

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

    if -1.24999999999999993e-107 < c0 < 1.8e-144

    1. Initial program 21.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. Simplified23.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 4.2%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -1.25 \cdot 10^{-107} \lor \neg \left(c0 \leq 1.8 \cdot 10^{-144}\right):\\ \;\;\;\;\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 7: 43.8% accurate, 7.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c0 \leq -4 \cdot 10^{-156} \lor \neg \left(c0 \leq 8.8 \cdot 10^{-145}\right):\\
\;\;\;\;\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{w} \cdot \frac{\frac{d}{w}}{h}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c0 < -4.00000000000000016e-156 or 8.79999999999999996e-145 < c0

    1. Initial program 24.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. Simplified26.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 37.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. unpow237.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. *-commutative37.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/38.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. associate-*r*39.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.00000000000000016e-156 < c0 < 8.79999999999999996e-145

    1. Initial program 14.1%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -4 \cdot 10^{-156} \lor \neg \left(c0 \leq 8.8 \cdot 10^{-145}\right):\\ \;\;\;\;\left(\frac{c0}{D} \cdot \frac{c0}{D}\right) \cdot \left(\frac{d}{w} \cdot \frac{\frac{d}{w}}{h}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 8: 37.6% accurate, 7.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \cdot d \leq 1.22 \cdot 10^{+294}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (if (<= (* d d) 1.22e+294)
   (* 0.25 (/ (* D D) (/ (* d d) (* h (* M M)))))
   0.0))
double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if ((d * d) <= 1.22e+294) {
		tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	} 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 ((d_1 * d_1) <= 1.22d+294) then
        tmp = 0.25d0 * ((d * d) / ((d_1 * d_1) / (h * (m * m))))
    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 ((d * d) <= 1.22e+294) {
		tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	tmp = 0
	if (d * d) <= 1.22e+294:
		tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M))))
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	tmp = 0.0
	if (Float64(d * d) <= 1.22e+294)
		tmp = Float64(0.25 * Float64(Float64(D * D) / Float64(Float64(d * d) / Float64(h * Float64(M * M)))));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	tmp = 0.0;
	if ((d * d) <= 1.22e+294)
		tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[N[(d * d), $MachinePrecision], 1.22e+294], N[(0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] / N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \cdot d \leq 1.22 \cdot 10^{+294}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 d d) < 1.2199999999999999e294

    1. Initial program 24.0%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-1 \cdot \frac{{M}^{2}}{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)} \]
    8. Step-by-step derivation
      1. mul-1-neg21.2%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-\frac{{M}^{2}}{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. associate-/r*21.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(-\color{blue}{\frac{\frac{{M}^{2}}{c0}}{-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) \]
      3. distribute-neg-frac21.8%

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}} \]
      2. unpow237.4%

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

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{\color{blue}{d \cdot d}}{{M}^{2} \cdot h}} \]
      4. *-commutative37.4%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{\color{blue}{h \cdot {M}^{2}}}} \]
      5. unpow237.4%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \color{blue}{\left(M \cdot M\right)}}} \]
    12. Simplified37.4%

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

    if 1.2199999999999999e294 < (*.f64 d d)

    1. Initial program 22.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. Simplified22.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 0.0%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(-c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)\right)} \]
      2. distribute-rgt-in0.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. Simplified31.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \cdot d \leq 1.22 \cdot 10^{+294}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 9: 33.6% 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 23.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. Simplified24.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 3.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-neg3.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.1%

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

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

    \[\leadsto \color{blue}{0} \]
  7. Final simplification30.6%

    \[\leadsto 0 \]

Reproduce

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