Henrywood and Agarwal, Equation (13)

Percentage Accurate: 24.1% → 69.4%
Time: 16.6s
Alternatives: 13
Speedup: 156.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 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.1% 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: 69.4% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-99}:\\
\;\;\;\;t\_3\\

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

\mathbf{else}:\\
\;\;\;\;t\_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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.9999999999999998e125

    1. Initial program 91.6%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot {c0}^{2}} \]
      4. lower-/.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{d \cdot d}{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {w}^{2}} \cdot {c0}^{2} \]
      11. lower-*.f64N/A

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

        \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \cdot {c0}^{2} \]
      13. lower-*.f64N/A

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

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

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

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

        \[\leadsto \frac{d \cdot d}{D \cdot \left(\left(h \cdot D\right) \cdot \left(w \cdot w\right)\right)} \cdot \left(c0 \cdot c0\right) \]
      2. Step-by-step derivation
        1. Applied rewrites95.5%

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

        if -1.9999999999999998e125 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < 2e-99 or +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 7.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. Add Preprocessing
        3. Taylor expanded in c0 around -inf

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

            \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \cdot {c0}^{2}} \]
          2. lower-*.f64N/A

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(\left(D \cdot \frac{D}{c0 \cdot c0}\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{h}{d \cdot d}\right), 0.25, 0\right) \cdot \left(c0 \cdot c0\right)} \]
        6. Taylor expanded in c0 around 0

          \[\leadsto \frac{1}{4} \cdot \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}} \]
        7. Step-by-step derivation
          1. Applied rewrites63.6%

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

          if 2e-99 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 85.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. Add Preprocessing
          3. Applied rewrites76.4%

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

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

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

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

              \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot {c0}^{2}} \]
            4. lower-/.f64N/A

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

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

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

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

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

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

              \[\leadsto \frac{d \cdot d}{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {w}^{2}} \cdot {c0}^{2} \]
            11. lower-*.f64N/A

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

              \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \cdot {c0}^{2} \]
            13. lower-*.f64N/A

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

              \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \left(w \cdot w\right)} \cdot \color{blue}{\left(c0 \cdot c0\right)} \]
            15. lower-*.f6466.8

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

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

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

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

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

            Alternative 2: 68.8% accurate, 0.2× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(d \cdot c0\right)}^{2}\\ t_1 := \frac{M}{d} \cdot D\\ t_2 := \frac{\left(d \cdot d\right) \cdot c0}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\ t_3 := \left(\sqrt{t\_2 \cdot t\_2 - M \cdot M} + t\_2\right) \cdot \frac{c0}{w \cdot 2}\\ t_4 := \left(t\_1 \cdot t\_1\right) \cdot \left(0.25 \cdot h\right)\\ \mathbf{if}\;t\_3 \leq -2 \cdot 10^{+125}:\\ \;\;\;\;\frac{\frac{t\_0}{\left(D \cdot h\right) \cdot D}}{w \cdot w}\\ \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-99}:\\ \;\;\;\;t\_4\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;\frac{\frac{t\_0}{\left(\left(D \cdot D\right) \cdot w\right) \cdot h}}{w}\\ \mathbf{else}:\\ \;\;\;\;t\_4\\ \end{array} \end{array} \]
            (FPCore (c0 w h D d M)
             :precision binary64
             (let* ((t_0 (pow (* d c0) 2.0))
                    (t_1 (* (/ M d) D))
                    (t_2 (/ (* (* d d) c0) (* (* D D) (* h w))))
                    (t_3 (* (+ (sqrt (- (* t_2 t_2) (* M M))) t_2) (/ c0 (* w 2.0))))
                    (t_4 (* (* t_1 t_1) (* 0.25 h))))
               (if (<= t_3 -2e+125)
                 (/ (/ t_0 (* (* D h) D)) (* w w))
                 (if (<= t_3 2e-99)
                   t_4
                   (if (<= t_3 INFINITY) (/ (/ t_0 (* (* (* D D) w) h)) w) t_4)))))
            double code(double c0, double w, double h, double D, double d, double M) {
            	double t_0 = pow((d * c0), 2.0);
            	double t_1 = (M / d) * D;
            	double t_2 = ((d * d) * c0) / ((D * D) * (h * w));
            	double t_3 = (sqrt(((t_2 * t_2) - (M * M))) + t_2) * (c0 / (w * 2.0));
            	double t_4 = (t_1 * t_1) * (0.25 * h);
            	double tmp;
            	if (t_3 <= -2e+125) {
            		tmp = (t_0 / ((D * h) * D)) / (w * w);
            	} else if (t_3 <= 2e-99) {
            		tmp = t_4;
            	} else if (t_3 <= ((double) INFINITY)) {
            		tmp = (t_0 / (((D * D) * w) * h)) / w;
            	} else {
            		tmp = t_4;
            	}
            	return tmp;
            }
            
            public static double code(double c0, double w, double h, double D, double d, double M) {
            	double t_0 = Math.pow((d * c0), 2.0);
            	double t_1 = (M / d) * D;
            	double t_2 = ((d * d) * c0) / ((D * D) * (h * w));
            	double t_3 = (Math.sqrt(((t_2 * t_2) - (M * M))) + t_2) * (c0 / (w * 2.0));
            	double t_4 = (t_1 * t_1) * (0.25 * h);
            	double tmp;
            	if (t_3 <= -2e+125) {
            		tmp = (t_0 / ((D * h) * D)) / (w * w);
            	} else if (t_3 <= 2e-99) {
            		tmp = t_4;
            	} else if (t_3 <= Double.POSITIVE_INFINITY) {
            		tmp = (t_0 / (((D * D) * w) * h)) / w;
            	} else {
            		tmp = t_4;
            	}
            	return tmp;
            }
            
            def code(c0, w, h, D, d, M):
            	t_0 = math.pow((d * c0), 2.0)
            	t_1 = (M / d) * D
            	t_2 = ((d * d) * c0) / ((D * D) * (h * w))
            	t_3 = (math.sqrt(((t_2 * t_2) - (M * M))) + t_2) * (c0 / (w * 2.0))
            	t_4 = (t_1 * t_1) * (0.25 * h)
            	tmp = 0
            	if t_3 <= -2e+125:
            		tmp = (t_0 / ((D * h) * D)) / (w * w)
            	elif t_3 <= 2e-99:
            		tmp = t_4
            	elif t_3 <= math.inf:
            		tmp = (t_0 / (((D * D) * w) * h)) / w
            	else:
            		tmp = t_4
            	return tmp
            
            function code(c0, w, h, D, d, M)
            	t_0 = Float64(d * c0) ^ 2.0
            	t_1 = Float64(Float64(M / d) * D)
            	t_2 = Float64(Float64(Float64(d * d) * c0) / Float64(Float64(D * D) * Float64(h * w)))
            	t_3 = Float64(Float64(sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))) + t_2) * Float64(c0 / Float64(w * 2.0)))
            	t_4 = Float64(Float64(t_1 * t_1) * Float64(0.25 * h))
            	tmp = 0.0
            	if (t_3 <= -2e+125)
            		tmp = Float64(Float64(t_0 / Float64(Float64(D * h) * D)) / Float64(w * w));
            	elseif (t_3 <= 2e-99)
            		tmp = t_4;
            	elseif (t_3 <= Inf)
            		tmp = Float64(Float64(t_0 / Float64(Float64(Float64(D * D) * w) * h)) / w);
            	else
            		tmp = t_4;
            	end
            	return tmp
            end
            
            function tmp_2 = code(c0, w, h, D, d, M)
            	t_0 = (d * c0) ^ 2.0;
            	t_1 = (M / d) * D;
            	t_2 = ((d * d) * c0) / ((D * D) * (h * w));
            	t_3 = (sqrt(((t_2 * t_2) - (M * M))) + t_2) * (c0 / (w * 2.0));
            	t_4 = (t_1 * t_1) * (0.25 * h);
            	tmp = 0.0;
            	if (t_3 <= -2e+125)
            		tmp = (t_0 / ((D * h) * D)) / (w * w);
            	elseif (t_3 <= 2e-99)
            		tmp = t_4;
            	elseif (t_3 <= Inf)
            		tmp = (t_0 / (((D * D) * w) * h)) / w;
            	else
            		tmp = t_4;
            	end
            	tmp_2 = tmp;
            end
            
            code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[Power[N[(d * c0), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$2), $MachinePrecision] * N[(c0 / N[(w * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(0.25 * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e+125], N[(N[(t$95$0 / N[(N[(D * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e-99], t$95$4, If[LessEqual[t$95$3, Infinity], N[(N[(t$95$0 / N[(N[(N[(D * D), $MachinePrecision] * w), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision], t$95$4]]]]]]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := {\left(d \cdot c0\right)}^{2}\\
            t_1 := \frac{M}{d} \cdot D\\
            t_2 := \frac{\left(d \cdot d\right) \cdot c0}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\
            t_3 := \left(\sqrt{t\_2 \cdot t\_2 - M \cdot M} + t\_2\right) \cdot \frac{c0}{w \cdot 2}\\
            t_4 := \left(t\_1 \cdot t\_1\right) \cdot \left(0.25 \cdot h\right)\\
            \mathbf{if}\;t\_3 \leq -2 \cdot 10^{+125}:\\
            \;\;\;\;\frac{\frac{t\_0}{\left(D \cdot h\right) \cdot D}}{w \cdot w}\\
            
            \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-99}:\\
            \;\;\;\;t\_4\\
            
            \mathbf{elif}\;t\_3 \leq \infty:\\
            \;\;\;\;\frac{\frac{t\_0}{\left(\left(D \cdot D\right) \cdot w\right) \cdot h}}{w}\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_4\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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.9999999999999998e125

              1. Initial program 91.6%

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

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

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

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

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

                  \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot {c0}^{2}} \]
                4. lower-/.f64N/A

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

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

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

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

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

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

                  \[\leadsto \frac{d \cdot d}{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {w}^{2}} \cdot {c0}^{2} \]
                11. lower-*.f64N/A

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

                  \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \cdot {c0}^{2} \]
                13. lower-*.f64N/A

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

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

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

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

                  \[\leadsto \frac{d \cdot d}{D \cdot \left(\left(h \cdot D\right) \cdot \left(w \cdot w\right)\right)} \cdot \left(c0 \cdot c0\right) \]
                2. Step-by-step derivation
                  1. Applied rewrites95.5%

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

                  if -1.9999999999999998e125 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < 2e-99 or +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 7.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. Add Preprocessing
                  3. Taylor expanded in c0 around -inf

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

                      \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \cdot {c0}^{2}} \]
                    2. lower-*.f64N/A

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(D \cdot \frac{D}{c0 \cdot c0}\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{h}{d \cdot d}\right), 0.25, 0\right) \cdot \left(c0 \cdot c0\right)} \]
                  6. Taylor expanded in c0 around 0

                    \[\leadsto \frac{1}{4} \cdot \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}} \]
                  7. Step-by-step derivation
                    1. Applied rewrites63.6%

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

                    if 2e-99 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 85.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. Add Preprocessing
                    3. Applied rewrites76.4%

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

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

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

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

                        \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot {c0}^{2}} \]
                      4. lower-/.f64N/A

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

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

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

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

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

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

                        \[\leadsto \frac{d \cdot d}{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {w}^{2}} \cdot {c0}^{2} \]
                      11. lower-*.f64N/A

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

                        \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \cdot {c0}^{2} \]
                      13. lower-*.f64N/A

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

                        \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \left(w \cdot w\right)} \cdot \color{blue}{\left(c0 \cdot c0\right)} \]
                      15. lower-*.f6466.8

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

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

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

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

                    Alternative 3: 68.0% accurate, 0.3× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(d \cdot d\right) \cdot c0\\ t_1 := \frac{t\_0}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\ t_2 := \frac{c0}{w \cdot 2}\\ t_3 := \left(\sqrt{t\_1 \cdot t\_1 - M \cdot M} + t\_1\right) \cdot t\_2\\ t_4 := \frac{M}{d} \cdot D\\ t_5 := \left(t\_4 \cdot t\_4\right) \cdot \left(0.25 \cdot h\right)\\ \mathbf{if}\;t\_3 \leq -2 \cdot 10^{+125}:\\ \;\;\;\;\frac{\frac{{\left(d \cdot c0\right)}^{2}}{\left(D \cdot h\right) \cdot D}}{w \cdot w}\\ \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-99}:\\ \;\;\;\;t\_5\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{w}{t\_0} \cdot \left(\left(M \cdot M\right) \cdot h\right)\right) \cdot \left(D \cdot D\right), -0.5, \left(\frac{2}{\left(\left(D \cdot D\right) \cdot w\right) \cdot h} \cdot \left(d \cdot d\right)\right) \cdot c0\right) \cdot t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_5\\ \end{array} \end{array} \]
                    (FPCore (c0 w h D d M)
                     :precision binary64
                     (let* ((t_0 (* (* d d) c0))
                            (t_1 (/ t_0 (* (* D D) (* h w))))
                            (t_2 (/ c0 (* w 2.0)))
                            (t_3 (* (+ (sqrt (- (* t_1 t_1) (* M M))) t_1) t_2))
                            (t_4 (* (/ M d) D))
                            (t_5 (* (* t_4 t_4) (* 0.25 h))))
                       (if (<= t_3 -2e+125)
                         (/ (/ (pow (* d c0) 2.0) (* (* D h) D)) (* w w))
                         (if (<= t_3 2e-99)
                           t_5
                           (if (<= t_3 INFINITY)
                             (*
                              (fma
                               (* (* (/ w t_0) (* (* M M) h)) (* D D))
                               -0.5
                               (* (* (/ 2.0 (* (* (* D D) w) h)) (* d d)) c0))
                              t_2)
                             t_5)))))
                    double code(double c0, double w, double h, double D, double d, double M) {
                    	double t_0 = (d * d) * c0;
                    	double t_1 = t_0 / ((D * D) * (h * w));
                    	double t_2 = c0 / (w * 2.0);
                    	double t_3 = (sqrt(((t_1 * t_1) - (M * M))) + t_1) * t_2;
                    	double t_4 = (M / d) * D;
                    	double t_5 = (t_4 * t_4) * (0.25 * h);
                    	double tmp;
                    	if (t_3 <= -2e+125) {
                    		tmp = (pow((d * c0), 2.0) / ((D * h) * D)) / (w * w);
                    	} else if (t_3 <= 2e-99) {
                    		tmp = t_5;
                    	} else if (t_3 <= ((double) INFINITY)) {
                    		tmp = fma((((w / t_0) * ((M * M) * h)) * (D * D)), -0.5, (((2.0 / (((D * D) * w) * h)) * (d * d)) * c0)) * t_2;
                    	} else {
                    		tmp = t_5;
                    	}
                    	return tmp;
                    }
                    
                    function code(c0, w, h, D, d, M)
                    	t_0 = Float64(Float64(d * d) * c0)
                    	t_1 = Float64(t_0 / Float64(Float64(D * D) * Float64(h * w)))
                    	t_2 = Float64(c0 / Float64(w * 2.0))
                    	t_3 = Float64(Float64(sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))) + t_1) * t_2)
                    	t_4 = Float64(Float64(M / d) * D)
                    	t_5 = Float64(Float64(t_4 * t_4) * Float64(0.25 * h))
                    	tmp = 0.0
                    	if (t_3 <= -2e+125)
                    		tmp = Float64(Float64((Float64(d * c0) ^ 2.0) / Float64(Float64(D * h) * D)) / Float64(w * w));
                    	elseif (t_3 <= 2e-99)
                    		tmp = t_5;
                    	elseif (t_3 <= Inf)
                    		tmp = Float64(fma(Float64(Float64(Float64(w / t_0) * Float64(Float64(M * M) * h)) * Float64(D * D)), -0.5, Float64(Float64(Float64(2.0 / Float64(Float64(Float64(D * D) * w) * h)) * Float64(d * d)) * c0)) * t_2);
                    	else
                    		tmp = t_5;
                    	end
                    	return tmp
                    end
                    
                    code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(w * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$4 * t$95$4), $MachinePrecision] * N[(0.25 * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e+125], N[(N[(N[Power[N[(d * c0), $MachinePrecision], 2.0], $MachinePrecision] / N[(N[(D * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e-99], t$95$5, If[LessEqual[t$95$3, Infinity], N[(N[(N[(N[(N[(w / t$95$0), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] * -0.5 + N[(N[(N[(2.0 / N[(N[(N[(D * D), $MachinePrecision] * w), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] * N[(d * d), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], t$95$5]]]]]]]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    t_0 := \left(d \cdot d\right) \cdot c0\\
                    t_1 := \frac{t\_0}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\
                    t_2 := \frac{c0}{w \cdot 2}\\
                    t_3 := \left(\sqrt{t\_1 \cdot t\_1 - M \cdot M} + t\_1\right) \cdot t\_2\\
                    t_4 := \frac{M}{d} \cdot D\\
                    t_5 := \left(t\_4 \cdot t\_4\right) \cdot \left(0.25 \cdot h\right)\\
                    \mathbf{if}\;t\_3 \leq -2 \cdot 10^{+125}:\\
                    \;\;\;\;\frac{\frac{{\left(d \cdot c0\right)}^{2}}{\left(D \cdot h\right) \cdot D}}{w \cdot w}\\
                    
                    \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-99}:\\
                    \;\;\;\;t\_5\\
                    
                    \mathbf{elif}\;t\_3 \leq \infty:\\
                    \;\;\;\;\mathsf{fma}\left(\left(\frac{w}{t\_0} \cdot \left(\left(M \cdot M\right) \cdot h\right)\right) \cdot \left(D \cdot D\right), -0.5, \left(\frac{2}{\left(\left(D \cdot D\right) \cdot w\right) \cdot h} \cdot \left(d \cdot d\right)\right) \cdot c0\right) \cdot t\_2\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;t\_5\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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.9999999999999998e125

                      1. Initial program 91.6%

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

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

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

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

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

                          \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot {c0}^{2}} \]
                        4. lower-/.f64N/A

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

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

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

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

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

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

                          \[\leadsto \frac{d \cdot d}{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {w}^{2}} \cdot {c0}^{2} \]
                        11. lower-*.f64N/A

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

                          \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \cdot {c0}^{2} \]
                        13. lower-*.f64N/A

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

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

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

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

                          \[\leadsto \frac{d \cdot d}{D \cdot \left(\left(h \cdot D\right) \cdot \left(w \cdot w\right)\right)} \cdot \left(c0 \cdot c0\right) \]
                        2. Step-by-step derivation
                          1. Applied rewrites95.5%

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

                          if -1.9999999999999998e125 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < 2e-99 or +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 7.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. Add Preprocessing
                          3. Taylor expanded in c0 around -inf

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

                              \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \cdot {c0}^{2}} \]
                            2. lower-*.f64N/A

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

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\left(D \cdot \frac{D}{c0 \cdot c0}\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{h}{d \cdot d}\right), 0.25, 0\right) \cdot \left(c0 \cdot c0\right)} \]
                          6. Taylor expanded in c0 around 0

                            \[\leadsto \frac{1}{4} \cdot \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}} \]
                          7. Step-by-step derivation
                            1. Applied rewrites63.6%

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

                            if 2e-99 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 85.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. Add Preprocessing
                            3. Taylor expanded in M around 0

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

                                \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}} \cdot \frac{-1}{2}} + 2 \cdot \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right) \]
                              2. lower-fma.f64N/A

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

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

                                \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\left(D \cdot D\right) \cdot \left(\left(\left(M \cdot M\right) \cdot h\right) \cdot \frac{w}{\left(d \cdot d\right) \cdot c0}\right), -0.5, c0 \cdot \left(\left(d \cdot d\right) \cdot \frac{2}{\left(\left(D \cdot D\right) \cdot w\right) \cdot h}\right)\right) \]
                            7. Recombined 3 regimes into one program.
                            8. Final simplification69.3%

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

                            Alternative 4: 68.9% accurate, 0.3× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{w \cdot 2}\\ t_1 := \left(d \cdot d\right) \cdot c0\\ t_2 := \frac{t\_1}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\ t_3 := \left(\sqrt{t\_2 \cdot t\_2 - M \cdot M} + t\_2\right) \cdot t\_0\\ t_4 := \frac{M}{d} \cdot D\\ t_5 := \left(t\_4 \cdot t\_4\right) \cdot \left(0.25 \cdot h\right)\\ \mathbf{if}\;t\_3 \leq -5 \cdot 10^{+57}:\\ \;\;\;\;\frac{t\_1 \cdot 2}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w} \cdot t\_0\\ \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-99}:\\ \;\;\;\;t\_5\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{w}{t\_1} \cdot \left(\left(M \cdot M\right) \cdot h\right)\right) \cdot \left(D \cdot D\right), -0.5, \left(\frac{2}{\left(\left(D \cdot D\right) \cdot w\right) \cdot h} \cdot \left(d \cdot d\right)\right) \cdot c0\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_5\\ \end{array} \end{array} \]
                            (FPCore (c0 w h D d M)
                             :precision binary64
                             (let* ((t_0 (/ c0 (* w 2.0)))
                                    (t_1 (* (* d d) c0))
                                    (t_2 (/ t_1 (* (* D D) (* h w))))
                                    (t_3 (* (+ (sqrt (- (* t_2 t_2) (* M M))) t_2) t_0))
                                    (t_4 (* (/ M d) D))
                                    (t_5 (* (* t_4 t_4) (* 0.25 h))))
                               (if (<= t_3 -5e+57)
                                 (* (/ (* t_1 2.0) (* (* (* D D) h) w)) t_0)
                                 (if (<= t_3 2e-99)
                                   t_5
                                   (if (<= t_3 INFINITY)
                                     (*
                                      (fma
                                       (* (* (/ w t_1) (* (* M M) h)) (* D D))
                                       -0.5
                                       (* (* (/ 2.0 (* (* (* D D) w) h)) (* d d)) c0))
                                      t_0)
                                     t_5)))))
                            double code(double c0, double w, double h, double D, double d, double M) {
                            	double t_0 = c0 / (w * 2.0);
                            	double t_1 = (d * d) * c0;
                            	double t_2 = t_1 / ((D * D) * (h * w));
                            	double t_3 = (sqrt(((t_2 * t_2) - (M * M))) + t_2) * t_0;
                            	double t_4 = (M / d) * D;
                            	double t_5 = (t_4 * t_4) * (0.25 * h);
                            	double tmp;
                            	if (t_3 <= -5e+57) {
                            		tmp = ((t_1 * 2.0) / (((D * D) * h) * w)) * t_0;
                            	} else if (t_3 <= 2e-99) {
                            		tmp = t_5;
                            	} else if (t_3 <= ((double) INFINITY)) {
                            		tmp = fma((((w / t_1) * ((M * M) * h)) * (D * D)), -0.5, (((2.0 / (((D * D) * w) * h)) * (d * d)) * c0)) * t_0;
                            	} else {
                            		tmp = t_5;
                            	}
                            	return tmp;
                            }
                            
                            function code(c0, w, h, D, d, M)
                            	t_0 = Float64(c0 / Float64(w * 2.0))
                            	t_1 = Float64(Float64(d * d) * c0)
                            	t_2 = Float64(t_1 / Float64(Float64(D * D) * Float64(h * w)))
                            	t_3 = Float64(Float64(sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))) + t_2) * t_0)
                            	t_4 = Float64(Float64(M / d) * D)
                            	t_5 = Float64(Float64(t_4 * t_4) * Float64(0.25 * h))
                            	tmp = 0.0
                            	if (t_3 <= -5e+57)
                            		tmp = Float64(Float64(Float64(t_1 * 2.0) / Float64(Float64(Float64(D * D) * h) * w)) * t_0);
                            	elseif (t_3 <= 2e-99)
                            		tmp = t_5;
                            	elseif (t_3 <= Inf)
                            		tmp = Float64(fma(Float64(Float64(Float64(w / t_1) * Float64(Float64(M * M) * h)) * Float64(D * D)), -0.5, Float64(Float64(Float64(2.0 / Float64(Float64(Float64(D * D) * w) * h)) * Float64(d * d)) * c0)) * t_0);
                            	else
                            		tmp = t_5;
                            	end
                            	return tmp
                            end
                            
                            code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(w * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$2), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$4 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$4 * t$95$4), $MachinePrecision] * N[(0.25 * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -5e+57], N[(N[(N[(t$95$1 * 2.0), $MachinePrecision] / N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[t$95$3, 2e-99], t$95$5, If[LessEqual[t$95$3, Infinity], N[(N[(N[(N[(N[(w / t$95$1), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] * -0.5 + N[(N[(N[(2.0 / N[(N[(N[(D * D), $MachinePrecision] * w), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] * N[(d * d), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], t$95$5]]]]]]]]]
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            t_0 := \frac{c0}{w \cdot 2}\\
                            t_1 := \left(d \cdot d\right) \cdot c0\\
                            t_2 := \frac{t\_1}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\
                            t_3 := \left(\sqrt{t\_2 \cdot t\_2 - M \cdot M} + t\_2\right) \cdot t\_0\\
                            t_4 := \frac{M}{d} \cdot D\\
                            t_5 := \left(t\_4 \cdot t\_4\right) \cdot \left(0.25 \cdot h\right)\\
                            \mathbf{if}\;t\_3 \leq -5 \cdot 10^{+57}:\\
                            \;\;\;\;\frac{t\_1 \cdot 2}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w} \cdot t\_0\\
                            
                            \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-99}:\\
                            \;\;\;\;t\_5\\
                            
                            \mathbf{elif}\;t\_3 \leq \infty:\\
                            \;\;\;\;\mathsf{fma}\left(\left(\frac{w}{t\_1} \cdot \left(\left(M \cdot M\right) \cdot h\right)\right) \cdot \left(D \cdot D\right), -0.5, \left(\frac{2}{\left(\left(D \cdot D\right) \cdot w\right) \cdot h} \cdot \left(d \cdot d\right)\right) \cdot c0\right) \cdot t\_0\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;t\_5\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 3 regimes
                            2. if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < -4.99999999999999972e57

                              1. Initial program 89.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. Add Preprocessing
                              3. Taylor expanded in c0 around inf

                                \[\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. *-commutativeN/A

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

                                  \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\frac{\left(c0 \cdot {d}^{2}\right) \cdot 2}{{D}^{2} \cdot \left(h \cdot w\right)}} \]
                                3. lower-/.f64N/A

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

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

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

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

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

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

                                  \[\leadsto \frac{c0}{2 \cdot w} \cdot \frac{\left(\left(d \cdot d\right) \cdot c0\right) \cdot 2}{\color{blue}{\left({D}^{2} \cdot h\right) \cdot w}} \]
                                10. lower-*.f64N/A

                                  \[\leadsto \frac{c0}{2 \cdot w} \cdot \frac{\left(\left(d \cdot d\right) \cdot c0\right) \cdot 2}{\color{blue}{\left({D}^{2} \cdot h\right) \cdot w}} \]
                                11. lower-*.f64N/A

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

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

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

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

                              if -4.99999999999999972e57 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < 2e-99 or +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 6.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. Add Preprocessing
                              3. Taylor expanded in c0 around -inf

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

                                  \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \cdot {c0}^{2}} \]
                                2. lower-*.f64N/A

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

                                \[\leadsto \color{blue}{\mathsf{fma}\left(\left(D \cdot \frac{D}{c0 \cdot c0}\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{h}{d \cdot d}\right), 0.25, 0\right) \cdot \left(c0 \cdot c0\right)} \]
                              6. Taylor expanded in c0 around 0

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

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

                                if 2e-99 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 85.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. Add Preprocessing
                                3. Taylor expanded in M around 0

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

                                    \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot w\right)\right)}{c0 \cdot {d}^{2}} \cdot \frac{-1}{2}} + 2 \cdot \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right) \]
                                  2. lower-fma.f64N/A

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

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

                                    \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\left(D \cdot D\right) \cdot \left(\left(\left(M \cdot M\right) \cdot h\right) \cdot \frac{w}{\left(d \cdot d\right) \cdot c0}\right), -0.5, c0 \cdot \left(\left(d \cdot d\right) \cdot \frac{2}{\left(\left(D \cdot D\right) \cdot w\right) \cdot h}\right)\right) \]
                                7. Recombined 3 regimes into one program.
                                8. Final simplification69.0%

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

                                Alternative 5: 69.5% accurate, 0.3× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{w \cdot 2}\\ t_1 := \frac{M}{d} \cdot D\\ t_2 := \left(t\_1 \cdot t\_1\right) \cdot \left(0.25 \cdot h\right)\\ t_3 := \left(d \cdot d\right) \cdot c0\\ t_4 := \frac{t\_3}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\ t_5 := \left(\sqrt{t\_4 \cdot t\_4 - M \cdot M} + t\_4\right) \cdot t\_0\\ t_6 := \frac{t\_3 \cdot 2}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w} \cdot t\_0\\ \mathbf{if}\;t\_5 \leq -5 \cdot 10^{+57}:\\ \;\;\;\;t\_6\\ \mathbf{elif}\;t\_5 \leq 2 \cdot 10^{-99}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_5 \leq \infty:\\ \;\;\;\;t\_6\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
                                (FPCore (c0 w h D d M)
                                 :precision binary64
                                 (let* ((t_0 (/ c0 (* w 2.0)))
                                        (t_1 (* (/ M d) D))
                                        (t_2 (* (* t_1 t_1) (* 0.25 h)))
                                        (t_3 (* (* d d) c0))
                                        (t_4 (/ t_3 (* (* D D) (* h w))))
                                        (t_5 (* (+ (sqrt (- (* t_4 t_4) (* M M))) t_4) t_0))
                                        (t_6 (* (/ (* t_3 2.0) (* (* (* D D) h) w)) t_0)))
                                   (if (<= t_5 -5e+57)
                                     t_6
                                     (if (<= t_5 2e-99) t_2 (if (<= t_5 INFINITY) t_6 t_2)))))
                                double code(double c0, double w, double h, double D, double d, double M) {
                                	double t_0 = c0 / (w * 2.0);
                                	double t_1 = (M / d) * D;
                                	double t_2 = (t_1 * t_1) * (0.25 * h);
                                	double t_3 = (d * d) * c0;
                                	double t_4 = t_3 / ((D * D) * (h * w));
                                	double t_5 = (sqrt(((t_4 * t_4) - (M * M))) + t_4) * t_0;
                                	double t_6 = ((t_3 * 2.0) / (((D * D) * h) * w)) * t_0;
                                	double tmp;
                                	if (t_5 <= -5e+57) {
                                		tmp = t_6;
                                	} else if (t_5 <= 2e-99) {
                                		tmp = t_2;
                                	} else if (t_5 <= ((double) INFINITY)) {
                                		tmp = t_6;
                                	} else {
                                		tmp = t_2;
                                	}
                                	return tmp;
                                }
                                
                                public static double code(double c0, double w, double h, double D, double d, double M) {
                                	double t_0 = c0 / (w * 2.0);
                                	double t_1 = (M / d) * D;
                                	double t_2 = (t_1 * t_1) * (0.25 * h);
                                	double t_3 = (d * d) * c0;
                                	double t_4 = t_3 / ((D * D) * (h * w));
                                	double t_5 = (Math.sqrt(((t_4 * t_4) - (M * M))) + t_4) * t_0;
                                	double t_6 = ((t_3 * 2.0) / (((D * D) * h) * w)) * t_0;
                                	double tmp;
                                	if (t_5 <= -5e+57) {
                                		tmp = t_6;
                                	} else if (t_5 <= 2e-99) {
                                		tmp = t_2;
                                	} else if (t_5 <= Double.POSITIVE_INFINITY) {
                                		tmp = t_6;
                                	} else {
                                		tmp = t_2;
                                	}
                                	return tmp;
                                }
                                
                                def code(c0, w, h, D, d, M):
                                	t_0 = c0 / (w * 2.0)
                                	t_1 = (M / d) * D
                                	t_2 = (t_1 * t_1) * (0.25 * h)
                                	t_3 = (d * d) * c0
                                	t_4 = t_3 / ((D * D) * (h * w))
                                	t_5 = (math.sqrt(((t_4 * t_4) - (M * M))) + t_4) * t_0
                                	t_6 = ((t_3 * 2.0) / (((D * D) * h) * w)) * t_0
                                	tmp = 0
                                	if t_5 <= -5e+57:
                                		tmp = t_6
                                	elif t_5 <= 2e-99:
                                		tmp = t_2
                                	elif t_5 <= math.inf:
                                		tmp = t_6
                                	else:
                                		tmp = t_2
                                	return tmp
                                
                                function code(c0, w, h, D, d, M)
                                	t_0 = Float64(c0 / Float64(w * 2.0))
                                	t_1 = Float64(Float64(M / d) * D)
                                	t_2 = Float64(Float64(t_1 * t_1) * Float64(0.25 * h))
                                	t_3 = Float64(Float64(d * d) * c0)
                                	t_4 = Float64(t_3 / Float64(Float64(D * D) * Float64(h * w)))
                                	t_5 = Float64(Float64(sqrt(Float64(Float64(t_4 * t_4) - Float64(M * M))) + t_4) * t_0)
                                	t_6 = Float64(Float64(Float64(t_3 * 2.0) / Float64(Float64(Float64(D * D) * h) * w)) * t_0)
                                	tmp = 0.0
                                	if (t_5 <= -5e+57)
                                		tmp = t_6;
                                	elseif (t_5 <= 2e-99)
                                		tmp = t_2;
                                	elseif (t_5 <= Inf)
                                		tmp = t_6;
                                	else
                                		tmp = t_2;
                                	end
                                	return tmp
                                end
                                
                                function tmp_2 = code(c0, w, h, D, d, M)
                                	t_0 = c0 / (w * 2.0);
                                	t_1 = (M / d) * D;
                                	t_2 = (t_1 * t_1) * (0.25 * h);
                                	t_3 = (d * d) * c0;
                                	t_4 = t_3 / ((D * D) * (h * w));
                                	t_5 = (sqrt(((t_4 * t_4) - (M * M))) + t_4) * t_0;
                                	t_6 = ((t_3 * 2.0) / (((D * D) * h) * w)) * t_0;
                                	tmp = 0.0;
                                	if (t_5 <= -5e+57)
                                		tmp = t_6;
                                	elseif (t_5 <= 2e-99)
                                		tmp = t_2;
                                	elseif (t_5 <= Inf)
                                		tmp = t_6;
                                	else
                                		tmp = t_2;
                                	end
                                	tmp_2 = tmp;
                                end
                                
                                code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(w * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(0.25 * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[Sqrt[N[(N[(t$95$4 * t$95$4), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$4), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[(t$95$3 * 2.0), $MachinePrecision] / N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$5, -5e+57], t$95$6, If[LessEqual[t$95$5, 2e-99], t$95$2, If[LessEqual[t$95$5, Infinity], t$95$6, t$95$2]]]]]]]]]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                t_0 := \frac{c0}{w \cdot 2}\\
                                t_1 := \frac{M}{d} \cdot D\\
                                t_2 := \left(t\_1 \cdot t\_1\right) \cdot \left(0.25 \cdot h\right)\\
                                t_3 := \left(d \cdot d\right) \cdot c0\\
                                t_4 := \frac{t\_3}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\
                                t_5 := \left(\sqrt{t\_4 \cdot t\_4 - M \cdot M} + t\_4\right) \cdot t\_0\\
                                t_6 := \frac{t\_3 \cdot 2}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w} \cdot t\_0\\
                                \mathbf{if}\;t\_5 \leq -5 \cdot 10^{+57}:\\
                                \;\;\;\;t\_6\\
                                
                                \mathbf{elif}\;t\_5 \leq 2 \cdot 10^{-99}:\\
                                \;\;\;\;t\_2\\
                                
                                \mathbf{elif}\;t\_5 \leq \infty:\\
                                \;\;\;\;t\_6\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;t\_2\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < -4.99999999999999972e57 or 2e-99 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 87.4%

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

                                    \[\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. *-commutativeN/A

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

                                      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\frac{\left(c0 \cdot {d}^{2}\right) \cdot 2}{{D}^{2} \cdot \left(h \cdot w\right)}} \]
                                    3. lower-/.f64N/A

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

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

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

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

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

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

                                      \[\leadsto \frac{c0}{2 \cdot w} \cdot \frac{\left(\left(d \cdot d\right) \cdot c0\right) \cdot 2}{\color{blue}{\left({D}^{2} \cdot h\right) \cdot w}} \]
                                    10. lower-*.f64N/A

                                      \[\leadsto \frac{c0}{2 \cdot w} \cdot \frac{\left(\left(d \cdot d\right) \cdot c0\right) \cdot 2}{\color{blue}{\left({D}^{2} \cdot h\right) \cdot w}} \]
                                    11. lower-*.f64N/A

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

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

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

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

                                  if -4.99999999999999972e57 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < 2e-99 or +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 6.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. Add Preprocessing
                                  3. Taylor expanded in c0 around -inf

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

                                      \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \cdot {c0}^{2}} \]
                                    2. lower-*.f64N/A

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

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(D \cdot \frac{D}{c0 \cdot c0}\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{h}{d \cdot d}\right), 0.25, 0\right) \cdot \left(c0 \cdot c0\right)} \]
                                  6. Taylor expanded in c0 around 0

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

                                      \[\leadsto \left(h \cdot 0.25\right) \cdot \color{blue}{\left(\left(\frac{M}{d} \cdot D\right) \cdot \left(\frac{M}{d} \cdot D\right)\right)} \]
                                  8. Recombined 2 regimes into one program.
                                  9. Final simplification69.0%

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

                                  Alternative 6: 67.7% accurate, 0.3× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{d}{D} \cdot d\\ t_1 := \frac{M}{d} \cdot D\\ t_2 := \left(t\_1 \cdot t\_1\right) \cdot \left(0.25 \cdot h\right)\\ t_3 := \frac{\left(d \cdot d\right) \cdot c0}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\ t_4 := \left(\sqrt{t\_3 \cdot t\_3 - M \cdot M} + t\_3\right) \cdot \frac{c0}{w \cdot 2}\\ \mathbf{if}\;t\_4 \leq -5 \cdot 10^{+57}:\\ \;\;\;\;\left(c0 \cdot c0\right) \cdot \frac{\frac{t\_0}{\left(D \cdot h\right) \cdot w}}{w}\\ \mathbf{elif}\;t\_4 \leq 2 \cdot 10^{-99}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_4 \leq \infty:\\ \;\;\;\;\frac{t\_0 \cdot c0}{\left(\left(w \cdot w\right) \cdot D\right) \cdot h} \cdot c0\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
                                  (FPCore (c0 w h D d M)
                                   :precision binary64
                                   (let* ((t_0 (* (/ d D) d))
                                          (t_1 (* (/ M d) D))
                                          (t_2 (* (* t_1 t_1) (* 0.25 h)))
                                          (t_3 (/ (* (* d d) c0) (* (* D D) (* h w))))
                                          (t_4 (* (+ (sqrt (- (* t_3 t_3) (* M M))) t_3) (/ c0 (* w 2.0)))))
                                     (if (<= t_4 -5e+57)
                                       (* (* c0 c0) (/ (/ t_0 (* (* D h) w)) w))
                                       (if (<= t_4 2e-99)
                                         t_2
                                         (if (<= t_4 INFINITY) (* (/ (* t_0 c0) (* (* (* w w) D) h)) c0) t_2)))))
                                  double code(double c0, double w, double h, double D, double d, double M) {
                                  	double t_0 = (d / D) * d;
                                  	double t_1 = (M / d) * D;
                                  	double t_2 = (t_1 * t_1) * (0.25 * h);
                                  	double t_3 = ((d * d) * c0) / ((D * D) * (h * w));
                                  	double t_4 = (sqrt(((t_3 * t_3) - (M * M))) + t_3) * (c0 / (w * 2.0));
                                  	double tmp;
                                  	if (t_4 <= -5e+57) {
                                  		tmp = (c0 * c0) * ((t_0 / ((D * h) * w)) / w);
                                  	} else if (t_4 <= 2e-99) {
                                  		tmp = t_2;
                                  	} else if (t_4 <= ((double) INFINITY)) {
                                  		tmp = ((t_0 * c0) / (((w * w) * D) * h)) * c0;
                                  	} else {
                                  		tmp = t_2;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  public static double code(double c0, double w, double h, double D, double d, double M) {
                                  	double t_0 = (d / D) * d;
                                  	double t_1 = (M / d) * D;
                                  	double t_2 = (t_1 * t_1) * (0.25 * h);
                                  	double t_3 = ((d * d) * c0) / ((D * D) * (h * w));
                                  	double t_4 = (Math.sqrt(((t_3 * t_3) - (M * M))) + t_3) * (c0 / (w * 2.0));
                                  	double tmp;
                                  	if (t_4 <= -5e+57) {
                                  		tmp = (c0 * c0) * ((t_0 / ((D * h) * w)) / w);
                                  	} else if (t_4 <= 2e-99) {
                                  		tmp = t_2;
                                  	} else if (t_4 <= Double.POSITIVE_INFINITY) {
                                  		tmp = ((t_0 * c0) / (((w * w) * D) * h)) * c0;
                                  	} else {
                                  		tmp = t_2;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  def code(c0, w, h, D, d, M):
                                  	t_0 = (d / D) * d
                                  	t_1 = (M / d) * D
                                  	t_2 = (t_1 * t_1) * (0.25 * h)
                                  	t_3 = ((d * d) * c0) / ((D * D) * (h * w))
                                  	t_4 = (math.sqrt(((t_3 * t_3) - (M * M))) + t_3) * (c0 / (w * 2.0))
                                  	tmp = 0
                                  	if t_4 <= -5e+57:
                                  		tmp = (c0 * c0) * ((t_0 / ((D * h) * w)) / w)
                                  	elif t_4 <= 2e-99:
                                  		tmp = t_2
                                  	elif t_4 <= math.inf:
                                  		tmp = ((t_0 * c0) / (((w * w) * D) * h)) * c0
                                  	else:
                                  		tmp = t_2
                                  	return tmp
                                  
                                  function code(c0, w, h, D, d, M)
                                  	t_0 = Float64(Float64(d / D) * d)
                                  	t_1 = Float64(Float64(M / d) * D)
                                  	t_2 = Float64(Float64(t_1 * t_1) * Float64(0.25 * h))
                                  	t_3 = Float64(Float64(Float64(d * d) * c0) / Float64(Float64(D * D) * Float64(h * w)))
                                  	t_4 = Float64(Float64(sqrt(Float64(Float64(t_3 * t_3) - Float64(M * M))) + t_3) * Float64(c0 / Float64(w * 2.0)))
                                  	tmp = 0.0
                                  	if (t_4 <= -5e+57)
                                  		tmp = Float64(Float64(c0 * c0) * Float64(Float64(t_0 / Float64(Float64(D * h) * w)) / w));
                                  	elseif (t_4 <= 2e-99)
                                  		tmp = t_2;
                                  	elseif (t_4 <= Inf)
                                  		tmp = Float64(Float64(Float64(t_0 * c0) / Float64(Float64(Float64(w * w) * D) * h)) * c0);
                                  	else
                                  		tmp = t_2;
                                  	end
                                  	return tmp
                                  end
                                  
                                  function tmp_2 = code(c0, w, h, D, d, M)
                                  	t_0 = (d / D) * d;
                                  	t_1 = (M / d) * D;
                                  	t_2 = (t_1 * t_1) * (0.25 * h);
                                  	t_3 = ((d * d) * c0) / ((D * D) * (h * w));
                                  	t_4 = (sqrt(((t_3 * t_3) - (M * M))) + t_3) * (c0 / (w * 2.0));
                                  	tmp = 0.0;
                                  	if (t_4 <= -5e+57)
                                  		tmp = (c0 * c0) * ((t_0 / ((D * h) * w)) / w);
                                  	elseif (t_4 <= 2e-99)
                                  		tmp = t_2;
                                  	elseif (t_4 <= Inf)
                                  		tmp = ((t_0 * c0) / (((w * w) * D) * h)) * c0;
                                  	else
                                  		tmp = t_2;
                                  	end
                                  	tmp_2 = tmp;
                                  end
                                  
                                  code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(d / D), $MachinePrecision] * d), $MachinePrecision]}, Block[{t$95$1 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(0.25 * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Sqrt[N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$3), $MachinePrecision] * N[(c0 / N[(w * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -5e+57], N[(N[(c0 * c0), $MachinePrecision] * N[(N[(t$95$0 / N[(N[(D * h), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 2e-99], t$95$2, If[LessEqual[t$95$4, Infinity], N[(N[(N[(t$95$0 * c0), $MachinePrecision] / N[(N[(N[(w * w), $MachinePrecision] * D), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], t$95$2]]]]]]]]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \begin{array}{l}
                                  t_0 := \frac{d}{D} \cdot d\\
                                  t_1 := \frac{M}{d} \cdot D\\
                                  t_2 := \left(t\_1 \cdot t\_1\right) \cdot \left(0.25 \cdot h\right)\\
                                  t_3 := \frac{\left(d \cdot d\right) \cdot c0}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\
                                  t_4 := \left(\sqrt{t\_3 \cdot t\_3 - M \cdot M} + t\_3\right) \cdot \frac{c0}{w \cdot 2}\\
                                  \mathbf{if}\;t\_4 \leq -5 \cdot 10^{+57}:\\
                                  \;\;\;\;\left(c0 \cdot c0\right) \cdot \frac{\frac{t\_0}{\left(D \cdot h\right) \cdot w}}{w}\\
                                  
                                  \mathbf{elif}\;t\_4 \leq 2 \cdot 10^{-99}:\\
                                  \;\;\;\;t\_2\\
                                  
                                  \mathbf{elif}\;t\_4 \leq \infty:\\
                                  \;\;\;\;\frac{t\_0 \cdot c0}{\left(\left(w \cdot w\right) \cdot D\right) \cdot h} \cdot c0\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;t\_2\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 3 regimes
                                  2. if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < -4.99999999999999972e57

                                    1. Initial program 89.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. Add Preprocessing
                                    3. Applied rewrites76.5%

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

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

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

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

                                        \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot {c0}^{2}} \]
                                      4. lower-/.f64N/A

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

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

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

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

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

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

                                        \[\leadsto \frac{d \cdot d}{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {w}^{2}} \cdot {c0}^{2} \]
                                      11. lower-*.f64N/A

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

                                        \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \cdot {c0}^{2} \]
                                      13. lower-*.f64N/A

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

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

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

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

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

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

                                        if -4.99999999999999972e57 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < 2e-99 or +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 6.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. Add Preprocessing
                                        3. Taylor expanded in c0 around -inf

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

                                            \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \cdot {c0}^{2}} \]
                                          2. lower-*.f64N/A

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

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(\left(D \cdot \frac{D}{c0 \cdot c0}\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{h}{d \cdot d}\right), 0.25, 0\right) \cdot \left(c0 \cdot c0\right)} \]
                                        6. Taylor expanded in c0 around 0

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

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

                                          if 2e-99 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 85.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. Add Preprocessing
                                          3. Applied rewrites76.4%

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

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

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

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

                                              \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot {c0}^{2}} \]
                                            4. lower-/.f64N/A

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

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

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

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

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

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

                                              \[\leadsto \frac{d \cdot d}{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {w}^{2}} \cdot {c0}^{2} \]
                                            11. lower-*.f64N/A

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

                                              \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \cdot {c0}^{2} \]
                                            13. lower-*.f64N/A

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

                                              \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \left(w \cdot w\right)} \cdot \color{blue}{\left(c0 \cdot c0\right)} \]
                                            15. lower-*.f6466.8

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

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

                                              \[\leadsto \frac{d \cdot d}{D \cdot \left(\left(h \cdot D\right) \cdot \left(w \cdot w\right)\right)} \cdot \left(c0 \cdot c0\right) \]
                                            2. Step-by-step derivation
                                              1. Applied rewrites82.2%

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

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

                                            Alternative 7: 67.7% accurate, 0.3× speedup?

                                            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{M}{d} \cdot D\\ t_1 := \frac{\left(d \cdot d\right) \cdot c0}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\ t_2 := \left(\sqrt{t\_1 \cdot t\_1 - M \cdot M} + t\_1\right) \cdot \frac{c0}{w \cdot 2}\\ t_3 := \left(t\_0 \cdot t\_0\right) \cdot \left(0.25 \cdot h\right)\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{+125}:\\ \;\;\;\;\frac{\left(\frac{d}{h} \cdot \frac{d}{D \cdot D}\right) \cdot c0}{w \cdot w} \cdot c0\\ \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-99}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;\frac{\left(\frac{d}{D} \cdot d\right) \cdot c0}{\left(\left(w \cdot w\right) \cdot D\right) \cdot h} \cdot c0\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
                                            (FPCore (c0 w h D d M)
                                             :precision binary64
                                             (let* ((t_0 (* (/ M d) D))
                                                    (t_1 (/ (* (* d d) c0) (* (* D D) (* h w))))
                                                    (t_2 (* (+ (sqrt (- (* t_1 t_1) (* M M))) t_1) (/ c0 (* w 2.0))))
                                                    (t_3 (* (* t_0 t_0) (* 0.25 h))))
                                               (if (<= t_2 -2e+125)
                                                 (* (/ (* (* (/ d h) (/ d (* D D))) c0) (* w w)) c0)
                                                 (if (<= t_2 2e-99)
                                                   t_3
                                                   (if (<= t_2 INFINITY)
                                                     (* (/ (* (* (/ d D) d) c0) (* (* (* w w) D) h)) c0)
                                                     t_3)))))
                                            double code(double c0, double w, double h, double D, double d, double M) {
                                            	double t_0 = (M / d) * D;
                                            	double t_1 = ((d * d) * c0) / ((D * D) * (h * w));
                                            	double t_2 = (sqrt(((t_1 * t_1) - (M * M))) + t_1) * (c0 / (w * 2.0));
                                            	double t_3 = (t_0 * t_0) * (0.25 * h);
                                            	double tmp;
                                            	if (t_2 <= -2e+125) {
                                            		tmp = ((((d / h) * (d / (D * D))) * c0) / (w * w)) * c0;
                                            	} else if (t_2 <= 2e-99) {
                                            		tmp = t_3;
                                            	} else if (t_2 <= ((double) INFINITY)) {
                                            		tmp = ((((d / D) * d) * c0) / (((w * w) * D) * h)) * c0;
                                            	} else {
                                            		tmp = t_3;
                                            	}
                                            	return tmp;
                                            }
                                            
                                            public static double code(double c0, double w, double h, double D, double d, double M) {
                                            	double t_0 = (M / d) * D;
                                            	double t_1 = ((d * d) * c0) / ((D * D) * (h * w));
                                            	double t_2 = (Math.sqrt(((t_1 * t_1) - (M * M))) + t_1) * (c0 / (w * 2.0));
                                            	double t_3 = (t_0 * t_0) * (0.25 * h);
                                            	double tmp;
                                            	if (t_2 <= -2e+125) {
                                            		tmp = ((((d / h) * (d / (D * D))) * c0) / (w * w)) * c0;
                                            	} else if (t_2 <= 2e-99) {
                                            		tmp = t_3;
                                            	} else if (t_2 <= Double.POSITIVE_INFINITY) {
                                            		tmp = ((((d / D) * d) * c0) / (((w * w) * D) * h)) * c0;
                                            	} else {
                                            		tmp = t_3;
                                            	}
                                            	return tmp;
                                            }
                                            
                                            def code(c0, w, h, D, d, M):
                                            	t_0 = (M / d) * D
                                            	t_1 = ((d * d) * c0) / ((D * D) * (h * w))
                                            	t_2 = (math.sqrt(((t_1 * t_1) - (M * M))) + t_1) * (c0 / (w * 2.0))
                                            	t_3 = (t_0 * t_0) * (0.25 * h)
                                            	tmp = 0
                                            	if t_2 <= -2e+125:
                                            		tmp = ((((d / h) * (d / (D * D))) * c0) / (w * w)) * c0
                                            	elif t_2 <= 2e-99:
                                            		tmp = t_3
                                            	elif t_2 <= math.inf:
                                            		tmp = ((((d / D) * d) * c0) / (((w * w) * D) * h)) * c0
                                            	else:
                                            		tmp = t_3
                                            	return tmp
                                            
                                            function code(c0, w, h, D, d, M)
                                            	t_0 = Float64(Float64(M / d) * D)
                                            	t_1 = Float64(Float64(Float64(d * d) * c0) / Float64(Float64(D * D) * Float64(h * w)))
                                            	t_2 = Float64(Float64(sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))) + t_1) * Float64(c0 / Float64(w * 2.0)))
                                            	t_3 = Float64(Float64(t_0 * t_0) * Float64(0.25 * h))
                                            	tmp = 0.0
                                            	if (t_2 <= -2e+125)
                                            		tmp = Float64(Float64(Float64(Float64(Float64(d / h) * Float64(d / Float64(D * D))) * c0) / Float64(w * w)) * c0);
                                            	elseif (t_2 <= 2e-99)
                                            		tmp = t_3;
                                            	elseif (t_2 <= Inf)
                                            		tmp = Float64(Float64(Float64(Float64(Float64(d / D) * d) * c0) / Float64(Float64(Float64(w * w) * D) * h)) * c0);
                                            	else
                                            		tmp = t_3;
                                            	end
                                            	return tmp
                                            end
                                            
                                            function tmp_2 = code(c0, w, h, D, d, M)
                                            	t_0 = (M / d) * D;
                                            	t_1 = ((d * d) * c0) / ((D * D) * (h * w));
                                            	t_2 = (sqrt(((t_1 * t_1) - (M * M))) + t_1) * (c0 / (w * 2.0));
                                            	t_3 = (t_0 * t_0) * (0.25 * h);
                                            	tmp = 0.0;
                                            	if (t_2 <= -2e+125)
                                            		tmp = ((((d / h) * (d / (D * D))) * c0) / (w * w)) * c0;
                                            	elseif (t_2 <= 2e-99)
                                            		tmp = t_3;
                                            	elseif (t_2 <= Inf)
                                            		tmp = ((((d / D) * d) * c0) / (((w * w) * D) * h)) * c0;
                                            	else
                                            		tmp = t_3;
                                            	end
                                            	tmp_2 = tmp;
                                            end
                                            
                                            code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] * N[(c0 / N[(w * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(0.25 * h), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+125], N[(N[(N[(N[(N[(d / h), $MachinePrecision] * N[(d / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] / N[(w * w), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], If[LessEqual[t$95$2, 2e-99], t$95$3, If[LessEqual[t$95$2, Infinity], N[(N[(N[(N[(N[(d / D), $MachinePrecision] * d), $MachinePrecision] * c0), $MachinePrecision] / N[(N[(N[(w * w), $MachinePrecision] * D), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], t$95$3]]]]]]]
                                            
                                            \begin{array}{l}
                                            
                                            \\
                                            \begin{array}{l}
                                            t_0 := \frac{M}{d} \cdot D\\
                                            t_1 := \frac{\left(d \cdot d\right) \cdot c0}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\
                                            t_2 := \left(\sqrt{t\_1 \cdot t\_1 - M \cdot M} + t\_1\right) \cdot \frac{c0}{w \cdot 2}\\
                                            t_3 := \left(t\_0 \cdot t\_0\right) \cdot \left(0.25 \cdot h\right)\\
                                            \mathbf{if}\;t\_2 \leq -2 \cdot 10^{+125}:\\
                                            \;\;\;\;\frac{\left(\frac{d}{h} \cdot \frac{d}{D \cdot D}\right) \cdot c0}{w \cdot w} \cdot c0\\
                                            
                                            \mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-99}:\\
                                            \;\;\;\;t\_3\\
                                            
                                            \mathbf{elif}\;t\_2 \leq \infty:\\
                                            \;\;\;\;\frac{\left(\frac{d}{D} \cdot d\right) \cdot c0}{\left(\left(w \cdot w\right) \cdot D\right) \cdot h} \cdot c0\\
                                            
                                            \mathbf{else}:\\
                                            \;\;\;\;t\_3\\
                                            
                                            
                                            \end{array}
                                            \end{array}
                                            
                                            Derivation
                                            1. Split input into 3 regimes
                                            2. if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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.9999999999999998e125

                                              1. Initial program 91.6%

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

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

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

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

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

                                                  \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot {c0}^{2}} \]
                                                4. lower-/.f64N/A

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

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

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

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

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

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

                                                  \[\leadsto \frac{d \cdot d}{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {w}^{2}} \cdot {c0}^{2} \]
                                                11. lower-*.f64N/A

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

                                                  \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \cdot {c0}^{2} \]
                                                13. lower-*.f64N/A

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

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

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

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

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

                                                  \[\leadsto \frac{\frac{{d}^{2}}{{D}^{2} \cdot h} \cdot c0}{w \cdot w} \cdot c0 \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites87.4%

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

                                                  if -1.9999999999999998e125 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < 2e-99 or +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 7.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. Add Preprocessing
                                                  3. Taylor expanded in c0 around -inf

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

                                                      \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \cdot {c0}^{2}} \]
                                                    2. lower-*.f64N/A

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

                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(\left(D \cdot \frac{D}{c0 \cdot c0}\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{h}{d \cdot d}\right), 0.25, 0\right) \cdot \left(c0 \cdot c0\right)} \]
                                                  6. Taylor expanded in c0 around 0

                                                    \[\leadsto \frac{1}{4} \cdot \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}} \]
                                                  7. Step-by-step derivation
                                                    1. Applied rewrites63.6%

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

                                                    if 2e-99 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 85.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. Add Preprocessing
                                                    3. Applied rewrites76.4%

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

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

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

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

                                                        \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot {c0}^{2}} \]
                                                      4. lower-/.f64N/A

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

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

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

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

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

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

                                                        \[\leadsto \frac{d \cdot d}{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {w}^{2}} \cdot {c0}^{2} \]
                                                      11. lower-*.f64N/A

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

                                                        \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \cdot {c0}^{2} \]
                                                      13. lower-*.f64N/A

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

                                                        \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \left(w \cdot w\right)} \cdot \color{blue}{\left(c0 \cdot c0\right)} \]
                                                      15. lower-*.f6466.8

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

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

                                                        \[\leadsto \frac{d \cdot d}{D \cdot \left(\left(h \cdot D\right) \cdot \left(w \cdot w\right)\right)} \cdot \left(c0 \cdot c0\right) \]
                                                      2. Step-by-step derivation
                                                        1. Applied rewrites82.2%

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

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

                                                      Alternative 8: 67.8% accurate, 0.3× speedup?

                                                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{M}{d} \cdot D\\ t_1 := \left(t\_0 \cdot t\_0\right) \cdot \left(0.25 \cdot h\right)\\ t_2 := \left(d \cdot d\right) \cdot c0\\ t_3 := \frac{t\_2}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\ t_4 := \left(\sqrt{t\_3 \cdot t\_3 - M \cdot M} + t\_3\right) \cdot \frac{c0}{w \cdot 2}\\ \mathbf{if}\;t\_4 \leq -2 \cdot 10^{+125}:\\ \;\;\;\;\frac{t\_2}{\left(\left(\left(w \cdot w\right) \cdot h\right) \cdot D\right) \cdot D} \cdot c0\\ \mathbf{elif}\;t\_4 \leq 2 \cdot 10^{-99}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_4 \leq \infty:\\ \;\;\;\;\frac{\left(\frac{d}{D} \cdot d\right) \cdot c0}{\left(\left(w \cdot w\right) \cdot D\right) \cdot h} \cdot c0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                                                      (FPCore (c0 w h D d M)
                                                       :precision binary64
                                                       (let* ((t_0 (* (/ M d) D))
                                                              (t_1 (* (* t_0 t_0) (* 0.25 h)))
                                                              (t_2 (* (* d d) c0))
                                                              (t_3 (/ t_2 (* (* D D) (* h w))))
                                                              (t_4 (* (+ (sqrt (- (* t_3 t_3) (* M M))) t_3) (/ c0 (* w 2.0)))))
                                                         (if (<= t_4 -2e+125)
                                                           (* (/ t_2 (* (* (* (* w w) h) D) D)) c0)
                                                           (if (<= t_4 2e-99)
                                                             t_1
                                                             (if (<= t_4 INFINITY)
                                                               (* (/ (* (* (/ d D) d) c0) (* (* (* w w) D) h)) c0)
                                                               t_1)))))
                                                      double code(double c0, double w, double h, double D, double d, double M) {
                                                      	double t_0 = (M / d) * D;
                                                      	double t_1 = (t_0 * t_0) * (0.25 * h);
                                                      	double t_2 = (d * d) * c0;
                                                      	double t_3 = t_2 / ((D * D) * (h * w));
                                                      	double t_4 = (sqrt(((t_3 * t_3) - (M * M))) + t_3) * (c0 / (w * 2.0));
                                                      	double tmp;
                                                      	if (t_4 <= -2e+125) {
                                                      		tmp = (t_2 / ((((w * w) * h) * D) * D)) * c0;
                                                      	} else if (t_4 <= 2e-99) {
                                                      		tmp = t_1;
                                                      	} else if (t_4 <= ((double) INFINITY)) {
                                                      		tmp = ((((d / D) * d) * c0) / (((w * w) * D) * h)) * c0;
                                                      	} else {
                                                      		tmp = t_1;
                                                      	}
                                                      	return tmp;
                                                      }
                                                      
                                                      public static double code(double c0, double w, double h, double D, double d, double M) {
                                                      	double t_0 = (M / d) * D;
                                                      	double t_1 = (t_0 * t_0) * (0.25 * h);
                                                      	double t_2 = (d * d) * c0;
                                                      	double t_3 = t_2 / ((D * D) * (h * w));
                                                      	double t_4 = (Math.sqrt(((t_3 * t_3) - (M * M))) + t_3) * (c0 / (w * 2.0));
                                                      	double tmp;
                                                      	if (t_4 <= -2e+125) {
                                                      		tmp = (t_2 / ((((w * w) * h) * D) * D)) * c0;
                                                      	} else if (t_4 <= 2e-99) {
                                                      		tmp = t_1;
                                                      	} else if (t_4 <= Double.POSITIVE_INFINITY) {
                                                      		tmp = ((((d / D) * d) * c0) / (((w * w) * D) * h)) * c0;
                                                      	} else {
                                                      		tmp = t_1;
                                                      	}
                                                      	return tmp;
                                                      }
                                                      
                                                      def code(c0, w, h, D, d, M):
                                                      	t_0 = (M / d) * D
                                                      	t_1 = (t_0 * t_0) * (0.25 * h)
                                                      	t_2 = (d * d) * c0
                                                      	t_3 = t_2 / ((D * D) * (h * w))
                                                      	t_4 = (math.sqrt(((t_3 * t_3) - (M * M))) + t_3) * (c0 / (w * 2.0))
                                                      	tmp = 0
                                                      	if t_4 <= -2e+125:
                                                      		tmp = (t_2 / ((((w * w) * h) * D) * D)) * c0
                                                      	elif t_4 <= 2e-99:
                                                      		tmp = t_1
                                                      	elif t_4 <= math.inf:
                                                      		tmp = ((((d / D) * d) * c0) / (((w * w) * D) * h)) * c0
                                                      	else:
                                                      		tmp = t_1
                                                      	return tmp
                                                      
                                                      function code(c0, w, h, D, d, M)
                                                      	t_0 = Float64(Float64(M / d) * D)
                                                      	t_1 = Float64(Float64(t_0 * t_0) * Float64(0.25 * h))
                                                      	t_2 = Float64(Float64(d * d) * c0)
                                                      	t_3 = Float64(t_2 / Float64(Float64(D * D) * Float64(h * w)))
                                                      	t_4 = Float64(Float64(sqrt(Float64(Float64(t_3 * t_3) - Float64(M * M))) + t_3) * Float64(c0 / Float64(w * 2.0)))
                                                      	tmp = 0.0
                                                      	if (t_4 <= -2e+125)
                                                      		tmp = Float64(Float64(t_2 / Float64(Float64(Float64(Float64(w * w) * h) * D) * D)) * c0);
                                                      	elseif (t_4 <= 2e-99)
                                                      		tmp = t_1;
                                                      	elseif (t_4 <= Inf)
                                                      		tmp = Float64(Float64(Float64(Float64(Float64(d / D) * d) * c0) / Float64(Float64(Float64(w * w) * D) * h)) * c0);
                                                      	else
                                                      		tmp = t_1;
                                                      	end
                                                      	return tmp
                                                      end
                                                      
                                                      function tmp_2 = code(c0, w, h, D, d, M)
                                                      	t_0 = (M / d) * D;
                                                      	t_1 = (t_0 * t_0) * (0.25 * h);
                                                      	t_2 = (d * d) * c0;
                                                      	t_3 = t_2 / ((D * D) * (h * w));
                                                      	t_4 = (sqrt(((t_3 * t_3) - (M * M))) + t_3) * (c0 / (w * 2.0));
                                                      	tmp = 0.0;
                                                      	if (t_4 <= -2e+125)
                                                      		tmp = (t_2 / ((((w * w) * h) * D) * D)) * c0;
                                                      	elseif (t_4 <= 2e-99)
                                                      		tmp = t_1;
                                                      	elseif (t_4 <= Inf)
                                                      		tmp = ((((d / D) * d) * c0) / (((w * w) * D) * h)) * c0;
                                                      	else
                                                      		tmp = t_1;
                                                      	end
                                                      	tmp_2 = tmp;
                                                      end
                                                      
                                                      code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(0.25 * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Sqrt[N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$3), $MachinePrecision] * N[(c0 / N[(w * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -2e+125], N[(N[(t$95$2 / N[(N[(N[(N[(w * w), $MachinePrecision] * h), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], If[LessEqual[t$95$4, 2e-99], t$95$1, If[LessEqual[t$95$4, Infinity], N[(N[(N[(N[(N[(d / D), $MachinePrecision] * d), $MachinePrecision] * c0), $MachinePrecision] / N[(N[(N[(w * w), $MachinePrecision] * D), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], t$95$1]]]]]]]]
                                                      
                                                      \begin{array}{l}
                                                      
                                                      \\
                                                      \begin{array}{l}
                                                      t_0 := \frac{M}{d} \cdot D\\
                                                      t_1 := \left(t\_0 \cdot t\_0\right) \cdot \left(0.25 \cdot h\right)\\
                                                      t_2 := \left(d \cdot d\right) \cdot c0\\
                                                      t_3 := \frac{t\_2}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\
                                                      t_4 := \left(\sqrt{t\_3 \cdot t\_3 - M \cdot M} + t\_3\right) \cdot \frac{c0}{w \cdot 2}\\
                                                      \mathbf{if}\;t\_4 \leq -2 \cdot 10^{+125}:\\
                                                      \;\;\;\;\frac{t\_2}{\left(\left(\left(w \cdot w\right) \cdot h\right) \cdot D\right) \cdot D} \cdot c0\\
                                                      
                                                      \mathbf{elif}\;t\_4 \leq 2 \cdot 10^{-99}:\\
                                                      \;\;\;\;t\_1\\
                                                      
                                                      \mathbf{elif}\;t\_4 \leq \infty:\\
                                                      \;\;\;\;\frac{\left(\frac{d}{D} \cdot d\right) \cdot c0}{\left(\left(w \cdot w\right) \cdot D\right) \cdot h} \cdot c0\\
                                                      
                                                      \mathbf{else}:\\
                                                      \;\;\;\;t\_1\\
                                                      
                                                      
                                                      \end{array}
                                                      \end{array}
                                                      
                                                      Derivation
                                                      1. Split input into 3 regimes
                                                      2. if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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.9999999999999998e125

                                                        1. Initial program 91.6%

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

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

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

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

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

                                                            \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot {c0}^{2}} \]
                                                          4. lower-/.f64N/A

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

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

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

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

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

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

                                                            \[\leadsto \frac{d \cdot d}{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {w}^{2}} \cdot {c0}^{2} \]
                                                          11. lower-*.f64N/A

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

                                                            \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \cdot {c0}^{2} \]
                                                          13. lower-*.f64N/A

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

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

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

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

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

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

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

                                                            if -1.9999999999999998e125 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < 2e-99 or +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 7.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. Add Preprocessing
                                                            3. Taylor expanded in c0 around -inf

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

                                                                \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \cdot {c0}^{2}} \]
                                                              2. lower-*.f64N/A

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

                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(\left(D \cdot \frac{D}{c0 \cdot c0}\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{h}{d \cdot d}\right), 0.25, 0\right) \cdot \left(c0 \cdot c0\right)} \]
                                                            6. Taylor expanded in c0 around 0

                                                              \[\leadsto \frac{1}{4} \cdot \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}} \]
                                                            7. Step-by-step derivation
                                                              1. Applied rewrites63.6%

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

                                                              if 2e-99 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 85.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. Add Preprocessing
                                                              3. Applied rewrites76.4%

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

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

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

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

                                                                  \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot {c0}^{2}} \]
                                                                4. lower-/.f64N/A

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

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

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

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

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

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

                                                                  \[\leadsto \frac{d \cdot d}{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {w}^{2}} \cdot {c0}^{2} \]
                                                                11. lower-*.f64N/A

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

                                                                  \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \cdot {c0}^{2} \]
                                                                13. lower-*.f64N/A

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

                                                                  \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \left(w \cdot w\right)} \cdot \color{blue}{\left(c0 \cdot c0\right)} \]
                                                                15. lower-*.f6466.8

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

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

                                                                  \[\leadsto \frac{d \cdot d}{D \cdot \left(\left(h \cdot D\right) \cdot \left(w \cdot w\right)\right)} \cdot \left(c0 \cdot c0\right) \]
                                                                2. Step-by-step derivation
                                                                  1. Applied rewrites82.2%

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

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

                                                                Alternative 9: 67.5% accurate, 0.3× speedup?

                                                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{M}{d} \cdot D\\ t_1 := \left(t\_0 \cdot t\_0\right) \cdot \left(0.25 \cdot h\right)\\ t_2 := \left(d \cdot d\right) \cdot c0\\ t_3 := \frac{t\_2}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\ t_4 := \left(\sqrt{t\_3 \cdot t\_3 - M \cdot M} + t\_3\right) \cdot \frac{c0}{w \cdot 2}\\ t_5 := \frac{t\_2}{\left(\left(\left(w \cdot w\right) \cdot h\right) \cdot D\right) \cdot D} \cdot c0\\ \mathbf{if}\;t\_4 \leq -2 \cdot 10^{+125}:\\ \;\;\;\;t\_5\\ \mathbf{elif}\;t\_4 \leq 2 \cdot 10^{-99}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_4 \leq \infty:\\ \;\;\;\;t\_5\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                                                                (FPCore (c0 w h D d M)
                                                                 :precision binary64
                                                                 (let* ((t_0 (* (/ M d) D))
                                                                        (t_1 (* (* t_0 t_0) (* 0.25 h)))
                                                                        (t_2 (* (* d d) c0))
                                                                        (t_3 (/ t_2 (* (* D D) (* h w))))
                                                                        (t_4 (* (+ (sqrt (- (* t_3 t_3) (* M M))) t_3) (/ c0 (* w 2.0))))
                                                                        (t_5 (* (/ t_2 (* (* (* (* w w) h) D) D)) c0)))
                                                                   (if (<= t_4 -2e+125)
                                                                     t_5
                                                                     (if (<= t_4 2e-99) t_1 (if (<= t_4 INFINITY) t_5 t_1)))))
                                                                double code(double c0, double w, double h, double D, double d, double M) {
                                                                	double t_0 = (M / d) * D;
                                                                	double t_1 = (t_0 * t_0) * (0.25 * h);
                                                                	double t_2 = (d * d) * c0;
                                                                	double t_3 = t_2 / ((D * D) * (h * w));
                                                                	double t_4 = (sqrt(((t_3 * t_3) - (M * M))) + t_3) * (c0 / (w * 2.0));
                                                                	double t_5 = (t_2 / ((((w * w) * h) * D) * D)) * c0;
                                                                	double tmp;
                                                                	if (t_4 <= -2e+125) {
                                                                		tmp = t_5;
                                                                	} else if (t_4 <= 2e-99) {
                                                                		tmp = t_1;
                                                                	} else if (t_4 <= ((double) INFINITY)) {
                                                                		tmp = t_5;
                                                                	} else {
                                                                		tmp = t_1;
                                                                	}
                                                                	return tmp;
                                                                }
                                                                
                                                                public static double code(double c0, double w, double h, double D, double d, double M) {
                                                                	double t_0 = (M / d) * D;
                                                                	double t_1 = (t_0 * t_0) * (0.25 * h);
                                                                	double t_2 = (d * d) * c0;
                                                                	double t_3 = t_2 / ((D * D) * (h * w));
                                                                	double t_4 = (Math.sqrt(((t_3 * t_3) - (M * M))) + t_3) * (c0 / (w * 2.0));
                                                                	double t_5 = (t_2 / ((((w * w) * h) * D) * D)) * c0;
                                                                	double tmp;
                                                                	if (t_4 <= -2e+125) {
                                                                		tmp = t_5;
                                                                	} else if (t_4 <= 2e-99) {
                                                                		tmp = t_1;
                                                                	} else if (t_4 <= Double.POSITIVE_INFINITY) {
                                                                		tmp = t_5;
                                                                	} else {
                                                                		tmp = t_1;
                                                                	}
                                                                	return tmp;
                                                                }
                                                                
                                                                def code(c0, w, h, D, d, M):
                                                                	t_0 = (M / d) * D
                                                                	t_1 = (t_0 * t_0) * (0.25 * h)
                                                                	t_2 = (d * d) * c0
                                                                	t_3 = t_2 / ((D * D) * (h * w))
                                                                	t_4 = (math.sqrt(((t_3 * t_3) - (M * M))) + t_3) * (c0 / (w * 2.0))
                                                                	t_5 = (t_2 / ((((w * w) * h) * D) * D)) * c0
                                                                	tmp = 0
                                                                	if t_4 <= -2e+125:
                                                                		tmp = t_5
                                                                	elif t_4 <= 2e-99:
                                                                		tmp = t_1
                                                                	elif t_4 <= math.inf:
                                                                		tmp = t_5
                                                                	else:
                                                                		tmp = t_1
                                                                	return tmp
                                                                
                                                                function code(c0, w, h, D, d, M)
                                                                	t_0 = Float64(Float64(M / d) * D)
                                                                	t_1 = Float64(Float64(t_0 * t_0) * Float64(0.25 * h))
                                                                	t_2 = Float64(Float64(d * d) * c0)
                                                                	t_3 = Float64(t_2 / Float64(Float64(D * D) * Float64(h * w)))
                                                                	t_4 = Float64(Float64(sqrt(Float64(Float64(t_3 * t_3) - Float64(M * M))) + t_3) * Float64(c0 / Float64(w * 2.0)))
                                                                	t_5 = Float64(Float64(t_2 / Float64(Float64(Float64(Float64(w * w) * h) * D) * D)) * c0)
                                                                	tmp = 0.0
                                                                	if (t_4 <= -2e+125)
                                                                		tmp = t_5;
                                                                	elseif (t_4 <= 2e-99)
                                                                		tmp = t_1;
                                                                	elseif (t_4 <= Inf)
                                                                		tmp = t_5;
                                                                	else
                                                                		tmp = t_1;
                                                                	end
                                                                	return tmp
                                                                end
                                                                
                                                                function tmp_2 = code(c0, w, h, D, d, M)
                                                                	t_0 = (M / d) * D;
                                                                	t_1 = (t_0 * t_0) * (0.25 * h);
                                                                	t_2 = (d * d) * c0;
                                                                	t_3 = t_2 / ((D * D) * (h * w));
                                                                	t_4 = (sqrt(((t_3 * t_3) - (M * M))) + t_3) * (c0 / (w * 2.0));
                                                                	t_5 = (t_2 / ((((w * w) * h) * D) * D)) * c0;
                                                                	tmp = 0.0;
                                                                	if (t_4 <= -2e+125)
                                                                		tmp = t_5;
                                                                	elseif (t_4 <= 2e-99)
                                                                		tmp = t_1;
                                                                	elseif (t_4 <= Inf)
                                                                		tmp = t_5;
                                                                	else
                                                                		tmp = t_1;
                                                                	end
                                                                	tmp_2 = tmp;
                                                                end
                                                                
                                                                code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(0.25 * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Sqrt[N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$3), $MachinePrecision] * N[(c0 / N[(w * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$2 / N[(N[(N[(N[(w * w), $MachinePrecision] * h), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision]}, If[LessEqual[t$95$4, -2e+125], t$95$5, If[LessEqual[t$95$4, 2e-99], t$95$1, If[LessEqual[t$95$4, Infinity], t$95$5, t$95$1]]]]]]]]]
                                                                
                                                                \begin{array}{l}
                                                                
                                                                \\
                                                                \begin{array}{l}
                                                                t_0 := \frac{M}{d} \cdot D\\
                                                                t_1 := \left(t\_0 \cdot t\_0\right) \cdot \left(0.25 \cdot h\right)\\
                                                                t_2 := \left(d \cdot d\right) \cdot c0\\
                                                                t_3 := \frac{t\_2}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\
                                                                t_4 := \left(\sqrt{t\_3 \cdot t\_3 - M \cdot M} + t\_3\right) \cdot \frac{c0}{w \cdot 2}\\
                                                                t_5 := \frac{t\_2}{\left(\left(\left(w \cdot w\right) \cdot h\right) \cdot D\right) \cdot D} \cdot c0\\
                                                                \mathbf{if}\;t\_4 \leq -2 \cdot 10^{+125}:\\
                                                                \;\;\;\;t\_5\\
                                                                
                                                                \mathbf{elif}\;t\_4 \leq 2 \cdot 10^{-99}:\\
                                                                \;\;\;\;t\_1\\
                                                                
                                                                \mathbf{elif}\;t\_4 \leq \infty:\\
                                                                \;\;\;\;t\_5\\
                                                                
                                                                \mathbf{else}:\\
                                                                \;\;\;\;t\_1\\
                                                                
                                                                
                                                                \end{array}
                                                                \end{array}
                                                                
                                                                Derivation
                                                                1. Split input into 2 regimes
                                                                2. if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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.9999999999999998e125 or 2e-99 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 88.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. Add Preprocessing
                                                                  3. Applied rewrites79.0%

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

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

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

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

                                                                      \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot {c0}^{2}} \]
                                                                    4. lower-/.f64N/A

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

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

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

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

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

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

                                                                      \[\leadsto \frac{d \cdot d}{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {w}^{2}} \cdot {c0}^{2} \]
                                                                    11. lower-*.f64N/A

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

                                                                      \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \cdot {c0}^{2} \]
                                                                    13. lower-*.f64N/A

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

                                                                      \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \left(w \cdot w\right)} \cdot \color{blue}{\left(c0 \cdot c0\right)} \]
                                                                    15. lower-*.f6473.2

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

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

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

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

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

                                                                      if -1.9999999999999998e125 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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))))) < 2e-99 or +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 7.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. Add Preprocessing
                                                                      3. Taylor expanded in c0 around -inf

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

                                                                          \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \cdot {c0}^{2}} \]
                                                                        2. lower-*.f64N/A

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

                                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(D \cdot \frac{D}{c0 \cdot c0}\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{h}{d \cdot d}\right), 0.25, 0\right) \cdot \left(c0 \cdot c0\right)} \]
                                                                      6. Taylor expanded in c0 around 0

                                                                        \[\leadsto \frac{1}{4} \cdot \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}} \]
                                                                      7. Step-by-step derivation
                                                                        1. Applied rewrites63.6%

                                                                          \[\leadsto \left(h \cdot 0.25\right) \cdot \color{blue}{\left(\left(\frac{M}{d} \cdot D\right) \cdot \left(\frac{M}{d} \cdot D\right)\right)} \]
                                                                      8. Recombined 2 regimes into one program.
                                                                      9. Final simplification67.8%

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

                                                                      Alternative 10: 69.1% accurate, 0.5× speedup?

                                                                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{M}{d} \cdot D\\ t_1 := \frac{\left(d \cdot d\right) \cdot c0}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\ t_2 := \left(\sqrt{t\_1 \cdot t\_1 - M \cdot M} + t\_1\right) \cdot \frac{c0}{w \cdot 2}\\ \mathbf{if}\;t\_2 \leq \infty:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\left(t\_0 \cdot t\_0\right) \cdot \left(0.25 \cdot h\right)\\ \end{array} \end{array} \]
                                                                      (FPCore (c0 w h D d M)
                                                                       :precision binary64
                                                                       (let* ((t_0 (* (/ M d) D))
                                                                              (t_1 (/ (* (* d d) c0) (* (* D D) (* h w))))
                                                                              (t_2 (* (+ (sqrt (- (* t_1 t_1) (* M M))) t_1) (/ c0 (* w 2.0)))))
                                                                         (if (<= t_2 INFINITY) t_2 (* (* t_0 t_0) (* 0.25 h)))))
                                                                      double code(double c0, double w, double h, double D, double d, double M) {
                                                                      	double t_0 = (M / d) * D;
                                                                      	double t_1 = ((d * d) * c0) / ((D * D) * (h * w));
                                                                      	double t_2 = (sqrt(((t_1 * t_1) - (M * M))) + t_1) * (c0 / (w * 2.0));
                                                                      	double tmp;
                                                                      	if (t_2 <= ((double) INFINITY)) {
                                                                      		tmp = t_2;
                                                                      	} else {
                                                                      		tmp = (t_0 * t_0) * (0.25 * h);
                                                                      	}
                                                                      	return tmp;
                                                                      }
                                                                      
                                                                      public static double code(double c0, double w, double h, double D, double d, double M) {
                                                                      	double t_0 = (M / d) * D;
                                                                      	double t_1 = ((d * d) * c0) / ((D * D) * (h * w));
                                                                      	double t_2 = (Math.sqrt(((t_1 * t_1) - (M * M))) + t_1) * (c0 / (w * 2.0));
                                                                      	double tmp;
                                                                      	if (t_2 <= Double.POSITIVE_INFINITY) {
                                                                      		tmp = t_2;
                                                                      	} else {
                                                                      		tmp = (t_0 * t_0) * (0.25 * h);
                                                                      	}
                                                                      	return tmp;
                                                                      }
                                                                      
                                                                      def code(c0, w, h, D, d, M):
                                                                      	t_0 = (M / d) * D
                                                                      	t_1 = ((d * d) * c0) / ((D * D) * (h * w))
                                                                      	t_2 = (math.sqrt(((t_1 * t_1) - (M * M))) + t_1) * (c0 / (w * 2.0))
                                                                      	tmp = 0
                                                                      	if t_2 <= math.inf:
                                                                      		tmp = t_2
                                                                      	else:
                                                                      		tmp = (t_0 * t_0) * (0.25 * h)
                                                                      	return tmp
                                                                      
                                                                      function code(c0, w, h, D, d, M)
                                                                      	t_0 = Float64(Float64(M / d) * D)
                                                                      	t_1 = Float64(Float64(Float64(d * d) * c0) / Float64(Float64(D * D) * Float64(h * w)))
                                                                      	t_2 = Float64(Float64(sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))) + t_1) * Float64(c0 / Float64(w * 2.0)))
                                                                      	tmp = 0.0
                                                                      	if (t_2 <= Inf)
                                                                      		tmp = t_2;
                                                                      	else
                                                                      		tmp = Float64(Float64(t_0 * t_0) * Float64(0.25 * h));
                                                                      	end
                                                                      	return tmp
                                                                      end
                                                                      
                                                                      function tmp_2 = code(c0, w, h, D, d, M)
                                                                      	t_0 = (M / d) * D;
                                                                      	t_1 = ((d * d) * c0) / ((D * D) * (h * w));
                                                                      	t_2 = (sqrt(((t_1 * t_1) - (M * M))) + t_1) * (c0 / (w * 2.0));
                                                                      	tmp = 0.0;
                                                                      	if (t_2 <= Inf)
                                                                      		tmp = t_2;
                                                                      	else
                                                                      		tmp = (t_0 * t_0) * (0.25 * h);
                                                                      	end
                                                                      	tmp_2 = tmp;
                                                                      end
                                                                      
                                                                      code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] * N[(c0 / N[(w * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, Infinity], t$95$2, N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(0.25 * h), $MachinePrecision]), $MachinePrecision]]]]]
                                                                      
                                                                      \begin{array}{l}
                                                                      
                                                                      \\
                                                                      \begin{array}{l}
                                                                      t_0 := \frac{M}{d} \cdot D\\
                                                                      t_1 := \frac{\left(d \cdot d\right) \cdot c0}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\
                                                                      t_2 := \left(\sqrt{t\_1 \cdot t\_1 - M \cdot M} + t\_1\right) \cdot \frac{c0}{w \cdot 2}\\
                                                                      \mathbf{if}\;t\_2 \leq \infty:\\
                                                                      \;\;\;\;t\_2\\
                                                                      
                                                                      \mathbf{else}:\\
                                                                      \;\;\;\;\left(t\_0 \cdot t\_0\right) \cdot \left(0.25 \cdot h\right)\\
                                                                      
                                                                      
                                                                      \end{array}
                                                                      \end{array}
                                                                      
                                                                      Derivation
                                                                      1. Split input into 2 regimes
                                                                      2. if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 83.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. Add Preprocessing

                                                                        if +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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. Add Preprocessing
                                                                        3. Taylor expanded in c0 around -inf

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

                                                                            \[\leadsto \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \cdot {c0}^{2}} \]
                                                                          2. lower-*.f64N/A

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

                                                                          \[\leadsto \color{blue}{\mathsf{fma}\left(\left(D \cdot \frac{D}{c0 \cdot c0}\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{h}{d \cdot d}\right), 0.25, 0\right) \cdot \left(c0 \cdot c0\right)} \]
                                                                        6. Taylor expanded in c0 around 0

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

                                                                            \[\leadsto \left(h \cdot 0.25\right) \cdot \color{blue}{\left(\left(\frac{M}{d} \cdot D\right) \cdot \left(\frac{M}{d} \cdot D\right)\right)} \]
                                                                        8. Recombined 2 regimes into one program.
                                                                        9. Final simplification67.0%

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

                                                                        Alternative 11: 51.0% accurate, 0.7× speedup?

                                                                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(d \cdot d\right) \cdot c0\\ t_1 := \frac{t\_0}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\ \mathbf{if}\;\left(\sqrt{t\_1 \cdot t\_1 - M \cdot M} + t\_1\right) \cdot \frac{c0}{w \cdot 2} \leq \infty:\\ \;\;\;\;\frac{t\_0}{\left(\left(\left(w \cdot w\right) \cdot h\right) \cdot D\right) \cdot D} \cdot c0\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
                                                                        (FPCore (c0 w h D d M)
                                                                         :precision binary64
                                                                         (let* ((t_0 (* (* d d) c0)) (t_1 (/ t_0 (* (* D D) (* h w)))))
                                                                           (if (<=
                                                                                (* (+ (sqrt (- (* t_1 t_1) (* M M))) t_1) (/ c0 (* w 2.0)))
                                                                                INFINITY)
                                                                             (* (/ t_0 (* (* (* (* w w) h) D) D)) c0)
                                                                             0.0)))
                                                                        double code(double c0, double w, double h, double D, double d, double M) {
                                                                        	double t_0 = (d * d) * c0;
                                                                        	double t_1 = t_0 / ((D * D) * (h * w));
                                                                        	double tmp;
                                                                        	if (((sqrt(((t_1 * t_1) - (M * M))) + t_1) * (c0 / (w * 2.0))) <= ((double) INFINITY)) {
                                                                        		tmp = (t_0 / ((((w * w) * h) * D) * D)) * c0;
                                                                        	} else {
                                                                        		tmp = 0.0;
                                                                        	}
                                                                        	return tmp;
                                                                        }
                                                                        
                                                                        public static double code(double c0, double w, double h, double D, double d, double M) {
                                                                        	double t_0 = (d * d) * c0;
                                                                        	double t_1 = t_0 / ((D * D) * (h * w));
                                                                        	double tmp;
                                                                        	if (((Math.sqrt(((t_1 * t_1) - (M * M))) + t_1) * (c0 / (w * 2.0))) <= Double.POSITIVE_INFINITY) {
                                                                        		tmp = (t_0 / ((((w * w) * h) * D) * D)) * c0;
                                                                        	} else {
                                                                        		tmp = 0.0;
                                                                        	}
                                                                        	return tmp;
                                                                        }
                                                                        
                                                                        def code(c0, w, h, D, d, M):
                                                                        	t_0 = (d * d) * c0
                                                                        	t_1 = t_0 / ((D * D) * (h * w))
                                                                        	tmp = 0
                                                                        	if ((math.sqrt(((t_1 * t_1) - (M * M))) + t_1) * (c0 / (w * 2.0))) <= math.inf:
                                                                        		tmp = (t_0 / ((((w * w) * h) * D) * D)) * c0
                                                                        	else:
                                                                        		tmp = 0.0
                                                                        	return tmp
                                                                        
                                                                        function code(c0, w, h, D, d, M)
                                                                        	t_0 = Float64(Float64(d * d) * c0)
                                                                        	t_1 = Float64(t_0 / Float64(Float64(D * D) * Float64(h * w)))
                                                                        	tmp = 0.0
                                                                        	if (Float64(Float64(sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))) + t_1) * Float64(c0 / Float64(w * 2.0))) <= Inf)
                                                                        		tmp = Float64(Float64(t_0 / Float64(Float64(Float64(Float64(w * w) * h) * D) * D)) * c0);
                                                                        	else
                                                                        		tmp = 0.0;
                                                                        	end
                                                                        	return tmp
                                                                        end
                                                                        
                                                                        function tmp_2 = code(c0, w, h, D, d, M)
                                                                        	t_0 = (d * d) * c0;
                                                                        	t_1 = t_0 / ((D * D) * (h * w));
                                                                        	tmp = 0.0;
                                                                        	if (((sqrt(((t_1 * t_1) - (M * M))) + t_1) * (c0 / (w * 2.0))) <= Inf)
                                                                        		tmp = (t_0 / ((((w * w) * h) * D) * D)) * c0;
                                                                        	else
                                                                        		tmp = 0.0;
                                                                        	end
                                                                        	tmp_2 = tmp;
                                                                        end
                                                                        
                                                                        code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision] * N[(c0 / N[(w * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(t$95$0 / N[(N[(N[(N[(w * w), $MachinePrecision] * h), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], 0.0]]]
                                                                        
                                                                        \begin{array}{l}
                                                                        
                                                                        \\
                                                                        \begin{array}{l}
                                                                        t_0 := \left(d \cdot d\right) \cdot c0\\
                                                                        t_1 := \frac{t\_0}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\
                                                                        \mathbf{if}\;\left(\sqrt{t\_1 \cdot t\_1 - M \cdot M} + t\_1\right) \cdot \frac{c0}{w \cdot 2} \leq \infty:\\
                                                                        \;\;\;\;\frac{t\_0}{\left(\left(\left(w \cdot w\right) \cdot h\right) \cdot D\right) \cdot D} \cdot c0\\
                                                                        
                                                                        \mathbf{else}:\\
                                                                        \;\;\;\;0\\
                                                                        
                                                                        
                                                                        \end{array}
                                                                        \end{array}
                                                                        
                                                                        Derivation
                                                                        1. Split input into 2 regimes
                                                                        2. if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 83.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. Add Preprocessing
                                                                          3. Applied rewrites65.8%

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

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

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

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

                                                                              \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot {c0}^{2}} \]
                                                                            4. lower-/.f64N/A

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

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

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

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

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

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

                                                                              \[\leadsto \frac{d \cdot d}{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {w}^{2}} \cdot {c0}^{2} \]
                                                                            11. lower-*.f64N/A

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

                                                                              \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \cdot {c0}^{2} \]
                                                                            13. lower-*.f64N/A

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

                                                                              \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \left(w \cdot w\right)} \cdot \color{blue}{\left(c0 \cdot c0\right)} \]
                                                                            15. lower-*.f6461.3

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

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

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

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

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

                                                                              if +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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. Add Preprocessing
                                                                              3. Taylor expanded in c0 around -inf

                                                                                \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{{c0}^{2} \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)}{w}} \]
                                                                              4. Step-by-step derivation
                                                                                1. *-commutativeN/A

                                                                                  \[\leadsto \color{blue}{\frac{{c0}^{2} \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)}{w} \cdot \frac{-1}{2}} \]
                                                                                2. associate-*l/N/A

                                                                                  \[\leadsto \color{blue}{\frac{\left({c0}^{2} \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) \cdot \frac{-1}{2}}{w}} \]
                                                                                3. distribute-lft1-inN/A

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

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

                                                                                  \[\leadsto \frac{\left({c0}^{2} \cdot \color{blue}{0}\right) \cdot \frac{-1}{2}}{w} \]
                                                                                6. mul0-rgtN/A

                                                                                  \[\leadsto \frac{\color{blue}{0} \cdot \frac{-1}{2}}{w} \]
                                                                                7. metadata-evalN/A

                                                                                  \[\leadsto \frac{\color{blue}{0}}{w} \]
                                                                                8. div038.8

                                                                                  \[\leadsto \color{blue}{0} \]
                                                                              5. Applied rewrites38.8%

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

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

                                                                            Alternative 12: 47.8% accurate, 0.7× speedup?

                                                                            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\left(d \cdot d\right) \cdot c0}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\ \mathbf{if}\;\left(\sqrt{t\_0 \cdot t\_0 - M \cdot M} + t\_0\right) \cdot \frac{c0}{w \cdot 2} \leq \infty:\\ \;\;\;\;\frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \left(w \cdot w\right)} \cdot \left(c0 \cdot c0\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
                                                                            (FPCore (c0 w h D d M)
                                                                             :precision binary64
                                                                             (let* ((t_0 (/ (* (* d d) c0) (* (* D D) (* h w)))))
                                                                               (if (<=
                                                                                    (* (+ (sqrt (- (* t_0 t_0) (* M M))) t_0) (/ c0 (* w 2.0)))
                                                                                    INFINITY)
                                                                                 (* (/ (* d d) (* (* (* D D) h) (* w w))) (* c0 c0))
                                                                                 0.0)))
                                                                            double code(double c0, double w, double h, double D, double d, double M) {
                                                                            	double t_0 = ((d * d) * c0) / ((D * D) * (h * w));
                                                                            	double tmp;
                                                                            	if (((sqrt(((t_0 * t_0) - (M * M))) + t_0) * (c0 / (w * 2.0))) <= ((double) INFINITY)) {
                                                                            		tmp = ((d * d) / (((D * D) * h) * (w * w))) * (c0 * c0);
                                                                            	} else {
                                                                            		tmp = 0.0;
                                                                            	}
                                                                            	return tmp;
                                                                            }
                                                                            
                                                                            public static double code(double c0, double w, double h, double D, double d, double M) {
                                                                            	double t_0 = ((d * d) * c0) / ((D * D) * (h * w));
                                                                            	double tmp;
                                                                            	if (((Math.sqrt(((t_0 * t_0) - (M * M))) + t_0) * (c0 / (w * 2.0))) <= Double.POSITIVE_INFINITY) {
                                                                            		tmp = ((d * d) / (((D * D) * h) * (w * w))) * (c0 * c0);
                                                                            	} else {
                                                                            		tmp = 0.0;
                                                                            	}
                                                                            	return tmp;
                                                                            }
                                                                            
                                                                            def code(c0, w, h, D, d, M):
                                                                            	t_0 = ((d * d) * c0) / ((D * D) * (h * w))
                                                                            	tmp = 0
                                                                            	if ((math.sqrt(((t_0 * t_0) - (M * M))) + t_0) * (c0 / (w * 2.0))) <= math.inf:
                                                                            		tmp = ((d * d) / (((D * D) * h) * (w * w))) * (c0 * c0)
                                                                            	else:
                                                                            		tmp = 0.0
                                                                            	return tmp
                                                                            
                                                                            function code(c0, w, h, D, d, M)
                                                                            	t_0 = Float64(Float64(Float64(d * d) * c0) / Float64(Float64(D * D) * Float64(h * w)))
                                                                            	tmp = 0.0
                                                                            	if (Float64(Float64(sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))) + t_0) * Float64(c0 / Float64(w * 2.0))) <= Inf)
                                                                            		tmp = Float64(Float64(Float64(d * d) / Float64(Float64(Float64(D * D) * h) * Float64(w * w))) * Float64(c0 * c0));
                                                                            	else
                                                                            		tmp = 0.0;
                                                                            	end
                                                                            	return tmp
                                                                            end
                                                                            
                                                                            function tmp_2 = code(c0, w, h, D, d, M)
                                                                            	t_0 = ((d * d) * c0) / ((D * D) * (h * w));
                                                                            	tmp = 0.0;
                                                                            	if (((sqrt(((t_0 * t_0) - (M * M))) + t_0) * (c0 / (w * 2.0))) <= Inf)
                                                                            		tmp = ((d * d) / (((D * D) * h) * (w * w))) * (c0 * c0);
                                                                            	else
                                                                            		tmp = 0.0;
                                                                            	end
                                                                            	tmp_2 = tmp;
                                                                            end
                                                                            
                                                                            code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision] * N[(c0 / N[(w * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(d * d), $MachinePrecision] / N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(c0 * c0), $MachinePrecision]), $MachinePrecision], 0.0]]
                                                                            
                                                                            \begin{array}{l}
                                                                            
                                                                            \\
                                                                            \begin{array}{l}
                                                                            t_0 := \frac{\left(d \cdot d\right) \cdot c0}{\left(D \cdot D\right) \cdot \left(h \cdot w\right)}\\
                                                                            \mathbf{if}\;\left(\sqrt{t\_0 \cdot t\_0 - M \cdot M} + t\_0\right) \cdot \frac{c0}{w \cdot 2} \leq \infty:\\
                                                                            \;\;\;\;\frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \left(w \cdot w\right)} \cdot \left(c0 \cdot c0\right)\\
                                                                            
                                                                            \mathbf{else}:\\
                                                                            \;\;\;\;0\\
                                                                            
                                                                            
                                                                            \end{array}
                                                                            \end{array}
                                                                            
                                                                            Derivation
                                                                            1. Split input into 2 regimes
                                                                            2. if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 83.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. Add Preprocessing
                                                                              3. Taylor expanded in c0 around inf

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

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

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

                                                                                  \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)} \cdot {c0}^{2}} \]
                                                                                4. lower-/.f64N/A

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

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

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

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

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

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

                                                                                  \[\leadsto \frac{d \cdot d}{\left(\color{blue}{\left(D \cdot D\right)} \cdot h\right) \cdot {w}^{2}} \cdot {c0}^{2} \]
                                                                                11. lower-*.f64N/A

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

                                                                                  \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \cdot {c0}^{2} \]
                                                                                13. lower-*.f64N/A

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

                                                                                  \[\leadsto \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \left(w \cdot w\right)} \cdot \color{blue}{\left(c0 \cdot c0\right)} \]
                                                                                15. lower-*.f6461.3

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

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

                                                                              if +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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. Add Preprocessing
                                                                              3. Taylor expanded in c0 around -inf

                                                                                \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{{c0}^{2} \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)}{w}} \]
                                                                              4. Step-by-step derivation
                                                                                1. *-commutativeN/A

                                                                                  \[\leadsto \color{blue}{\frac{{c0}^{2} \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)}{w} \cdot \frac{-1}{2}} \]
                                                                                2. associate-*l/N/A

                                                                                  \[\leadsto \color{blue}{\frac{\left({c0}^{2} \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) \cdot \frac{-1}{2}}{w}} \]
                                                                                3. distribute-lft1-inN/A

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

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

                                                                                  \[\leadsto \frac{\left({c0}^{2} \cdot \color{blue}{0}\right) \cdot \frac{-1}{2}}{w} \]
                                                                                6. mul0-rgtN/A

                                                                                  \[\leadsto \frac{\color{blue}{0} \cdot \frac{-1}{2}}{w} \]
                                                                                7. metadata-evalN/A

                                                                                  \[\leadsto \frac{\color{blue}{0}}{w} \]
                                                                                8. div038.8

                                                                                  \[\leadsto \color{blue}{0} \]
                                                                              5. Applied rewrites38.8%

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

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

                                                                            Alternative 13: 33.5% accurate, 156.0× speedup?

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

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

                                                                              \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{{c0}^{2} \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)}{w}} \]
                                                                            4. Step-by-step derivation
                                                                              1. *-commutativeN/A

                                                                                \[\leadsto \color{blue}{\frac{{c0}^{2} \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)}{w} \cdot \frac{-1}{2}} \]
                                                                              2. associate-*l/N/A

                                                                                \[\leadsto \color{blue}{\frac{\left({c0}^{2} \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) \cdot \frac{-1}{2}}{w}} \]
                                                                              3. distribute-lft1-inN/A

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

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

                                                                                \[\leadsto \frac{\left({c0}^{2} \cdot \color{blue}{0}\right) \cdot \frac{-1}{2}}{w} \]
                                                                              6. mul0-rgtN/A

                                                                                \[\leadsto \frac{\color{blue}{0} \cdot \frac{-1}{2}}{w} \]
                                                                              7. metadata-evalN/A

                                                                                \[\leadsto \frac{\color{blue}{0}}{w} \]
                                                                              8. div033.2

                                                                                \[\leadsto \color{blue}{0} \]
                                                                            5. Applied rewrites33.2%

                                                                              \[\leadsto \color{blue}{0} \]
                                                                            6. Add Preprocessing

                                                                            Reproduce

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