Henrywood and Agarwal, Equation (13)

Percentage Accurate: 24.5% → 61.6%
Time: 34.4s
Alternatives: 14
Speedup: 50.3×

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 14 alternatives:

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

Initial Program: 24.5% accurate, 1.0× speedup?

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

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

Alternative 1: 61.6% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 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.9999999999999998e-76

    1. Initial program 86.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. Simplified86.2%

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

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

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

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

        \[\leadsto c0 \cdot \frac{2 \cdot \frac{\color{blue}{\frac{c0}{w \cdot h} \cdot {d}^{2}}}{{D}^{2}}}{2 \cdot w} \]
      4. associate-/l*91.6%

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

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

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

    if -4.9999999999999998e-76 < (*.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))))) < -0.0

    1. Initial program 25.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. Simplified13.4%

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/56.1%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in56.1%

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

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

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

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

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

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

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

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

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

    if -0.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))))) < +inf.0

    1. Initial program 73.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. Step-by-step derivation
      1. associate-/l*73.0%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(c0 \cdot d\right) \cdot \frac{d}{\color{blue}{\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) \]
      10. associate-*l*73.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/1.2%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in1.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \left(\left(\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h\right) \cdot \frac{1}{d \cdot d}\right) \]
      6. pow-prod-down52.2%

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

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \frac{1}{\color{blue}{{d}^{2}}}\right) \]
      8. pow-flip52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \color{blue}{{d}^{\left(-2\right)}}\right) \]
      9. metadata-eval52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot {d}^{\color{blue}{-2}}\right) \]
    9. Applied egg-rr52.5%

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

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

Alternative 2: 61.7% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;0.25 \cdot \left({D}^{2} \cdot \frac{h \cdot {M}^{2}}{{d}^{2}}\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 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.9999999999999998e-76

    1. Initial program 86.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. Simplified86.2%

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

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

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

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

        \[\leadsto c0 \cdot \frac{2 \cdot \frac{\color{blue}{\frac{c0}{w \cdot h} \cdot {d}^{2}}}{{D}^{2}}}{2 \cdot w} \]
      4. associate-/l*91.6%

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

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

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

    if -4.9999999999999998e-76 < (*.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))))) < -0.0

    1. Initial program 25.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. Simplified13.4%

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/56.1%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in56.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto {c0}^{2} \cdot \color{blue}{0} + {c0}^{2} \cdot \frac{0.25 \cdot \left({D}^{2} \cdot \left(h \cdot {M}^{2}\right)\right)}{{d}^{2} \cdot {c0}^{2}} \]
      3. div-inv56.1%

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

        \[\leadsto {c0}^{2} \cdot 0 + {c0}^{2} \cdot \left(\color{blue}{\left(\left(0.25 \cdot {D}^{2}\right) \cdot \left(h \cdot {M}^{2}\right)\right)} \cdot \frac{1}{{d}^{2} \cdot {c0}^{2}}\right) \]
      5. pow-prod-down67.2%

        \[\leadsto {c0}^{2} \cdot 0 + {c0}^{2} \cdot \left(\left(\left(0.25 \cdot {D}^{2}\right) \cdot \left(h \cdot {M}^{2}\right)\right) \cdot \frac{1}{\color{blue}{{\left(d \cdot c0\right)}^{2}}}\right) \]
      6. *-commutative67.2%

        \[\leadsto {c0}^{2} \cdot 0 + {c0}^{2} \cdot \left(\left(\left(0.25 \cdot {D}^{2}\right) \cdot \left(h \cdot {M}^{2}\right)\right) \cdot \frac{1}{{\color{blue}{\left(c0 \cdot d\right)}}^{2}}\right) \]
      7. pow-flip67.2%

        \[\leadsto {c0}^{2} \cdot 0 + {c0}^{2} \cdot \left(\left(\left(0.25 \cdot {D}^{2}\right) \cdot \left(h \cdot {M}^{2}\right)\right) \cdot \color{blue}{{\left(c0 \cdot d\right)}^{\left(-2\right)}}\right) \]
      8. metadata-eval67.2%

        \[\leadsto {c0}^{2} \cdot 0 + {c0}^{2} \cdot \left(\left(\left(0.25 \cdot {D}^{2}\right) \cdot \left(h \cdot {M}^{2}\right)\right) \cdot {\left(c0 \cdot d\right)}^{\color{blue}{-2}}\right) \]
    8. Applied egg-rr67.2%

      \[\leadsto \color{blue}{{c0}^{2} \cdot 0 + {c0}^{2} \cdot \left(\left(\left(0.25 \cdot {D}^{2}\right) \cdot \left(h \cdot {M}^{2}\right)\right) \cdot {\left(c0 \cdot d\right)}^{-2}\right)} \]
    9. Step-by-step derivation
      1. distribute-lft-out67.2%

        \[\leadsto \color{blue}{{c0}^{2} \cdot \left(0 + \left(\left(0.25 \cdot {D}^{2}\right) \cdot \left(h \cdot {M}^{2}\right)\right) \cdot {\left(c0 \cdot d\right)}^{-2}\right)} \]
      2. +-lft-identity67.2%

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

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

        \[\leadsto {c0}^{2} \cdot \left(\left(0.25 \cdot \color{blue}{\left(\left({D}^{2} \cdot h\right) \cdot {M}^{2}\right)}\right) \cdot {\left(c0 \cdot d\right)}^{-2}\right) \]
    10. Simplified67.1%

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

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

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

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

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

    if -0.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))))) < +inf.0

    1. Initial program 73.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. Step-by-step derivation
      1. associate-/l*73.0%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(c0 \cdot d\right) \cdot \frac{d}{\color{blue}{\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) \]
      10. associate-*l*73.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/1.2%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in1.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \left(\left(\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h\right) \cdot \frac{1}{d \cdot d}\right) \]
      6. pow-prod-down52.2%

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

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \frac{1}{\color{blue}{{d}^{2}}}\right) \]
      8. pow-flip52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \color{blue}{{d}^{\left(-2\right)}}\right) \]
      9. metadata-eval52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot {d}^{\color{blue}{-2}}\right) \]
    9. Applied egg-rr52.5%

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

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

Alternative 3: 62.0% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{1}{\frac{\frac{{d}^{2}}{t\_2}}{h}}\\

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

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(h \cdot t\_2\right) \cdot {d}^{-2}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 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.9999999999999998e-76

    1. Initial program 86.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. Simplified86.2%

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

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

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

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

        \[\leadsto c0 \cdot \frac{2 \cdot \frac{\color{blue}{\frac{c0}{w \cdot h} \cdot {d}^{2}}}{{D}^{2}}}{2 \cdot w} \]
      4. associate-/l*91.6%

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

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

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

    if -4.9999999999999998e-76 < (*.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))))) < -0.0

    1. Initial program 25.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. Simplified13.4%

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/56.1%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in56.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot {\left(\frac{{d}^{2}}{\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h}\right)}^{-1} \]
      8. pow-prod-down78.0%

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

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

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

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

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

    if -0.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))))) < +inf.0

    1. Initial program 73.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. Step-by-step derivation
      1. associate-/l*73.0%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(c0 \cdot d\right) \cdot \frac{d}{\color{blue}{\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) \]
      10. associate-*l*73.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/1.2%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in1.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \left(\left(\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h\right) \cdot \frac{1}{d \cdot d}\right) \]
      6. pow-prod-down52.2%

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

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \frac{1}{\color{blue}{{d}^{2}}}\right) \]
      8. pow-flip52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \color{blue}{{d}^{\left(-2\right)}}\right) \]
      9. metadata-eval52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot {d}^{\color{blue}{-2}}\right) \]
    9. Applied egg-rr52.5%

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

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

Alternative 4: 62.1% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{1}{\frac{\frac{{d}^{2}}{t\_2}}{h}}\\

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

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(h \cdot t\_2\right) \cdot {d}^{-2}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 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.9999999999999998e-76

    1. Initial program 86.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. Simplified86.2%

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

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

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

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

        \[\leadsto c0 \cdot \frac{2 \cdot \frac{\color{blue}{\frac{c0}{w \cdot h} \cdot {d}^{2}}}{{D}^{2}}}{2 \cdot w} \]
      4. associate-/l*91.6%

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

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

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

    if -4.9999999999999998e-76 < (*.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))))) < -0.0

    1. Initial program 25.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. Simplified13.4%

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/56.1%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in56.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot {\left(\frac{{d}^{2}}{\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h}\right)}^{-1} \]
      8. pow-prod-down78.0%

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

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

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

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

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

    if -0.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))))) < +inf.0

    1. Initial program 73.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. Simplified73.0%

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

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

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

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/1.2%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in1.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \left(\left(\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h\right) \cdot \frac{1}{d \cdot d}\right) \]
      6. pow-prod-down52.2%

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

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \frac{1}{\color{blue}{{d}^{2}}}\right) \]
      8. pow-flip52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \color{blue}{{d}^{\left(-2\right)}}\right) \]
      9. metadata-eval52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot {d}^{\color{blue}{-2}}\right) \]
    9. Applied egg-rr52.5%

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

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

Alternative 5: 62.0% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{1}{\frac{\frac{{d}^{2}}{t\_2}}{h}}\\

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

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(h \cdot t\_2\right) \cdot {d}^{-2}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 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.9999999999999998e-76

    1. Initial program 86.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. Simplified86.2%

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

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

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

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

        \[\leadsto c0 \cdot \frac{2 \cdot \frac{\color{blue}{\frac{c0}{w \cdot h} \cdot {d}^{2}}}{{D}^{2}}}{2 \cdot w} \]
      4. associate-/l*91.6%

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

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

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

    if -4.9999999999999998e-76 < (*.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))))) < -0.0

    1. Initial program 25.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. Simplified13.4%

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/56.1%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in56.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot {\left(\frac{{d}^{2}}{\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h}\right)}^{-1} \]
      8. pow-prod-down78.0%

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

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

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

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

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

    if -0.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))))) < +inf.0

    1. Initial program 73.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. Simplified73.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/1.2%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in1.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \left(\left(\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h\right) \cdot \frac{1}{d \cdot d}\right) \]
      6. pow-prod-down52.2%

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

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \frac{1}{\color{blue}{{d}^{2}}}\right) \]
      8. pow-flip52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \color{blue}{{d}^{\left(-2\right)}}\right) \]
      9. metadata-eval52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot {d}^{\color{blue}{-2}}\right) \]
    9. Applied egg-rr52.5%

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

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

Alternative 6: 61.8% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\\
t_2 := {\left(D \cdot M\right)}^{2}\\
t_3 := \frac{c0}{2 \cdot w}\\
t_4 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_5 := t\_3 \cdot \left(t\_4 + \sqrt{t\_4 \cdot t\_4 - M \cdot M}\right)\\
\mathbf{if}\;t\_5 \leq -5 \cdot 10^{-76}:\\
\;\;\;\;t\_3 \cdot \left(t\_1 + \sqrt{t\_1 \cdot \left(t\_0 \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)\\

\mathbf{elif}\;t\_5 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{1}{\frac{\frac{{d}^{2}}{t\_2}}{h}}\\

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

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(h \cdot t\_2\right) \cdot {d}^{-2}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 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.9999999999999998e-76

    1. Initial program 86.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. Simplified90.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac90.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    5. Applied egg-rr90.9%

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

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

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

    if -4.9999999999999998e-76 < (*.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))))) < -0.0

    1. Initial program 25.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. Simplified13.4%

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/56.1%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in56.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot {\left(\frac{{d}^{2}}{\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h}\right)}^{-1} \]
      8. pow-prod-down78.0%

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

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

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

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

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

    if -0.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))))) < +inf.0

    1. Initial program 73.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. Simplified73.0%

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

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

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

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

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

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/1.2%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in1.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \left(\left(\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h\right) \cdot \frac{1}{d \cdot d}\right) \]
      6. pow-prod-down52.2%

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

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \frac{1}{\color{blue}{{d}^{2}}}\right) \]
      8. pow-flip52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \color{blue}{{d}^{\left(-2\right)}}\right) \]
      9. metadata-eval52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot {d}^{\color{blue}{-2}}\right) \]
    9. Applied egg-rr52.5%

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

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

Alternative 7: 61.5% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\\
t_2 := {\left(D \cdot M\right)}^{2}\\
t_3 := \frac{c0}{2 \cdot w}\\
t_4 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_5 := t\_3 \cdot \left(t\_4 + \sqrt{t\_4 \cdot t\_4 - M \cdot M}\right)\\
\mathbf{if}\;t\_5 \leq -5 \cdot 10^{-76}:\\
\;\;\;\;t\_3 \cdot \left(t\_1 + \sqrt{t\_1 \cdot \left(t\_0 \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)\\

\mathbf{elif}\;t\_5 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{1}{\frac{\frac{{d}^{2}}{t\_2}}{h}}\\

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

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(h \cdot t\_2\right) \cdot {d}^{-2}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 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.9999999999999998e-76

    1. Initial program 86.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. Simplified90.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac90.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    5. Applied egg-rr90.9%

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

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

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

    if -4.9999999999999998e-76 < (*.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))))) < -0.0

    1. Initial program 25.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. Simplified13.4%

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/56.1%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in56.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot {\left(\frac{{d}^{2}}{\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h}\right)}^{-1} \]
      8. pow-prod-down78.0%

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

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

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

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

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

    if -0.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))))) < +inf.0

    1. Initial program 73.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. Simplified73.0%

      \[\leadsto \color{blue}{c0 \cdot \frac{\mathsf{fma}\left(c0, d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}, \sqrt{\mathsf{fma}\left(c0, d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}, M\right) \cdot \left(c0 \cdot \left(d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}\right) - M\right)}\right)}{2 \cdot w}} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num73.0%

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

        \[\leadsto c0 \cdot \frac{\mathsf{fma}\left(c0, d \cdot \color{blue}{{\left(\frac{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}{d}\right)}^{-1}}, \sqrt{\mathsf{fma}\left(c0, d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}, M\right) \cdot \left(c0 \cdot \left(d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}\right) - M\right)}\right)}{2 \cdot w} \]
      3. *-commutative73.0%

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

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

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

        \[\leadsto c0 \cdot \frac{\mathsf{fma}\left(c0, d \cdot {\left(\frac{\color{blue}{w \cdot \left(h \cdot \left(D \cdot D\right)\right)}}{d}\right)}^{-1}, \sqrt{\mathsf{fma}\left(c0, d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}, M\right) \cdot \left(c0 \cdot \left(d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}\right) - M\right)}\right)}{2 \cdot w} \]
      7. pow273.0%

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

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

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

        \[\leadsto c0 \cdot \frac{\mathsf{fma}\left(c0, d \cdot \frac{1}{\color{blue}{w \cdot \frac{h \cdot {D}^{2}}{d}}}, \sqrt{\mathsf{fma}\left(c0, d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}, M\right) \cdot \left(c0 \cdot \left(d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}\right) - M\right)}\right)}{2 \cdot w} \]
      3. *-commutative73.0%

        \[\leadsto c0 \cdot \frac{\mathsf{fma}\left(c0, d \cdot \frac{1}{w \cdot \frac{\color{blue}{{D}^{2} \cdot h}}{d}}, \sqrt{\mathsf{fma}\left(c0, d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}, M\right) \cdot \left(c0 \cdot \left(d \cdot \frac{d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}\right) - M\right)}\right)}{2 \cdot w} \]
    7. Simplified73.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/1.2%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in1.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \left(\left(\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h\right) \cdot \frac{1}{d \cdot d}\right) \]
      6. pow-prod-down52.2%

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

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \frac{1}{\color{blue}{{d}^{2}}}\right) \]
      8. pow-flip52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \color{blue}{{d}^{\left(-2\right)}}\right) \]
      9. metadata-eval52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot {d}^{\color{blue}{-2}}\right) \]
    9. Applied egg-rr52.5%

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

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

Alternative 8: 61.3% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;t\_5 \leq 0 \lor \neg \left(t\_5 \leq \infty\right):\\
\;\;\;\;0.25 \cdot \left(\left(h \cdot {\left(D \cdot M\right)}^{2}\right) \cdot {d}^{-2}\right)\\

\mathbf{else}:\\
\;\;\;\;t\_3 \cdot \left(t\_1 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\


\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.9999999999999998e-76

    1. Initial program 86.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. Simplified90.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac90.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    5. Applied egg-rr90.9%

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

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

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

    if -4.9999999999999998e-76 < (*.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))))) < -0.0 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 1.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. Simplified2.2%

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/4.0%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in4.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{d \cdot d}} \]
      2. div-inv41.4%

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

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

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

        \[\leadsto 0.25 \cdot \left(\left(\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h\right) \cdot \frac{1}{d \cdot d}\right) \]
      6. pow-prod-down53.5%

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

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

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \color{blue}{{d}^{\left(-2\right)}}\right) \]
      9. metadata-eval53.7%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot {d}^{\color{blue}{-2}}\right) \]
    9. Applied egg-rr53.7%

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

    if -0.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))))) < +inf.0

    1. Initial program 73.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. Simplified75.1%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac75.2%

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

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

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

Alternative 9: 61.3% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\\
t_2 := {\left(D \cdot M\right)}^{2}\\
t_3 := t\_0 \cdot \frac{d \cdot d}{D \cdot D}\\
t_4 := \frac{c0}{2 \cdot w}\\
t_5 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_6 := t\_4 \cdot \left(t\_5 + \sqrt{t\_5 \cdot t\_5 - M \cdot M}\right)\\
\mathbf{if}\;t\_6 \leq -5 \cdot 10^{-76}:\\
\;\;\;\;t\_4 \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_3 - M \cdot M}\right)\\

\mathbf{elif}\;t\_6 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{1}{\frac{\frac{{d}^{2}}{t\_2}}{h}}\\

\mathbf{elif}\;t\_6 \leq \infty:\\
\;\;\;\;t\_4 \cdot \left(t\_1 + \sqrt{t\_3 \cdot t\_3 - M \cdot M}\right)\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(h \cdot t\_2\right) \cdot {d}^{-2}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 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.9999999999999998e-76

    1. Initial program 86.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. Simplified90.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac90.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    5. Applied egg-rr90.9%

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

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

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

    if -4.9999999999999998e-76 < (*.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))))) < -0.0

    1. Initial program 25.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. Simplified13.4%

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/56.1%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in56.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot {\left(\frac{{d}^{2}}{\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h}\right)}^{-1} \]
      8. pow-prod-down78.0%

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

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

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

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

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

    if -0.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))))) < +inf.0

    1. Initial program 73.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. Simplified75.1%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac75.2%

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

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

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/1.2%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in1.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \left(\left(\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h\right) \cdot \frac{1}{d \cdot d}\right) \]
      6. pow-prod-down52.2%

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

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \frac{1}{\color{blue}{{d}^{2}}}\right) \]
      8. pow-flip52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \color{blue}{{d}^{\left(-2\right)}}\right) \]
      9. metadata-eval52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot {d}^{\color{blue}{-2}}\right) \]
    9. Applied egg-rr52.5%

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

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

Alternative 10: 61.3% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\\
t_2 := t\_0 \cdot \frac{d \cdot d}{D \cdot D}\\
t_3 := \frac{c0}{2 \cdot w}\\
t_4 := {\left(D \cdot M\right)}^{2}\\
t_5 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_6 := t\_3 \cdot \left(t\_5 + \sqrt{t\_5 \cdot t\_5 - M \cdot M}\right)\\
\mathbf{if}\;t\_6 \leq -5 \cdot 10^{-76}:\\
\;\;\;\;t\_3 \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_2 - M \cdot M}\right)\\

\mathbf{elif}\;t\_6 \leq 0:\\
\;\;\;\;\frac{t\_4 \cdot \left(h \cdot 0.25\right)}{{d}^{2}}\\

\mathbf{elif}\;t\_6 \leq \infty:\\
\;\;\;\;t\_3 \cdot \left(t\_1 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(h \cdot t\_4\right) \cdot {d}^{-2}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 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.9999999999999998e-76

    1. Initial program 86.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. Simplified90.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac90.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    5. Applied egg-rr90.9%

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

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

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

    if -4.9999999999999998e-76 < (*.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))))) < -0.0

    1. Initial program 25.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. Simplified13.4%

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/56.1%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in56.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto {c0}^{2} \cdot \color{blue}{0} + {c0}^{2} \cdot \frac{0.25 \cdot \left({D}^{2} \cdot \left(h \cdot {M}^{2}\right)\right)}{{d}^{2} \cdot {c0}^{2}} \]
      3. div-inv56.1%

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

        \[\leadsto {c0}^{2} \cdot 0 + {c0}^{2} \cdot \left(\color{blue}{\left(\left(0.25 \cdot {D}^{2}\right) \cdot \left(h \cdot {M}^{2}\right)\right)} \cdot \frac{1}{{d}^{2} \cdot {c0}^{2}}\right) \]
      5. pow-prod-down67.2%

        \[\leadsto {c0}^{2} \cdot 0 + {c0}^{2} \cdot \left(\left(\left(0.25 \cdot {D}^{2}\right) \cdot \left(h \cdot {M}^{2}\right)\right) \cdot \frac{1}{\color{blue}{{\left(d \cdot c0\right)}^{2}}}\right) \]
      6. *-commutative67.2%

        \[\leadsto {c0}^{2} \cdot 0 + {c0}^{2} \cdot \left(\left(\left(0.25 \cdot {D}^{2}\right) \cdot \left(h \cdot {M}^{2}\right)\right) \cdot \frac{1}{{\color{blue}{\left(c0 \cdot d\right)}}^{2}}\right) \]
      7. pow-flip67.2%

        \[\leadsto {c0}^{2} \cdot 0 + {c0}^{2} \cdot \left(\left(\left(0.25 \cdot {D}^{2}\right) \cdot \left(h \cdot {M}^{2}\right)\right) \cdot \color{blue}{{\left(c0 \cdot d\right)}^{\left(-2\right)}}\right) \]
      8. metadata-eval67.2%

        \[\leadsto {c0}^{2} \cdot 0 + {c0}^{2} \cdot \left(\left(\left(0.25 \cdot {D}^{2}\right) \cdot \left(h \cdot {M}^{2}\right)\right) \cdot {\left(c0 \cdot d\right)}^{\color{blue}{-2}}\right) \]
    8. Applied egg-rr67.2%

      \[\leadsto \color{blue}{{c0}^{2} \cdot 0 + {c0}^{2} \cdot \left(\left(\left(0.25 \cdot {D}^{2}\right) \cdot \left(h \cdot {M}^{2}\right)\right) \cdot {\left(c0 \cdot d\right)}^{-2}\right)} \]
    9. Step-by-step derivation
      1. distribute-lft-out67.2%

        \[\leadsto \color{blue}{{c0}^{2} \cdot \left(0 + \left(\left(0.25 \cdot {D}^{2}\right) \cdot \left(h \cdot {M}^{2}\right)\right) \cdot {\left(c0 \cdot d\right)}^{-2}\right)} \]
      2. +-lft-identity67.2%

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

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

        \[\leadsto {c0}^{2} \cdot \left(\left(0.25 \cdot \color{blue}{\left(\left({D}^{2} \cdot h\right) \cdot {M}^{2}\right)}\right) \cdot {\left(c0 \cdot d\right)}^{-2}\right) \]
    10. Simplified67.1%

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

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

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

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

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

        \[\leadsto \frac{0.25 \cdot \left(\left(\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}\right) \cdot h\right)}{{d}^{2}} \]
      5. swap-sqr78.0%

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

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

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

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

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

    if -0.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))))) < +inf.0

    1. Initial program 73.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. Simplified75.1%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac75.2%

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

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

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/1.2%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in1.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \left(\left(\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h\right) \cdot \frac{1}{d \cdot d}\right) \]
      6. pow-prod-down52.2%

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

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \frac{1}{\color{blue}{{d}^{2}}}\right) \]
      8. pow-flip52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \color{blue}{{d}^{\left(-2\right)}}\right) \]
      9. metadata-eval52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot {d}^{\color{blue}{-2}}\right) \]
    9. Applied egg-rr52.5%

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

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

Alternative 11: 61.2% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\\
t_2 := t\_0 \cdot \frac{d \cdot d}{D \cdot D}\\
t_3 := \frac{c0}{2 \cdot w}\\
t_4 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_5 := t\_3 \cdot \left(t\_4 + \sqrt{t\_4 \cdot t\_4 - M \cdot M}\right)\\
t_6 := {\left(D \cdot M\right)}^{2}\\
\mathbf{if}\;t\_5 \leq -5 \cdot 10^{-76}:\\
\;\;\;\;t\_3 \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_2 - M \cdot M}\right)\\

\mathbf{elif}\;t\_5 \leq 0:\\
\;\;\;\;0.25 \cdot \left(t\_6 \cdot \left(h \cdot {d}^{-2}\right)\right)\\

\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;t\_3 \cdot \left(t\_1 + \sqrt{t\_2 \cdot t\_2 - M \cdot M}\right)\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(h \cdot t\_6\right) \cdot {d}^{-2}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 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.9999999999999998e-76

    1. Initial program 86.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. Simplified90.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac90.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    5. Applied egg-rr90.9%

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

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

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

    if -4.9999999999999998e-76 < (*.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))))) < -0.0

    1. Initial program 25.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. Simplified13.4%

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/56.1%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in56.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{d \cdot d}} \]
      2. div-inv78.0%

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

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

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\left({D}^{2} \cdot \left(M \cdot M\right)\right) \cdot h\right)} \cdot \frac{1}{d \cdot d}\right) \]
      5. pow278.0%

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

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

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \frac{1}{\color{blue}{{d}^{2}}}\right) \]
      8. pow-flip77.9%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \color{blue}{{d}^{\left(-2\right)}}\right) \]
      9. metadata-eval77.9%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot {d}^{\color{blue}{-2}}\right) \]
    9. Applied egg-rr77.9%

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

        \[\leadsto 0.25 \cdot \color{blue}{\left({\left(D \cdot M\right)}^{2} \cdot \left(h \cdot {d}^{-2}\right)\right)} \]
    11. Simplified77.9%

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

    if -0.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))))) < +inf.0

    1. Initial program 73.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. Simplified75.1%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac75.2%

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

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

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

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(-0.5 \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} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/1.2%

        \[\leadsto {c0}^{2} \cdot \left(\color{blue}{\frac{-0.5 \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}} + 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right) \]
      2. distribute-lft1-in1.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \left(\left(\left({D}^{2} \cdot \color{blue}{{M}^{2}}\right) \cdot h\right) \cdot \frac{1}{d \cdot d}\right) \]
      6. pow-prod-down52.2%

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

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \frac{1}{\color{blue}{{d}^{2}}}\right) \]
      8. pow-flip52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot \color{blue}{{d}^{\left(-2\right)}}\right) \]
      9. metadata-eval52.5%

        \[\leadsto 0.25 \cdot \left(\left({\left(D \cdot M\right)}^{2} \cdot h\right) \cdot {d}^{\color{blue}{-2}}\right) \]
    9. Applied egg-rr52.5%

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

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

Alternative 12: 53.7% accurate, 0.5× speedup?

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

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

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


\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 73.3%

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

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    3. 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. Step-by-step derivation
      1. associate-/l*0.0%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(c0 \cdot d\right) \cdot \frac{d}{\color{blue}{\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) \]
      10. associate-*l*0.0%

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(c0 \cdot d\right) \cdot \frac{d}{w \cdot \left(h \cdot {D}^{2}\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) \]
    5. Taylor expanded in c0 around -inf 1.2%

      \[\leadsto \color{blue}{-0.5 \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}} \]
    6. Step-by-step derivation
      1. associate-*r/1.2%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \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)}{w}} \]
      2. distribute-lft1-in1.2%

        \[\leadsto \frac{-0.5 \cdot \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)}{w} \]
      3. metadata-eval1.2%

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

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

        \[\leadsto \frac{-0.5 \cdot \color{blue}{0}}{w} \]
      6. metadata-eval45.1%

        \[\leadsto \frac{\color{blue}{0}}{w} \]
    7. Simplified45.1%

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

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

Alternative 13: 34.7% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{w \cdot h}\\ t_1 := t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\\ \mathbf{if}\;M \cdot M \leq 5 \cdot 10^{-29} \lor \neg \left(M \cdot M \leq 7.4 \cdot 10^{+292}\right):\\ \;\;\;\;\frac{0}{w}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(t\_1 + \sqrt{t\_1 \cdot \left(t\_0 \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ c0 (* w h))) (t_1 (* t_0 (* (/ d D) (/ d D)))))
   (if (or (<= (* M M) 5e-29) (not (<= (* M M) 7.4e+292)))
     (/ 0.0 w)
     (*
      (/ c0 (* 2.0 w))
      (+ t_1 (sqrt (- (* t_1 (* t_0 (/ (* d d) (* D D)))) (* M M))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (w * h);
	double t_1 = t_0 * ((d / D) * (d / D));
	double tmp;
	if (((M * M) <= 5e-29) || !((M * M) <= 7.4e+292)) {
		tmp = 0.0 / w;
	} else {
		tmp = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * (t_0 * ((d * d) / (D * D)))) - (M * M))));
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = c0 / (w * h)
    t_1 = t_0 * ((d_1 / d) * (d_1 / d))
    if (((m * m) <= 5d-29) .or. (.not. ((m * m) <= 7.4d+292))) then
        tmp = 0.0d0 / w
    else
        tmp = (c0 / (2.0d0 * w)) * (t_1 + sqrt(((t_1 * (t_0 * ((d_1 * d_1) / (d * d)))) - (m * m))))
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (w * h);
	double t_1 = t_0 * ((d / D) * (d / D));
	double tmp;
	if (((M * M) <= 5e-29) || !((M * M) <= 7.4e+292)) {
		tmp = 0.0 / w;
	} else {
		tmp = (c0 / (2.0 * w)) * (t_1 + Math.sqrt(((t_1 * (t_0 * ((d * d) / (D * D)))) - (M * M))));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = c0 / (w * h)
	t_1 = t_0 * ((d / D) * (d / D))
	tmp = 0
	if ((M * M) <= 5e-29) or not ((M * M) <= 7.4e+292):
		tmp = 0.0 / w
	else:
		tmp = (c0 / (2.0 * w)) * (t_1 + math.sqrt(((t_1 * (t_0 * ((d * d) / (D * D)))) - (M * M))))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(c0 / Float64(w * h))
	t_1 = Float64(t_0 * Float64(Float64(d / D) * Float64(d / D)))
	tmp = 0.0
	if ((Float64(M * M) <= 5e-29) || !(Float64(M * M) <= 7.4e+292))
		tmp = Float64(0.0 / w);
	else
		tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_1 + sqrt(Float64(Float64(t_1 * Float64(t_0 * Float64(Float64(d * d) / Float64(D * D)))) - Float64(M * M)))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = c0 / (w * h);
	t_1 = t_0 * ((d / D) * (d / D));
	tmp = 0.0;
	if (((M * M) <= 5e-29) || ~(((M * M) <= 7.4e+292)))
		tmp = 0.0 / w;
	else
		tmp = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * (t_0 * ((d * d) / (D * D)))) - (M * M))));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(M * M), $MachinePrecision], 5e-29], N[Not[LessEqual[N[(M * M), $MachinePrecision], 7.4e+292]], $MachinePrecision]], N[(0.0 / w), $MachinePrecision], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * N[(t$95$0 * N[(N[(d * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0}{w \cdot h}\\
t_1 := t\_0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\\
\mathbf{if}\;M \cdot M \leq 5 \cdot 10^{-29} \lor \neg \left(M \cdot M \leq 7.4 \cdot 10^{+292}\right):\\
\;\;\;\;\frac{0}{w}\\

\mathbf{else}:\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(t\_1 + \sqrt{t\_1 \cdot \left(t\_0 \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 M M) < 4.99999999999999986e-29 or 7.40000000000000019e292 < (*.f64 M M)

    1. Initial program 19.7%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/l*19.2%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(c0 \cdot d\right) \cdot \frac{d}{\color{blue}{\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) \]
      10. associate-*l*19.3%

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(c0 \cdot d\right) \cdot \frac{d}{w \cdot \left(h \cdot {D}^{2}\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) \]
    5. Taylor expanded in c0 around -inf 2.5%

      \[\leadsto \color{blue}{-0.5 \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}} \]
    6. Step-by-step derivation
      1. associate-*r/2.5%

        \[\leadsto \color{blue}{\frac{-0.5 \cdot \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)}{w}} \]
      2. distribute-lft1-in2.5%

        \[\leadsto \frac{-0.5 \cdot \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)}{w} \]
      3. metadata-eval2.5%

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

        \[\leadsto \frac{-0.5 \cdot \left({c0}^{2} \cdot \color{blue}{0}\right)}{w} \]
      5. mul0-rgt35.7%

        \[\leadsto \frac{-0.5 \cdot \color{blue}{0}}{w} \]
      6. metadata-eval35.7%

        \[\leadsto \frac{\color{blue}{0}}{w} \]
    7. Simplified35.7%

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

    if 4.99999999999999986e-29 < (*.f64 M M) < 7.40000000000000019e292

    1. Initial program 36.9%

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

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. times-frac36.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right) - M \cdot M}\right) \]
    5. Applied egg-rr36.9%

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

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

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

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

Alternative 14: 33.9% accurate, 50.3× speedup?

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

\\
\frac{0}{w}
\end{array}
Derivation
  1. Initial program 24.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. Step-by-step derivation
    1. associate-/l*24.3%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(c0 \cdot d\right) \cdot \frac{d}{\color{blue}{\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) \]
    10. associate-*l*24.0%

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

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

    \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(c0 \cdot d\right) \cdot \frac{d}{w \cdot \left(h \cdot {D}^{2}\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) \]
  5. Taylor expanded in c0 around -inf 1.8%

    \[\leadsto \color{blue}{-0.5 \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}} \]
  6. Step-by-step derivation
    1. associate-*r/1.8%

      \[\leadsto \color{blue}{\frac{-0.5 \cdot \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)}{w}} \]
    2. distribute-lft1-in1.8%

      \[\leadsto \frac{-0.5 \cdot \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)}{w} \]
    3. metadata-eval1.8%

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

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

      \[\leadsto \frac{-0.5 \cdot \color{blue}{0}}{w} \]
    6. metadata-eval31.4%

      \[\leadsto \frac{\color{blue}{0}}{w} \]
  7. Simplified31.4%

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

Reproduce

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