Henrywood and Agarwal, Equation (13)

Percentage Accurate: 24.3% → 45.9%
Time: 19.2s
Alternatives: 11
Speedup: 156.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 24.3% accurate, 1.0× speedup?

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

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

Alternative 1: 45.9% accurate, 0.5× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;M\_m \leq 2 \cdot 10^{-173}:\\ \;\;\;\;\frac{1}{\frac{h}{\mathsf{fma}\left({\left(\frac{\left(h \cdot M\_m\right) \cdot D}{d}\right)}^{2}, -0.25, {\left(\frac{c0}{D} \cdot \frac{d}{w}\right)}^{2}\right)}}\\ \mathbf{elif}\;M\_m \leq 7 \cdot 10^{-128}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{c0 \cdot d}{{\left(w \cdot D\right)}^{2} \cdot h} \cdot c0\right) \cdot d\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
(FPCore (c0 w h D d M_m)
 :precision binary64
 (if (<= M_m 2e-173)
   (/
    1.0
    (/
     h
     (fma
      (pow (/ (* (* h M_m) D) d) 2.0)
      -0.25
      (pow (* (/ c0 D) (/ d w)) 2.0))))
   (if (<= M_m 7e-128) 0.0 (* (* (/ (* c0 d) (* (pow (* w D) 2.0) h)) c0) d))))
M_m = fabs(M);
double code(double c0, double w, double h, double D, double d, double M_m) {
	double tmp;
	if (M_m <= 2e-173) {
		tmp = 1.0 / (h / fma(pow((((h * M_m) * D) / d), 2.0), -0.25, pow(((c0 / D) * (d / w)), 2.0)));
	} else if (M_m <= 7e-128) {
		tmp = 0.0;
	} else {
		tmp = (((c0 * d) / (pow((w * D), 2.0) * h)) * c0) * d;
	}
	return tmp;
}
M_m = abs(M)
function code(c0, w, h, D, d, M_m)
	tmp = 0.0
	if (M_m <= 2e-173)
		tmp = Float64(1.0 / Float64(h / fma((Float64(Float64(Float64(h * M_m) * D) / d) ^ 2.0), -0.25, (Float64(Float64(c0 / D) * Float64(d / w)) ^ 2.0))));
	elseif (M_m <= 7e-128)
		tmp = 0.0;
	else
		tmp = Float64(Float64(Float64(Float64(c0 * d) / Float64((Float64(w * D) ^ 2.0) * h)) * c0) * d);
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
code[c0_, w_, h_, D_, d_, M$95$m_] := If[LessEqual[M$95$m, 2e-173], N[(1.0 / N[(h / N[(N[Power[N[(N[(N[(h * M$95$m), $MachinePrecision] * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * -0.25 + N[Power[N[(N[(c0 / D), $MachinePrecision] * N[(d / w), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M$95$m, 7e-128], 0.0, N[(N[(N[(N[(c0 * d), $MachinePrecision] / N[(N[Power[N[(w * D), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] * d), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|

\\
\begin{array}{l}
\mathbf{if}\;M\_m \leq 2 \cdot 10^{-173}:\\
\;\;\;\;\frac{1}{\frac{h}{\mathsf{fma}\left({\left(\frac{\left(h \cdot M\_m\right) \cdot D}{d}\right)}^{2}, -0.25, {\left(\frac{c0}{D} \cdot \frac{d}{w}\right)}^{2}\right)}}\\

\mathbf{elif}\;M\_m \leq 7 \cdot 10^{-128}:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 2.0000000000000001e-173

    1. Initial program 30.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. Applied rewrites38.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(c0 \cdot c0\right) \cdot \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \]
      14. lower-*.f6427.7

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\frac{h}{\mathsf{fma}\left({\left(\frac{\left(M \cdot h\right) \cdot D}{d}\right)}^{2}, -0.25, {\left(\frac{d}{w} \cdot \frac{c0}{D}\right)}^{2}\right)}}} \]

      if 2.0000000000000001e-173 < M < 6.99999999999999999e-128

      1. Initial program 0.4%

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

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

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

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

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

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

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

          \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
        7. metadata-eval57.5

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

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

      if 6.99999999999999999e-128 < M

      1. Initial program 18.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 2 \cdot 10^{-173}:\\ \;\;\;\;\frac{1}{\frac{h}{\mathsf{fma}\left({\left(\frac{\left(h \cdot M\right) \cdot D}{d}\right)}^{2}, -0.25, {\left(\frac{c0}{D} \cdot \frac{d}{w}\right)}^{2}\right)}}\\ \mathbf{elif}\;M \leq 7 \cdot 10^{-128}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{c0 \cdot d}{{\left(w \cdot D\right)}^{2} \cdot h} \cdot c0\right) \cdot d\\ \end{array} \]
      10. Add Preprocessing

      Alternative 2: 54.1% accurate, 0.5× speedup?

      \[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} t_0 := \frac{\left(d \cdot d\right) \cdot c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \mathbf{if}\;\left(\sqrt{t\_0 \cdot t\_0 - M\_m \cdot M\_m} + t\_0\right) \cdot \frac{c0}{w \cdot 2} \leq \infty:\\ \;\;\;\;\left(\frac{c0 \cdot d}{{\left(w \cdot D\right)}^{2} \cdot h} \cdot c0\right) \cdot d\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
      M_m = (fabs.f64 M)
      (FPCore (c0 w h D d M_m)
       :precision binary64
       (let* ((t_0 (/ (* (* d d) c0) (* (* w h) (* D D)))))
         (if (<=
              (* (+ (sqrt (- (* t_0 t_0) (* M_m M_m))) t_0) (/ c0 (* w 2.0)))
              INFINITY)
           (* (* (/ (* c0 d) (* (pow (* w D) 2.0) h)) c0) d)
           0.0)))
      M_m = fabs(M);
      double code(double c0, double w, double h, double D, double d, double M_m) {
      	double t_0 = ((d * d) * c0) / ((w * h) * (D * D));
      	double tmp;
      	if (((sqrt(((t_0 * t_0) - (M_m * M_m))) + t_0) * (c0 / (w * 2.0))) <= ((double) INFINITY)) {
      		tmp = (((c0 * d) / (pow((w * D), 2.0) * h)) * c0) * d;
      	} else {
      		tmp = 0.0;
      	}
      	return tmp;
      }
      
      M_m = Math.abs(M);
      public static double code(double c0, double w, double h, double D, double d, double M_m) {
      	double t_0 = ((d * d) * c0) / ((w * h) * (D * D));
      	double tmp;
      	if (((Math.sqrt(((t_0 * t_0) - (M_m * M_m))) + t_0) * (c0 / (w * 2.0))) <= Double.POSITIVE_INFINITY) {
      		tmp = (((c0 * d) / (Math.pow((w * D), 2.0) * h)) * c0) * d;
      	} else {
      		tmp = 0.0;
      	}
      	return tmp;
      }
      
      M_m = math.fabs(M)
      def code(c0, w, h, D, d, M_m):
      	t_0 = ((d * d) * c0) / ((w * h) * (D * D))
      	tmp = 0
      	if ((math.sqrt(((t_0 * t_0) - (M_m * M_m))) + t_0) * (c0 / (w * 2.0))) <= math.inf:
      		tmp = (((c0 * d) / (math.pow((w * D), 2.0) * h)) * c0) * d
      	else:
      		tmp = 0.0
      	return tmp
      
      M_m = abs(M)
      function code(c0, w, h, D, d, M_m)
      	t_0 = Float64(Float64(Float64(d * d) * c0) / Float64(Float64(w * h) * Float64(D * D)))
      	tmp = 0.0
      	if (Float64(Float64(sqrt(Float64(Float64(t_0 * t_0) - Float64(M_m * M_m))) + t_0) * Float64(c0 / Float64(w * 2.0))) <= Inf)
      		tmp = Float64(Float64(Float64(Float64(c0 * d) / Float64((Float64(w * D) ^ 2.0) * h)) * c0) * d);
      	else
      		tmp = 0.0;
      	end
      	return tmp
      end
      
      M_m = abs(M);
      function tmp_2 = code(c0, w, h, D, d, M_m)
      	t_0 = ((d * d) * c0) / ((w * h) * (D * D));
      	tmp = 0.0;
      	if (((sqrt(((t_0 * t_0) - (M_m * M_m))) + t_0) * (c0 / (w * 2.0))) <= Inf)
      		tmp = (((c0 * d) / (((w * D) ^ 2.0) * h)) * c0) * d;
      	else
      		tmp = 0.0;
      	end
      	tmp_2 = tmp;
      end
      
      M_m = N[Abs[M], $MachinePrecision]
      code[c0_, w_, h_, D_, d_, M$95$m_] := Block[{t$95$0 = N[(N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision] * N[(c0 / N[(w * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(N[(c0 * d), $MachinePrecision] / N[(N[Power[N[(w * D), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] * d), $MachinePrecision], 0.0]]
      
      \begin{array}{l}
      M_m = \left|M\right|
      
      \\
      \begin{array}{l}
      t_0 := \frac{\left(d \cdot d\right) \cdot c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
      \mathbf{if}\;\left(\sqrt{t\_0 \cdot t\_0 - M\_m \cdot M\_m} + t\_0\right) \cdot \frac{c0}{w \cdot 2} \leq \infty:\\
      \;\;\;\;\left(\frac{c0 \cdot d}{{\left(w \cdot D\right)}^{2} \cdot h} \cdot c0\right) \cdot d\\
      
      \mathbf{else}:\\
      \;\;\;\;0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0

        1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          1. Initial program 0.0%

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

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

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

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

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

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

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

              \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
            7. metadata-eval36.1

              \[\leadsto \color{blue}{0} \]
          5. Applied rewrites36.1%

            \[\leadsto \color{blue}{0} \]
        8. Recombined 2 regimes into one program.
        9. Final simplification49.7%

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

        Alternative 3: 45.9% accurate, 0.6× speedup?

        \[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;M\_m \leq 2 \cdot 10^{-173}:\\ \;\;\;\;\frac{\mathsf{fma}\left({\left(\frac{\left(h \cdot M\_m\right) \cdot D}{d}\right)}^{2}, -0.25, {\left(\frac{c0}{D} \cdot \frac{d}{w}\right)}^{2}\right)}{h}\\ \mathbf{elif}\;M\_m \leq 7 \cdot 10^{-128}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{c0 \cdot d}{{\left(w \cdot D\right)}^{2} \cdot h} \cdot c0\right) \cdot d\\ \end{array} \end{array} \]
        M_m = (fabs.f64 M)
        (FPCore (c0 w h D d M_m)
         :precision binary64
         (if (<= M_m 2e-173)
           (/
            (fma (pow (/ (* (* h M_m) D) d) 2.0) -0.25 (pow (* (/ c0 D) (/ d w)) 2.0))
            h)
           (if (<= M_m 7e-128) 0.0 (* (* (/ (* c0 d) (* (pow (* w D) 2.0) h)) c0) d))))
        M_m = fabs(M);
        double code(double c0, double w, double h, double D, double d, double M_m) {
        	double tmp;
        	if (M_m <= 2e-173) {
        		tmp = fma(pow((((h * M_m) * D) / d), 2.0), -0.25, pow(((c0 / D) * (d / w)), 2.0)) / h;
        	} else if (M_m <= 7e-128) {
        		tmp = 0.0;
        	} else {
        		tmp = (((c0 * d) / (pow((w * D), 2.0) * h)) * c0) * d;
        	}
        	return tmp;
        }
        
        M_m = abs(M)
        function code(c0, w, h, D, d, M_m)
        	tmp = 0.0
        	if (M_m <= 2e-173)
        		tmp = Float64(fma((Float64(Float64(Float64(h * M_m) * D) / d) ^ 2.0), -0.25, (Float64(Float64(c0 / D) * Float64(d / w)) ^ 2.0)) / h);
        	elseif (M_m <= 7e-128)
        		tmp = 0.0;
        	else
        		tmp = Float64(Float64(Float64(Float64(c0 * d) / Float64((Float64(w * D) ^ 2.0) * h)) * c0) * d);
        	end
        	return tmp
        end
        
        M_m = N[Abs[M], $MachinePrecision]
        code[c0_, w_, h_, D_, d_, M$95$m_] := If[LessEqual[M$95$m, 2e-173], N[(N[(N[Power[N[(N[(N[(h * M$95$m), $MachinePrecision] * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * -0.25 + N[Power[N[(N[(c0 / D), $MachinePrecision] * N[(d / w), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[M$95$m, 7e-128], 0.0, N[(N[(N[(N[(c0 * d), $MachinePrecision] / N[(N[Power[N[(w * D), $MachinePrecision], 2.0], $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision] * d), $MachinePrecision]]]
        
        \begin{array}{l}
        M_m = \left|M\right|
        
        \\
        \begin{array}{l}
        \mathbf{if}\;M\_m \leq 2 \cdot 10^{-173}:\\
        \;\;\;\;\frac{\mathsf{fma}\left({\left(\frac{\left(h \cdot M\_m\right) \cdot D}{d}\right)}^{2}, -0.25, {\left(\frac{c0}{D} \cdot \frac{d}{w}\right)}^{2}\right)}{h}\\
        
        \mathbf{elif}\;M\_m \leq 7 \cdot 10^{-128}:\\
        \;\;\;\;0\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(\frac{c0 \cdot d}{{\left(w \cdot D\right)}^{2} \cdot h} \cdot c0\right) \cdot d\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if M < 2.0000000000000001e-173

          1. Initial program 30.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. Applied rewrites38.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(c0 \cdot c0\right) \cdot \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \color{blue}{\left(w \cdot w\right)}} \]
            14. lower-*.f6427.7

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

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

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

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

            \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{c0 \cdot c0}{D \cdot D}, \frac{d \cdot d}{w \cdot w}, -0.25 \cdot \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot h\right) \cdot \left(M \cdot h\right)\right)}{d \cdot d}\right)}{h}} \]
          10. Step-by-step derivation
            1. Applied rewrites51.7%

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

            if 2.0000000000000001e-173 < M < 6.99999999999999999e-128

            1. Initial program 0.4%

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

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

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

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

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

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

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

                \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
              7. metadata-eval57.5

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

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

            if 6.99999999999999999e-128 < M

            1. Initial program 18.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 2 \cdot 10^{-173}:\\ \;\;\;\;\frac{\mathsf{fma}\left({\left(\frac{\left(h \cdot M\right) \cdot D}{d}\right)}^{2}, -0.25, {\left(\frac{c0}{D} \cdot \frac{d}{w}\right)}^{2}\right)}{h}\\ \mathbf{elif}\;M \leq 7 \cdot 10^{-128}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{c0 \cdot d}{{\left(w \cdot D\right)}^{2} \cdot h} \cdot c0\right) \cdot d\\ \end{array} \]
            10. Add Preprocessing

            Alternative 4: 53.5% accurate, 0.7× speedup?

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

              1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 0.0%

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

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

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

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

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

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

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

                  \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
                7. metadata-eval36.1

                  \[\leadsto \color{blue}{0} \]
              5. Applied rewrites36.1%

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

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

            Alternative 5: 52.4% accurate, 0.7× speedup?

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

              1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  1. Initial program 0.0%

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

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

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

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

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

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

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

                      \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
                    7. metadata-eval36.1

                      \[\leadsto \color{blue}{0} \]
                  5. Applied rewrites36.1%

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

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

                Alternative 6: 51.5% accurate, 0.7× speedup?

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

                  1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      1. Initial program 0.0%

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

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

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

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

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

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

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

                          \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
                        7. metadata-eval36.1

                          \[\leadsto \color{blue}{0} \]
                      5. Applied rewrites36.1%

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

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

                    Alternative 7: 50.7% accurate, 0.7× speedup?

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

                      1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \left(c0 \cdot c0\right) \cdot \frac{d \cdot d}{\left(\left(\left(D \cdot D\right) \cdot w\right) \cdot h\right) \cdot \color{blue}{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. Add Preprocessing
                        3. Taylor expanded in c0 around -inf

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

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

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

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

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

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

                            \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
                          7. metadata-eval36.1

                            \[\leadsto \color{blue}{0} \]
                        5. Applied rewrites36.1%

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

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

                      Alternative 8: 50.1% accurate, 0.7× speedup?

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

                        1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            1. Initial program 0.0%

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

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

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

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

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

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

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

                                \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
                              7. metadata-eval36.1

                                \[\leadsto \color{blue}{0} \]
                            5. Applied rewrites36.1%

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

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

                          Alternative 9: 48.9% accurate, 0.7× speedup?

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

                            1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                1. Initial program 0.0%

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

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

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

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

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

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

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

                                    \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
                                  7. metadata-eval36.1

                                    \[\leadsto \color{blue}{0} \]
                                5. Applied rewrites36.1%

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

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

                              Alternative 10: 48.4% accurate, 0.7× speedup?

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

                                1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                1. Initial program 0.0%

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

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

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

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

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

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

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

                                    \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
                                  7. metadata-eval36.1

                                    \[\leadsto \color{blue}{0} \]
                                5. Applied rewrites36.1%

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

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

                              Alternative 11: 33.7% accurate, 156.0× speedup?

                              \[\begin{array}{l} M_m = \left|M\right| \\ 0 \end{array} \]
                              M_m = (fabs.f64 M)
                              (FPCore (c0 w h D d M_m) :precision binary64 0.0)
                              M_m = fabs(M);
                              double code(double c0, double w, double h, double D, double d, double M_m) {
                              	return 0.0;
                              }
                              
                              M_m = abs(m)
                              real(8) function code(c0, w, h, d, d_1, m_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_m
                                  code = 0.0d0
                              end function
                              
                              M_m = Math.abs(M);
                              public static double code(double c0, double w, double h, double D, double d, double M_m) {
                              	return 0.0;
                              }
                              
                              M_m = math.fabs(M)
                              def code(c0, w, h, D, d, M_m):
                              	return 0.0
                              
                              M_m = abs(M)
                              function code(c0, w, h, D, d, M_m)
                              	return 0.0
                              end
                              
                              M_m = abs(M);
                              function tmp = code(c0, w, h, D, d, M_m)
                              	tmp = 0.0;
                              end
                              
                              M_m = N[Abs[M], $MachinePrecision]
                              code[c0_, w_, h_, D_, d_, M$95$m_] := 0.0
                              
                              \begin{array}{l}
                              M_m = \left|M\right|
                              
                              \\
                              0
                              \end{array}
                              
                              Derivation
                              1. Initial program 24.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. Add Preprocessing
                              3. Taylor expanded in c0 around -inf

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

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

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

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

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

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

                                  \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
                                7. metadata-eval27.4

                                  \[\leadsto \color{blue}{0} \]
                              5. Applied rewrites27.4%

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

                              Reproduce

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