Henrywood and Agarwal, Equation (13)

?

Percentage Accurate: 24.7% → 41.1%
Time: 31.6s
Precision: binary64
Cost: 9812

?

\[\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) \]
\[\begin{array}{l} t_0 := {\left(\frac{d}{D}\right)}^{2}\\ t_1 := \frac{c0 \cdot \left(2 \cdot \left(t_0 \cdot \frac{c0}{w \cdot h}\right)\right)}{2 \cdot w}\\ t_2 := \frac{c0}{2 \cdot w}\\ \mathbf{if}\;D \cdot D \leq 5 \cdot 10^{-302}:\\ \;\;\;\;t_2 \cdot \left(2 \cdot \frac{\frac{c0 \cdot t_0}{w}}{h}\right)\\ \mathbf{elif}\;D \cdot D \leq 10^{-230}:\\ \;\;\;\;0\\ \mathbf{elif}\;D \cdot D \leq 5 \cdot 10^{-153}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;D \cdot D \leq 1000000000000:\\ \;\;\;\;0\\ \mathbf{elif}\;D \cdot D \leq 10^{+294}:\\ \;\;\;\;t_2 \cdot \mathsf{fma}\left(2, d \cdot \left(d \cdot \frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right), 0.5 \cdot \frac{D \cdot D}{\frac{c0}{\left(w \cdot h\right) \cdot 0}}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
(FPCore (c0 w h D d M)
 :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))))))
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (pow (/ d D) 2.0))
        (t_1 (/ (* c0 (* 2.0 (* t_0 (/ c0 (* w h))))) (* 2.0 w)))
        (t_2 (/ c0 (* 2.0 w))))
   (if (<= (* D D) 5e-302)
     (* t_2 (* 2.0 (/ (/ (* c0 t_0) w) h)))
     (if (<= (* D D) 1e-230)
       0.0
       (if (<= (* D D) 5e-153)
         t_1
         (if (<= (* D D) 1000000000000.0)
           0.0
           (if (<= (* D D) 1e+294)
             (*
              t_2
              (fma
               2.0
               (* d (* d (/ c0 (* (* w h) (* D D)))))
               (* 0.5 (/ (* D D) (/ c0 (* (* w h) 0.0))))))
             t_1)))))))
double code(double c0, double w, double h, double D, double d, double M) {
	return (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))));
}
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = pow((d / D), 2.0);
	double t_1 = (c0 * (2.0 * (t_0 * (c0 / (w * h))))) / (2.0 * w);
	double t_2 = c0 / (2.0 * w);
	double tmp;
	if ((D * D) <= 5e-302) {
		tmp = t_2 * (2.0 * (((c0 * t_0) / w) / h));
	} else if ((D * D) <= 1e-230) {
		tmp = 0.0;
	} else if ((D * D) <= 5e-153) {
		tmp = t_1;
	} else if ((D * D) <= 1000000000000.0) {
		tmp = 0.0;
	} else if ((D * D) <= 1e+294) {
		tmp = t_2 * fma(2.0, (d * (d * (c0 / ((w * h) * (D * D))))), (0.5 * ((D * D) / (c0 / ((w * h) * 0.0)))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(c0, w, h, D, d, M)
	return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) + sqrt(Float64(Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) * Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))) - Float64(M * M)))))
end
function code(c0, w, h, D, d, M)
	t_0 = Float64(d / D) ^ 2.0
	t_1 = Float64(Float64(c0 * Float64(2.0 * Float64(t_0 * Float64(c0 / Float64(w * h))))) / Float64(2.0 * w))
	t_2 = Float64(c0 / Float64(2.0 * w))
	tmp = 0.0
	if (Float64(D * D) <= 5e-302)
		tmp = Float64(t_2 * Float64(2.0 * Float64(Float64(Float64(c0 * t_0) / w) / h)));
	elseif (Float64(D * D) <= 1e-230)
		tmp = 0.0;
	elseif (Float64(D * D) <= 5e-153)
		tmp = t_1;
	elseif (Float64(D * D) <= 1000000000000.0)
		tmp = 0.0;
	elseif (Float64(D * D) <= 1e+294)
		tmp = Float64(t_2 * fma(2.0, Float64(d * Float64(d * Float64(c0 / Float64(Float64(w * h) * Float64(D * D))))), Float64(0.5 * Float64(Float64(D * D) / Float64(c0 / Float64(Float64(w * h) * 0.0))))));
	else
		tmp = t_1;
	end
	return tmp
end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(2.0 * N[(t$95$0 * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(D * D), $MachinePrecision], 5e-302], N[(t$95$2 * N[(2.0 * N[(N[(N[(c0 * t$95$0), $MachinePrecision] / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(D * D), $MachinePrecision], 1e-230], 0.0, If[LessEqual[N[(D * D), $MachinePrecision], 5e-153], t$95$1, If[LessEqual[N[(D * D), $MachinePrecision], 1000000000000.0], 0.0, If[LessEqual[N[(D * D), $MachinePrecision], 1e+294], N[(t$95$2 * N[(2.0 * N[(d * N[(d * N[(c0 / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(D * D), $MachinePrecision] / N[(c0 / N[(N[(w * h), $MachinePrecision] * 0.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{2}\\
t_1 := \frac{c0 \cdot \left(2 \cdot \left(t_0 \cdot \frac{c0}{w \cdot h}\right)\right)}{2 \cdot w}\\
t_2 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;D \cdot D \leq 5 \cdot 10^{-302}:\\
\;\;\;\;t_2 \cdot \left(2 \cdot \frac{\frac{c0 \cdot t_0}{w}}{h}\right)\\

\mathbf{elif}\;D \cdot D \leq 10^{-230}:\\
\;\;\;\;0\\

\mathbf{elif}\;D \cdot D \leq 5 \cdot 10^{-153}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;D \cdot D \leq 1000000000000:\\
\;\;\;\;0\\

\mathbf{elif}\;D \cdot D \leq 10^{+294}:\\
\;\;\;\;t_2 \cdot \mathsf{fma}\left(2, d \cdot \left(d \cdot \frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right), 0.5 \cdot \frac{D \cdot D}{\frac{c0}{\left(w \cdot h\right) \cdot 0}}\right)\\

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


\end{array}

Local Percentage Accuracy?

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.

Herbie found 12 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each of Herbie's proposed alternatives. Up and to the right is better. Each dot represents an alternative program; the red square represents the initial program.

Bogosity?

Bogosity

Derivation?

  1. Split input into 4 regimes
  2. if (*.f64 D D) < 5.00000000000000033e-302

    1. Initial program 26.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. Simplified36.3%

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

      [Start]26.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) \]

      times-frac [=>]26.7

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

      fma-def [=>]26.7

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

      associate-/r* [=>]26.7

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

      difference-of-squares [=>]32.0

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M\right)}}\right) \]
    3. Applied egg-rr34.9%

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

      [Start]36.3

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]

      frac-times [=>]34.9

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

      associate-/l* [=>]35.9

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

      div-inv [=>]35.9

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

      clear-num [<=]35.9

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

      associate-*l* [=>]34.9

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

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

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

      [Start]33.4

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

      *-commutative [=>]33.4

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

      associate-*r* [=>]34.4

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

      *-commutative [=>]34.4

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

      associate-*r* [<=]34.4

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

      unpow2 [=>]34.4

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

      times-frac [=>]35.4

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

      unpow2 [<=]35.4

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

      associate-*r/ [=>]35.3

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

      unpow2 [=>]35.3

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

      associate-/r* [=>]35.4

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

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

      [Start]47.8

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

      associate-*r/ [=>]48.2

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

    if 5.00000000000000033e-302 < (*.f64 D D) < 1.00000000000000005e-230 or 5.00000000000000033e-153 < (*.f64 D D) < 1e12

    1. Initial program 11.3%

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

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

      [Start]11.3

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

      times-frac [=>]4.9

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

      fma-def [=>]2.7

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

      associate-/r* [=>]2.8

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

      difference-of-squares [=>]5.1

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(c0 \cdot 0\right)} \]
      Step-by-step derivation

      [Start]10.8

      \[ \frac{c0}{2 \cdot w} \cdot \left(-1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]

      associate-*r* [=>]10.8

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

      distribute-rgt1-in [=>]10.8

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

      metadata-eval [=>]10.8

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

      mul0-lft [=>]41.8

      \[ \frac{c0}{2 \cdot w} \cdot \left(\left(-1 \cdot \color{blue}{0}\right) \cdot c0\right) \]

      metadata-eval [=>]41.8

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

      mul0-lft [<=]10.8

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

      metadata-eval [<=]10.8

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

      distribute-lft1-in [<=]10.8

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

      *-commutative [=>]10.8

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

      distribute-lft1-in [=>]10.8

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

      metadata-eval [=>]10.8

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

      mul0-lft [=>]41.8

      \[ \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \color{blue}{0}\right) \]
    5. Taylor expanded in c0 around 0 54.7%

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

    if 1.00000000000000005e-230 < (*.f64 D D) < 5.00000000000000033e-153 or 1.00000000000000007e294 < (*.f64 D D)

    1. Initial program 16.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. Simplified41.1%

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

      [Start]16.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) \]

      times-frac [=>]16.9

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

      fma-def [=>]17.0

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

      associate-/r* [=>]17.0

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

      difference-of-squares [=>]17.0

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M\right)}}\right) \]
    3. Applied egg-rr37.4%

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

      [Start]41.1

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]

      frac-times [=>]39.2

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

      associate-/l* [=>]39.2

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

      div-inv [=>]39.2

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

      clear-num [<=]39.2

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

      associate-*l* [=>]37.4

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

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

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

      [Start]18.9

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

      *-commutative [=>]18.9

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

      associate-*r* [=>]18.9

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

      *-commutative [=>]18.9

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

      associate-*r* [<=]17.1

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

      unpow2 [=>]17.1

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

      times-frac [=>]20.7

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

      unpow2 [<=]20.7

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

      associate-*r/ [=>]18.8

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

      unpow2 [=>]18.8

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

      associate-/r* [=>]22.5

      \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\frac{\frac{\frac{c0}{w} \cdot \left(d \cdot d\right)}{{D}^{2}}}{h}}\right) \]
    6. Applied egg-rr60.3%

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

      [Start]56.7

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

      associate-*l/ [=>]56.8

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

      associate-*r/ [=>]58.8

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

      *-commutative [<=]58.8

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

      associate-/r* [<=]58.4

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

      associate-*l/ [<=]60.3

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

      *-commutative [=>]60.3

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

    if 1e12 < (*.f64 D D) < 1.00000000000000007e294

    1. Initial program 25.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. Simplified20.9%

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

      [Start]25.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) \]

      associate-*l* [=>]22.7

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

      difference-of-squares [=>]22.9

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

      associate-*l* [=>]20.5

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

      associate-*l* [=>]20.9

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

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

      [Start]20.9

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

      times-frac [=>]20.8

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

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

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

      [Start]25.4

      \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)} + 0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left(\left(\frac{c0 \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{c0 \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot h\right)\right)}{c0}\right) \]

      fma-def [=>]25.4

      \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(2, \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}, 0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left(\left(\frac{c0 \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{c0 \cdot M}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot h\right)\right)}{c0}\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification53.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;D \cdot D \leq 5 \cdot 10^{-302}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\frac{c0 \cdot {\left(\frac{d}{D}\right)}^{2}}{w}}{h}\right)\\ \mathbf{elif}\;D \cdot D \leq 10^{-230}:\\ \;\;\;\;0\\ \mathbf{elif}\;D \cdot D \leq 5 \cdot 10^{-153}:\\ \;\;\;\;\frac{c0 \cdot \left(2 \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h}\right)\right)}{2 \cdot w}\\ \mathbf{elif}\;D \cdot D \leq 1000000000000:\\ \;\;\;\;0\\ \mathbf{elif}\;D \cdot D \leq 10^{+294}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(2, d \cdot \left(d \cdot \frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right), 0.5 \cdot \frac{D \cdot D}{\frac{c0}{\left(w \cdot h\right) \cdot 0}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c0 \cdot \left(2 \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h}\right)\right)}{2 \cdot w}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy54.2%
Cost18372
\[\begin{array}{l} t_0 := \left(w \cdot h\right) \cdot \left(D \cdot D\right)\\ t_1 := \frac{c0}{2 \cdot w}\\ t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{t_0}\\ \mathbf{if}\;t_1 \cdot \left(t_2 + \sqrt{t_2 \cdot t_2 - M \cdot M}\right) \leq \infty:\\ \;\;\;\;t_1 \cdot \mathsf{fma}\left(2, d \cdot \left(d \cdot \frac{c0}{t_0}\right), 0.5 \cdot \frac{D \cdot D}{\frac{d \cdot d}{w \cdot \left(h \cdot 0\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 2
Accuracy40.7%
Cost8852
\[\begin{array}{l} t_0 := {\left(\frac{d}{D}\right)}^{2}\\ t_1 := \frac{c0 \cdot \left(2 \cdot \left(t_0 \cdot \frac{c0}{w \cdot h}\right)\right)}{2 \cdot w}\\ \mathbf{if}\;D \cdot D \leq 5 \cdot 10^{-302}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\frac{c0 \cdot t_0}{w}}{h}\right)\\ \mathbf{elif}\;D \cdot D \leq 10^{-230}:\\ \;\;\;\;0\\ \mathbf{elif}\;D \cdot D \leq 5 \cdot 10^{-153}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;D \cdot D \leq 1000000000000:\\ \;\;\;\;0\\ \mathbf{elif}\;D \cdot D \leq 10^{+91}:\\ \;\;\;\;d \cdot \left(\frac{d}{D \cdot D} \cdot \left(\frac{c0}{h} \cdot \frac{c0}{w \cdot w}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Accuracy40.3%
Cost8852
\[\begin{array}{l} t_0 := {\left(\frac{d}{D}\right)}^{2}\\ t_1 := \frac{c0 \cdot \left(2 \cdot \left(t_0 \cdot \frac{c0}{w \cdot h}\right)\right)}{2 \cdot w}\\ \mathbf{if}\;D \cdot D \leq 5 \cdot 10^{-302}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\frac{c0 \cdot t_0}{w}}{h}\right)\\ \mathbf{elif}\;D \cdot D \leq 10^{-230}:\\ \;\;\;\;0\\ \mathbf{elif}\;D \cdot D \leq 5 \cdot 10^{-153}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;D \cdot D \leq 1000000000000:\\ \;\;\;\;0\\ \mathbf{elif}\;D \cdot D \leq 10^{+294}:\\ \;\;\;\;d \cdot \left(\frac{d}{D \cdot D} \cdot \frac{c0 \cdot c0}{w \cdot \left(w \cdot h\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Accuracy42.3%
Cost8072
\[\begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ \mathbf{if}\;d \cdot d \leq 10^{+134}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h}\right)\\ \mathbf{elif}\;d \cdot d \leq 5 \cdot 10^{+302}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h}\right)\right)\\ \end{array} \]
Alternative 5
Accuracy43.0%
Cost8072
\[\begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ \mathbf{if}\;d \cdot d \leq 10^{+134}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h}\right)\\ \mathbf{elif}\;d \cdot d \leq 5 \cdot 10^{+302}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \frac{\frac{c0 \cdot {\left(\frac{d}{D}\right)}^{2}}{w}}{h}\right)\\ \end{array} \]
Alternative 6
Accuracy43.2%
Cost1865
\[\begin{array}{l} \mathbf{if}\;d \cdot d \leq 10^{+134} \lor \neg \left(d \cdot d \leq 5 \cdot 10^{+302}\right):\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 7
Accuracy42.6%
Cost1609
\[\begin{array}{l} \mathbf{if}\;c0 \leq -24500000 \lor \neg \left(c0 \leq 3.3 \cdot 10^{+80}\right):\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\frac{c0}{w} \cdot \left(d \cdot \frac{d}{D \cdot D}\right)}{h}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 8
Accuracy41.2%
Cost1353
\[\begin{array}{l} \mathbf{if}\;c0 \leq -26500000 \lor \neg \left(c0 \leq 2.5 \cdot 10^{+81}\right):\\ \;\;\;\;\left(d \cdot \frac{d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{c0}{w}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 9
Accuracy40.7%
Cost1352
\[\begin{array}{l} \mathbf{if}\;c0 \leq -9600000:\\ \;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\ \mathbf{elif}\;c0 \leq 5 \cdot 10^{+82}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(d \cdot \frac{d}{D \cdot D}\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{c0}{w}\right)\\ \end{array} \]
Alternative 10
Accuracy36.1%
Cost1220
\[\begin{array}{l} \mathbf{if}\;M \leq 7.2 \cdot 10^{-21}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{c0}{h} \cdot \frac{c0}{w \cdot w}\right) \cdot \left(d \cdot \frac{d}{D \cdot D}\right)\\ \end{array} \]
Alternative 11
Accuracy32.8%
Cost64
\[0 \]

Reproduce?

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