Henrywood and Agarwal, Equation (13)

Percentage Accurate: 24.3% → 49.3%
Time: 46.2s
Alternatives: 11
Speedup: 30.2×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 24.3% 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: 49.3% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{0}{w \cdot h}\\


\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 78.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) \]

    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.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.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{0}{h \cdot w}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification51.7%

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

Alternative 2: 43.9% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;w \leq -4.8 \cdot 10^{+67} \lor \neg \left(w \leq -1.2 \cdot 10^{-110} \lor \neg \left(w \leq -1.15 \cdot 10^{-165}\right) \land w \leq 6.8 \cdot 10^{+20}\right):\\
\;\;\;\;\frac{0}{w \cdot h}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < -4.80000000000000004e67 or -1.20000000000000003e-110 < w < -1.15e-165 or 6.8e20 < w

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.80000000000000004e67 < w < -1.20000000000000003e-110 or -1.15e-165 < w < 6.8e20

    1. Initial program 31.5%

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{h \cdot w}} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right) + \mathsf{fma}\left(0.5, \frac{\left(h \cdot w\right) \cdot \left(0 \cdot \left(\frac{M}{h} \cdot \frac{\left(c0 \cdot d\right) \cdot d}{w}\right)\right)}{\left(c0 \cdot d\right) \cdot d}, \frac{\frac{c0}{h \cdot w}}{\frac{D \cdot D}{d \cdot d}}\right)\right) \]
      3. pow210.4%

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{\color{blue}{w \cdot h}} + \mathsf{fma}\left(0.5, \frac{\left(h \cdot w\right) \cdot \left(0 \cdot \left(\frac{M}{h} \cdot \frac{\left(c0 \cdot d\right) \cdot d}{w}\right)\right)}{\left(c0 \cdot d\right) \cdot d}, \frac{\frac{c0}{h \cdot w}}{\frac{D \cdot D}{d \cdot d}}\right)\right) \]
    7. Applied egg-rr44.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -4.8 \cdot 10^{+67} \lor \neg \left(w \leq -1.2 \cdot 10^{-110} \lor \neg \left(w \leq -1.15 \cdot 10^{-165}\right) \land w \leq 6.8 \cdot 10^{+20}\right):\\ \;\;\;\;\frac{0}{w \cdot h}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{w \cdot h} \cdot \left(\frac{c0}{2 \cdot w} \cdot \left(2 \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)\\ \end{array} \]

Alternative 3: 43.9% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{w \cdot h} \cdot \left(\frac{c0}{2 \cdot w} \cdot \left(2 \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)\\ t_1 := \frac{0}{w \cdot h}\\ \mathbf{if}\;w \leq -9.2 \cdot 10^{+67}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;w \leq -6.4 \cdot 10^{-114}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;w \leq -7 \cdot 10^{-174}:\\ \;\;\;\;\mathsf{fma}\left(c0 \cdot c0, 0, \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}{d \cdot d}\right)\\ \mathbf{elif}\;w \leq 3.25 \cdot 10^{+25}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (* (/ c0 (* w h)) (* (/ c0 (* 2.0 w)) (* 2.0 (pow (/ d D) 2.0)))))
        (t_1 (/ 0.0 (* w h))))
   (if (<= w -9.2e+67)
     t_1
     (if (<= w -6.4e-114)
       t_0
       (if (<= w -7e-174)
         (fma (* c0 c0) 0.0 (/ (* 0.25 (* (* D D) (* h (* M M)))) (* d d)))
         (if (<= w 3.25e+25) t_0 t_1))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 / (w * h)) * ((c0 / (2.0 * w)) * (2.0 * pow((d / D), 2.0)));
	double t_1 = 0.0 / (w * h);
	double tmp;
	if (w <= -9.2e+67) {
		tmp = t_1;
	} else if (w <= -6.4e-114) {
		tmp = t_0;
	} else if (w <= -7e-174) {
		tmp = fma((c0 * c0), 0.0, ((0.25 * ((D * D) * (h * (M * M)))) / (d * d)));
	} else if (w <= 3.25e+25) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 / Float64(w * h)) * Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * (Float64(d / D) ^ 2.0))))
	t_1 = Float64(0.0 / Float64(w * h))
	tmp = 0.0
	if (w <= -9.2e+67)
		tmp = t_1;
	elseif (w <= -6.4e-114)
		tmp = t_0;
	elseif (w <= -7e-174)
		tmp = fma(Float64(c0 * c0), 0.0, Float64(Float64(0.25 * Float64(Float64(D * D) * Float64(h * Float64(M * M)))) / Float64(d * d)));
	elseif (w <= 3.25e+25)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -9.2e+67], t$95$1, If[LessEqual[w, -6.4e-114], t$95$0, If[LessEqual[w, -7e-174], N[(N[(c0 * c0), $MachinePrecision] * 0.0 + N[(N[(0.25 * N[(N[(D * D), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, 3.25e+25], t$95$0, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;w \leq -6.4 \cdot 10^{-114}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;w \leq -7 \cdot 10^{-174}:\\
\;\;\;\;\mathsf{fma}\left(c0 \cdot c0, 0, \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}{d \cdot d}\right)\\

\mathbf{elif}\;w \leq 3.25 \cdot 10^{+25}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if w < -9.1999999999999994e67 or 3.25000000000000003e25 < w

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.1999999999999994e67 < w < -6.4000000000000003e-114 or -6.99999999999999975e-174 < w < 3.25000000000000003e25

    1. Initial program 31.5%

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{h \cdot w}} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right) + \mathsf{fma}\left(0.5, \frac{\left(h \cdot w\right) \cdot \left(0 \cdot \left(\frac{M}{h} \cdot \frac{\left(c0 \cdot d\right) \cdot d}{w}\right)\right)}{\left(c0 \cdot d\right) \cdot d}, \frac{\frac{c0}{h \cdot w}}{\frac{D \cdot D}{d \cdot d}}\right)\right) \]
      3. pow210.4%

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{\color{blue}{w \cdot h}} + \mathsf{fma}\left(0.5, \frac{\left(h \cdot w\right) \cdot \left(0 \cdot \left(\frac{M}{h} \cdot \frac{\left(c0 \cdot d\right) \cdot d}{w}\right)\right)}{\left(c0 \cdot d\right) \cdot d}, \frac{\frac{c0}{h \cdot w}}{\frac{D \cdot D}{d \cdot d}}\right)\right) \]
    7. Applied egg-rr44.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.4000000000000003e-114 < w < -6.99999999999999975e-174

    1. Initial program 21.8%

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

        \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \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 \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}} \]
      2. *-commutative21.8%

        \[\leadsto \frac{c0}{\color{blue}{w \cdot 2}} \cdot \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 \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} \]
      3. times-frac21.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left({c0}^{2}, -0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} + 0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)}, 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}\right)} \]
      3. unpow20.0%

        \[\leadsto \mathsf{fma}\left(\color{blue}{c0 \cdot c0}, -0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} + 0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)}, 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}\right) \]
      4. distribute-rgt-out0.0%

        \[\leadsto \mathsf{fma}\left(c0 \cdot c0, \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot \left(-0.5 + 0.5\right)}, 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}\right) \]
      5. metadata-eval0.0%

        \[\leadsto \mathsf{fma}\left(c0 \cdot c0, \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot \color{blue}{0}, 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}\right) \]
      6. mul0-rgt59.2%

        \[\leadsto \mathsf{fma}\left(c0 \cdot c0, \color{blue}{0}, 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}\right) \]
      7. associate-*r/59.2%

        \[\leadsto \mathsf{fma}\left(c0 \cdot c0, 0, \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2}}}\right) \]
      8. unpow259.2%

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

        \[\leadsto \mathsf{fma}\left(c0 \cdot c0, 0, \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}\right)}{{d}^{2}}\right) \]
      10. unpow259.2%

        \[\leadsto \mathsf{fma}\left(c0 \cdot c0, 0, \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \left(h \cdot \color{blue}{\left(M \cdot M\right)}\right)\right)}{{d}^{2}}\right) \]
      11. unpow259.2%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(c0 \cdot c0, 0, \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}{d \cdot d}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification49.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -9.2 \cdot 10^{+67}:\\ \;\;\;\;\frac{0}{w \cdot h}\\ \mathbf{elif}\;w \leq -6.4 \cdot 10^{-114}:\\ \;\;\;\;\frac{c0}{w \cdot h} \cdot \left(\frac{c0}{2 \cdot w} \cdot \left(2 \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)\\ \mathbf{elif}\;w \leq -7 \cdot 10^{-174}:\\ \;\;\;\;\mathsf{fma}\left(c0 \cdot c0, 0, \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}{d \cdot d}\right)\\ \mathbf{elif}\;w \leq 3.25 \cdot 10^{+25}:\\ \;\;\;\;\frac{c0}{w \cdot h} \cdot \left(\frac{c0}{2 \cdot w} \cdot \left(2 \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{w \cdot h}\\ \end{array} \]

Alternative 4: 43.8% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0 \cdot \left(\frac{c0}{w \cdot h} \cdot \left(2 \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)}{2 \cdot w}\\ t_1 := \frac{0}{w \cdot h}\\ \mathbf{if}\;w \leq -2.5 \cdot 10^{+68}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;w \leq -6.4 \cdot 10^{-114}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;w \leq -8.5 \cdot 10^{-177}:\\ \;\;\;\;\mathsf{fma}\left(c0 \cdot c0, 0, \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}{d \cdot d}\right)\\ \mathbf{elif}\;w \leq 8.2 \cdot 10^{+20}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (* c0 (* (/ c0 (* w h)) (* 2.0 (pow (/ d D) 2.0)))) (* 2.0 w)))
        (t_1 (/ 0.0 (* w h))))
   (if (<= w -2.5e+68)
     t_1
     (if (<= w -6.4e-114)
       t_0
       (if (<= w -8.5e-177)
         (fma (* c0 c0) 0.0 (/ (* 0.25 (* (* D D) (* h (* M M)))) (* d d)))
         (if (<= w 8.2e+20) t_0 t_1))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * ((c0 / (w * h)) * (2.0 * pow((d / D), 2.0)))) / (2.0 * w);
	double t_1 = 0.0 / (w * h);
	double tmp;
	if (w <= -2.5e+68) {
		tmp = t_1;
	} else if (w <= -6.4e-114) {
		tmp = t_0;
	} else if (w <= -8.5e-177) {
		tmp = fma((c0 * c0), 0.0, ((0.25 * ((D * D) * (h * (M * M)))) / (d * d)));
	} else if (w <= 8.2e+20) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 * Float64(Float64(c0 / Float64(w * h)) * Float64(2.0 * (Float64(d / D) ^ 2.0)))) / Float64(2.0 * w))
	t_1 = Float64(0.0 / Float64(w * h))
	tmp = 0.0
	if (w <= -2.5e+68)
		tmp = t_1;
	elseif (w <= -6.4e-114)
		tmp = t_0;
	elseif (w <= -8.5e-177)
		tmp = fma(Float64(c0 * c0), 0.0, Float64(Float64(0.25 * Float64(Float64(D * D) * Float64(h * Float64(M * M)))) / Float64(d * d)));
	elseif (w <= 8.2e+20)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -2.5e+68], t$95$1, If[LessEqual[w, -6.4e-114], t$95$0, If[LessEqual[w, -8.5e-177], N[(N[(c0 * c0), $MachinePrecision] * 0.0 + N[(N[(0.25 * N[(N[(D * D), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, 8.2e+20], t$95$0, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;w \leq -6.4 \cdot 10^{-114}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;w \leq -8.5 \cdot 10^{-177}:\\
\;\;\;\;\mathsf{fma}\left(c0 \cdot c0, 0, \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}{d \cdot d}\right)\\

\mathbf{elif}\;w \leq 8.2 \cdot 10^{+20}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if w < -2.5000000000000002e68 or 8.2e20 < w

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5000000000000002e68 < w < -6.4000000000000003e-114 or -8.4999999999999993e-177 < w < 8.2e20

    1. Initial program 31.5%

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{h \cdot w}} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right) + \mathsf{fma}\left(0.5, \frac{\left(h \cdot w\right) \cdot \left(0 \cdot \left(\frac{M}{h} \cdot \frac{\left(c0 \cdot d\right) \cdot d}{w}\right)\right)}{\left(c0 \cdot d\right) \cdot d}, \frac{\frac{c0}{h \cdot w}}{\frac{D \cdot D}{d \cdot d}}\right)\right) \]
      3. pow210.4%

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{\color{blue}{w \cdot h}} + \mathsf{fma}\left(0.5, \frac{\left(h \cdot w\right) \cdot \left(0 \cdot \left(\frac{M}{h} \cdot \frac{\left(c0 \cdot d\right) \cdot d}{w}\right)\right)}{\left(c0 \cdot d\right) \cdot d}, \frac{\frac{c0}{h \cdot w}}{\frac{D \cdot D}{d \cdot d}}\right)\right) \]
    7. Applied egg-rr44.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.4000000000000003e-114 < w < -8.4999999999999993e-177

    1. Initial program 21.8%

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

        \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \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 \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}} \]
      2. *-commutative21.8%

        \[\leadsto \frac{c0}{\color{blue}{w \cdot 2}} \cdot \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 \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} \]
      3. times-frac21.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left({c0}^{2}, -0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} + 0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)}, 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}\right)} \]
      3. unpow20.0%

        \[\leadsto \mathsf{fma}\left(\color{blue}{c0 \cdot c0}, -0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} + 0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)}, 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}\right) \]
      4. distribute-rgt-out0.0%

        \[\leadsto \mathsf{fma}\left(c0 \cdot c0, \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot \left(-0.5 + 0.5\right)}, 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}\right) \]
      5. metadata-eval0.0%

        \[\leadsto \mathsf{fma}\left(c0 \cdot c0, \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot \color{blue}{0}, 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}\right) \]
      6. mul0-rgt59.2%

        \[\leadsto \mathsf{fma}\left(c0 \cdot c0, \color{blue}{0}, 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}\right) \]
      7. associate-*r/59.2%

        \[\leadsto \mathsf{fma}\left(c0 \cdot c0, 0, \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2}}}\right) \]
      8. unpow259.2%

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

        \[\leadsto \mathsf{fma}\left(c0 \cdot c0, 0, \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}\right)}{{d}^{2}}\right) \]
      10. unpow259.2%

        \[\leadsto \mathsf{fma}\left(c0 \cdot c0, 0, \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \left(h \cdot \color{blue}{\left(M \cdot M\right)}\right)\right)}{{d}^{2}}\right) \]
      11. unpow259.2%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(c0 \cdot c0, 0, \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}{d \cdot d}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification49.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -2.5 \cdot 10^{+68}:\\ \;\;\;\;\frac{0}{w \cdot h}\\ \mathbf{elif}\;w \leq -6.4 \cdot 10^{-114}:\\ \;\;\;\;\frac{c0 \cdot \left(\frac{c0}{w \cdot h} \cdot \left(2 \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)}{2 \cdot w}\\ \mathbf{elif}\;w \leq -8.5 \cdot 10^{-177}:\\ \;\;\;\;\mathsf{fma}\left(c0 \cdot c0, 0, \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}{d \cdot d}\right)\\ \mathbf{elif}\;w \leq 8.2 \cdot 10^{+20}:\\ \;\;\;\;\frac{c0 \cdot \left(\frac{c0}{w \cdot h} \cdot \left(2 \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)}{2 \cdot w}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{w \cdot h}\\ \end{array} \]

Alternative 5: 37.3% accurate, 5.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;w \leq -4.6 \cdot 10^{+67} \lor \neg \left(w \leq -7.6 \cdot 10^{-111}\right) \land \left(w \leq -1.12 \cdot 10^{-166} \lor \neg \left(w \leq 8.2 \cdot 10^{-38}\right)\right):\\
\;\;\;\;\frac{0}{w \cdot h}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < -4.5999999999999997e67 or -7.60000000000000045e-111 < w < -1.11999999999999994e-166 or 8.1999999999999996e-38 < w

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.5999999999999997e67 < w < -7.60000000000000045e-111 or -1.11999999999999994e-166 < w < 8.1999999999999996e-38

    1. Initial program 32.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq -4.6 \cdot 10^{+67} \lor \neg \left(w \leq -7.6 \cdot 10^{-111}\right) \land \left(w \leq -1.12 \cdot 10^{-166} \lor \neg \left(w \leq 8.2 \cdot 10^{-38}\right)\right):\\ \;\;\;\;\frac{0}{w \cdot h}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0}{w} \cdot \frac{d \cdot d}{h \cdot \left(D \cdot D\right)}\right)\right)\\ \end{array} \]

Alternative 6: 33.7% accurate, 6.0× speedup?

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

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

\mathbf{elif}\;c0 \leq 3.9 \cdot 10^{+110}:\\
\;\;\;\;0 \cdot \left(c0 \cdot c0\right)\\

\mathbf{elif}\;c0 \leq 1.15 \cdot 10^{+194} \lor \neg \left(c0 \leq 1.2 \cdot 10^{+274}\right):\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{0}{w \cdot h}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c0 < -8.60000000000000065e-126 or 3.9000000000000003e110 < c0 < 1.15000000000000003e194 or 1.2e274 < c0

    1. Initial program 35.4%

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

        \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \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 \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}} \]
      2. *-commutative35.3%

        \[\leadsto \frac{c0}{\color{blue}{w \cdot 2}} \cdot \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 \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} \]
      3. times-frac33.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.60000000000000065e-126 < c0 < 3.9000000000000003e110

    1. Initial program 18.3%

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

        \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \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 \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}} \]
      2. *-commutative18.3%

        \[\leadsto \frac{c0}{\color{blue}{w \cdot 2}} \cdot \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 \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} \]
      3. times-frac15.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(c0 \cdot c0\right) \cdot 0} \]

    if 1.15000000000000003e194 < c0 < 1.2e274

    1. Initial program 10.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{0}{h \cdot w}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification42.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -8.6 \cdot 10^{-126}:\\ \;\;\;\;\frac{c0 \cdot c0}{D \cdot D} \cdot \frac{d \cdot d}{h \cdot \left(w \cdot w\right)}\\ \mathbf{elif}\;c0 \leq 3.9 \cdot 10^{+110}:\\ \;\;\;\;0 \cdot \left(c0 \cdot c0\right)\\ \mathbf{elif}\;c0 \leq 1.15 \cdot 10^{+194} \lor \neg \left(c0 \leq 1.2 \cdot 10^{+274}\right):\\ \;\;\;\;\frac{c0 \cdot c0}{D \cdot D} \cdot \frac{d \cdot d}{h \cdot \left(w \cdot w\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{w \cdot h}\\ \end{array} \]

Alternative 7: 33.9% accurate, 6.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0 \cdot c0}{D \cdot D} \cdot \frac{d \cdot d}{h \cdot \left(w \cdot w\right)}\\ \mathbf{if}\;c0 \leq -2.55 \cdot 10^{-121}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c0 \leq 2 \cdot 10^{+107}:\\ \;\;\;\;0 \cdot \left(c0 \cdot c0\right)\\ \mathbf{elif}\;c0 \leq 5.4 \cdot 10^{+200}:\\ \;\;\;\;\frac{c0 \cdot c0}{\frac{\left(h \cdot \left(D \cdot D\right)\right) \cdot \left(w \cdot w\right)}{d \cdot d}}\\ \mathbf{elif}\;c0 \leq 10^{+274}:\\ \;\;\;\;\frac{0}{w \cdot h}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (* (/ (* c0 c0) (* D D)) (/ (* d d) (* h (* w w))))))
   (if (<= c0 -2.55e-121)
     t_0
     (if (<= c0 2e+107)
       (* 0.0 (* c0 c0))
       (if (<= c0 5.4e+200)
         (/ (* c0 c0) (/ (* (* h (* D D)) (* w w)) (* d d)))
         (if (<= c0 1e+274) (/ 0.0 (* w h)) t_0))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = ((c0 * c0) / (D * D)) * ((d * d) / (h * (w * w)));
	double tmp;
	if (c0 <= -2.55e-121) {
		tmp = t_0;
	} else if (c0 <= 2e+107) {
		tmp = 0.0 * (c0 * c0);
	} else if (c0 <= 5.4e+200) {
		tmp = (c0 * c0) / (((h * (D * D)) * (w * w)) / (d * d));
	} else if (c0 <= 1e+274) {
		tmp = 0.0 / (w * h);
	} 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) :: tmp
    t_0 = ((c0 * c0) / (d * d)) * ((d_1 * d_1) / (h * (w * w)))
    if (c0 <= (-2.55d-121)) then
        tmp = t_0
    else if (c0 <= 2d+107) then
        tmp = 0.0d0 * (c0 * c0)
    else if (c0 <= 5.4d+200) then
        tmp = (c0 * c0) / (((h * (d * d)) * (w * w)) / (d_1 * d_1))
    else if (c0 <= 1d+274) then
        tmp = 0.0d0 / (w * h)
    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 * c0) / (D * D)) * ((d * d) / (h * (w * w)));
	double tmp;
	if (c0 <= -2.55e-121) {
		tmp = t_0;
	} else if (c0 <= 2e+107) {
		tmp = 0.0 * (c0 * c0);
	} else if (c0 <= 5.4e+200) {
		tmp = (c0 * c0) / (((h * (D * D)) * (w * w)) / (d * d));
	} else if (c0 <= 1e+274) {
		tmp = 0.0 / (w * h);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = ((c0 * c0) / (D * D)) * ((d * d) / (h * (w * w)))
	tmp = 0
	if c0 <= -2.55e-121:
		tmp = t_0
	elif c0 <= 2e+107:
		tmp = 0.0 * (c0 * c0)
	elif c0 <= 5.4e+200:
		tmp = (c0 * c0) / (((h * (D * D)) * (w * w)) / (d * d))
	elif c0 <= 1e+274:
		tmp = 0.0 / (w * h)
	else:
		tmp = t_0
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(Float64(c0 * c0) / Float64(D * D)) * Float64(Float64(d * d) / Float64(h * Float64(w * w))))
	tmp = 0.0
	if (c0 <= -2.55e-121)
		tmp = t_0;
	elseif (c0 <= 2e+107)
		tmp = Float64(0.0 * Float64(c0 * c0));
	elseif (c0 <= 5.4e+200)
		tmp = Float64(Float64(c0 * c0) / Float64(Float64(Float64(h * Float64(D * D)) * Float64(w * w)) / Float64(d * d)));
	elseif (c0 <= 1e+274)
		tmp = Float64(0.0 / Float64(w * h));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = ((c0 * c0) / (D * D)) * ((d * d) / (h * (w * w)));
	tmp = 0.0;
	if (c0 <= -2.55e-121)
		tmp = t_0;
	elseif (c0 <= 2e+107)
		tmp = 0.0 * (c0 * c0);
	elseif (c0 <= 5.4e+200)
		tmp = (c0 * c0) / (((h * (D * D)) * (w * w)) / (d * d));
	elseif (c0 <= 1e+274)
		tmp = 0.0 / (w * h);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(N[(c0 * c0), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -2.55e-121], t$95$0, If[LessEqual[c0, 2e+107], N[(0.0 * N[(c0 * c0), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 5.4e+200], N[(N[(c0 * c0), $MachinePrecision] / N[(N[(N[(h * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c0, 1e+274], N[(0.0 / N[(w * h), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

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

\mathbf{elif}\;c0 \leq 2 \cdot 10^{+107}:\\
\;\;\;\;0 \cdot \left(c0 \cdot c0\right)\\

\mathbf{elif}\;c0 \leq 5.4 \cdot 10^{+200}:\\
\;\;\;\;\frac{c0 \cdot c0}{\frac{\left(h \cdot \left(D \cdot D\right)\right) \cdot \left(w \cdot w\right)}{d \cdot d}}\\

\mathbf{elif}\;c0 \leq 10^{+274}:\\
\;\;\;\;\frac{0}{w \cdot h}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c0 < -2.5499999999999999e-121 or 9.99999999999999921e273 < c0

    1. Initial program 35.4%

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

        \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \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 \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}} \]
      2. *-commutative35.3%

        \[\leadsto \frac{c0}{\color{blue}{w \cdot 2}} \cdot \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 \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} \]
      3. times-frac34.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5499999999999999e-121 < c0 < 1.9999999999999999e107

    1. Initial program 18.3%

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

        \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \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 \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}} \]
      2. *-commutative18.3%

        \[\leadsto \frac{c0}{\color{blue}{w \cdot 2}} \cdot \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 \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} \]
      3. times-frac15.6%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(c0 \cdot c0\right) \cdot 0} \]

    if 1.9999999999999999e107 < c0 < 5.40000000000000031e200

    1. Initial program 33.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. Taylor expanded in c0 around inf 45.3%

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

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

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

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

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

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

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

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

    if 5.40000000000000031e200 < c0 < 9.99999999999999921e273

    1. Initial program 10.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. Simplified10.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 0.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{0}{h \cdot w}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification42.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -2.55 \cdot 10^{-121}:\\ \;\;\;\;\frac{c0 \cdot c0}{D \cdot D} \cdot \frac{d \cdot d}{h \cdot \left(w \cdot w\right)}\\ \mathbf{elif}\;c0 \leq 2 \cdot 10^{+107}:\\ \;\;\;\;0 \cdot \left(c0 \cdot c0\right)\\ \mathbf{elif}\;c0 \leq 5.4 \cdot 10^{+200}:\\ \;\;\;\;\frac{c0 \cdot c0}{\frac{\left(h \cdot \left(D \cdot D\right)\right) \cdot \left(w \cdot w\right)}{d \cdot d}}\\ \mathbf{elif}\;c0 \leq 10^{+274}:\\ \;\;\;\;\frac{0}{w \cdot h}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0 \cdot c0}{D \cdot D} \cdot \frac{d \cdot d}{h \cdot \left(w \cdot w\right)}\\ \end{array} \]

Alternative 8: 19.0% accurate, 10.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \cdot d \leq \infty:\\
\;\;\;\;0.5 \cdot \frac{c0}{\frac{w}{\left(d \cdot d\right) \cdot 0}}\\

\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot 0\\


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

    1. Initial program 26.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. Simplified26.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 3.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.5 \cdot \frac{c0}{\frac{w}{\left(d \cdot d\right) \cdot \color{blue}{0}}} \]
    10. Simplified18.1%

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

    if +inf.0 < (*.f64 d d)

    1. Initial program 26.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. Simplified26.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 4.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-neg4.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-lft-in3.8%

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification18.1%

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

Alternative 9: 30.5% accurate, 13.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;D \cdot D \leq 3 \cdot 10^{-94}:\\
\;\;\;\;\frac{0}{w \cdot h}\\

\mathbf{else}:\\
\;\;\;\;\frac{0}{w \cdot \left(D \cdot D\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 D D) < 3.0000000000000001e-94

    1. Initial program 25.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. Simplified25.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 2.0%

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

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

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

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

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

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

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

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

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

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

    if 3.0000000000000001e-94 < (*.f64 D D)

    1. Initial program 27.9%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;D \cdot D \leq 3 \cdot 10^{-94}:\\ \;\;\;\;\frac{0}{w \cdot h}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{w \cdot \left(D \cdot D\right)}\\ \end{array} \]

Alternative 10: 25.6% accurate, 30.2× speedup?

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

\\
0 \cdot \left(c0 \cdot c0\right)
\end{array}
Derivation
  1. Initial program 26.2%

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

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \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 \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}} \]
    2. *-commutative26.2%

      \[\leadsto \frac{c0}{\color{blue}{w \cdot 2}} \cdot \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 \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} \]
    3. times-frac24.3%

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

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

      \[\leadsto \frac{c0}{w \cdot 2} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right) + \frac{c0}{2 \cdot w} \cdot \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} \]
    6. *-commutative24.3%

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

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

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

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

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

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

      \[\leadsto \left(c0 \cdot c0\right) \cdot \color{blue}{0} \]
  6. Simplified25.1%

    \[\leadsto \color{blue}{\left(c0 \cdot c0\right) \cdot 0} \]
  7. Final simplification25.1%

    \[\leadsto 0 \cdot \left(c0 \cdot c0\right) \]

Alternative 11: 28.8% accurate, 30.2× speedup?

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

\\
\frac{0}{w \cdot h}
\end{array}
Derivation
  1. Initial program 26.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. Simplified26.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 3.5%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{0}{h \cdot w}} \]
  9. Final simplification30.0%

    \[\leadsto \frac{0}{w \cdot h} \]

Reproduce

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