Henrywood and Agarwal, Equation (13)

?

Percentage Accurate: 24.4% → 63.8%
Time: 29.2s
Precision: binary64
Cost: 44484

?

\[\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 := \frac{c0}{w \cdot h}\\ t_1 := t_0 \cdot {\left(\frac{d}{D}\right)}^{2}\\ t_2 := \frac{c0}{2 \cdot w}\\ t_3 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ t_4 := t_2 \cdot \left(t_3 + \sqrt{t_3 \cdot t_3 - M \cdot M}\right)\\ \mathbf{if}\;t_4 \leq -2 \cdot 10^{-304}:\\ \;\;\;\;t_2 \cdot \mathsf{fma}\left(t_0, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{M + t_1} \cdot \sqrt{t_1 - M}\right)\\ \mathbf{elif}\;t_4 \leq 0 \lor \neg \left(t_4 \leq \infty\right):\\ \;\;\;\;0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{d}{\frac{D \cdot \left(w \cdot \sqrt{h}\right)}{c0}}\right)}^{2}\\ \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 (/ c0 (* w h)))
        (t_1 (* t_0 (pow (/ d D) 2.0)))
        (t_2 (/ c0 (* 2.0 w)))
        (t_3 (/ (* c0 (* d d)) (* (* w h) (* D D))))
        (t_4 (* t_2 (+ t_3 (sqrt (- (* t_3 t_3) (* M M)))))))
   (if (<= t_4 -2e-304)
     (*
      t_2
      (fma t_0 (* (/ d D) (/ d D)) (* (sqrt (+ M t_1)) (sqrt (- t_1 M)))))
     (if (or (<= t_4 0.0) (not (<= t_4 INFINITY)))
       (* 0.25 (* (* (/ D d) (/ D d)) (* h (* M M))))
       (pow (/ d (/ (* D (* w (sqrt h))) c0)) 2.0)))))
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 = c0 / (w * h);
	double t_1 = t_0 * pow((d / D), 2.0);
	double t_2 = c0 / (2.0 * w);
	double t_3 = (c0 * (d * d)) / ((w * h) * (D * D));
	double t_4 = t_2 * (t_3 + sqrt(((t_3 * t_3) - (M * M))));
	double tmp;
	if (t_4 <= -2e-304) {
		tmp = t_2 * fma(t_0, ((d / D) * (d / D)), (sqrt((M + t_1)) * sqrt((t_1 - M))));
	} else if ((t_4 <= 0.0) || !(t_4 <= ((double) INFINITY))) {
		tmp = 0.25 * (((D / d) * (D / d)) * (h * (M * M)));
	} else {
		tmp = pow((d / ((D * (w * sqrt(h))) / c0)), 2.0);
	}
	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(c0 / Float64(w * h))
	t_1 = Float64(t_0 * (Float64(d / D) ^ 2.0))
	t_2 = Float64(c0 / Float64(2.0 * w))
	t_3 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))
	t_4 = Float64(t_2 * Float64(t_3 + sqrt(Float64(Float64(t_3 * t_3) - Float64(M * M)))))
	tmp = 0.0
	if (t_4 <= -2e-304)
		tmp = Float64(t_2 * fma(t_0, Float64(Float64(d / D) * Float64(d / D)), Float64(sqrt(Float64(M + t_1)) * sqrt(Float64(t_1 - M)))));
	elseif ((t_4 <= 0.0) || !(t_4 <= Inf))
		tmp = Float64(0.25 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(h * Float64(M * M))));
	else
		tmp = Float64(d / Float64(Float64(D * Float64(w * sqrt(h))) / c0)) ^ 2.0;
	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[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 * N[(t$95$3 + N[Sqrt[N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -2e-304], N[(t$95$2 * N[(t$95$0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(M + t$95$1), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$1 - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$4, 0.0], N[Not[LessEqual[t$95$4, Infinity]], $MachinePrecision]], N[(0.25 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(d / N[(N[(D * N[(w * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]]]]]]
\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 := \frac{c0}{w \cdot h}\\
t_1 := t_0 \cdot {\left(\frac{d}{D}\right)}^{2}\\
t_2 := \frac{c0}{2 \cdot w}\\
t_3 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_4 := t_2 \cdot \left(t_3 + \sqrt{t_3 \cdot t_3 - M \cdot M}\right)\\
\mathbf{if}\;t_4 \leq -2 \cdot 10^{-304}:\\
\;\;\;\;t_2 \cdot \mathsf{fma}\left(t_0, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{M + t_1} \cdot \sqrt{t_1 - M}\right)\\

\mathbf{elif}\;t_4 \leq 0 \lor \neg \left(t_4 \leq \infty\right):\\
\;\;\;\;0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\\

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


\end{array}

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.

Herbie found 14 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

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.

Bogosity?

Bogosity

Derivation?

  1. Split input into 3 regimes
  2. if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -1.99999999999999994e-304

    1. Initial program 84.6%

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

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

      [Start]84.6%

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

      times-frac [=>]82.6%

      \[ \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 [=>]82.6%

      \[ \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)} \]

      times-frac [=>]82.6%

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{d}{D} \cdot \frac{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 [=>]82.6%

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d}{D} \cdot \frac{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-rr77.4%

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

      [Start]82.7%

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

      associate-*r/ [=>]82.7%

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

      *-commutative [<=]82.7%

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

      times-frac [=>]82.7%

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

      associate-/l/ [<=]85.0%

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

      associate-*r/ [=>]85.0%

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

      associate-/l/ [<=]77.5%

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

      associate-/l* [=>]77.5%

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

      div-inv [=>]77.4%

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

      clear-num [<=]77.4%

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

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

      [Start]77.4%

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

      associate-/l* [=>]77.4%

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

      associate-/l/ [=>]84.9%

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

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

      [Start]84.9%

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

      sqrt-prod [=>]88.7%

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

    if -1.99999999999999994e-304 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < 0.0 or +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M)))))

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

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

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

      [Start]7.5%

      \[ \frac{c0}{2 \cdot w} \cdot \left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -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) \]

      fma-def [=>]7.5%

      \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}, -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)} \]

      times-frac [=>]8.6%

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \color{blue}{\frac{{D}^{2}}{{d}^{2}} \cdot \frac{w \cdot \left({M}^{2} \cdot h\right)}{c0}}, -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) \]

      unpow2 [=>]8.6%

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{\color{blue}{D \cdot D}}{{d}^{2}} \cdot \frac{w \cdot \left({M}^{2} \cdot h\right)}{c0}, -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) \]

      unpow2 [=>]8.6%

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\color{blue}{d \cdot d}} \cdot \frac{w \cdot \left({M}^{2} \cdot h\right)}{c0}, -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) \]

      *-commutative [=>]8.6%

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{d \cdot d} \cdot \frac{w \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}}{c0}, -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) \]

      unpow2 [=>]8.6%

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{d \cdot d} \cdot \frac{w \cdot \left(h \cdot \color{blue}{\left(M \cdot M\right)}\right)}{c0}, -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* [=>]8.6%

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{d \cdot d} \cdot \frac{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}{c0}, \color{blue}{\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) \]
    4. Taylor expanded in c0 around 0 44.0%

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

      \[\leadsto \color{blue}{0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)} \]
      Step-by-step derivation

      [Start]44.0%

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

      unpow2 [=>]44.0%

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

      unpow2 [=>]44.0%

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

      unpow2 [=>]44.0%

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

      associate-/l* [=>]42.9%

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

      associate-/r/ [=>]44.0%

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

      times-frac [=>]57.3%

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

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

    1. Initial program 72.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. Simplified71.9%

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

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

      times-frac [=>]71.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 [=>]71.9%

      \[ \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)} \]

      times-frac [=>]71.9%

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{d}{D} \cdot \frac{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 [=>]71.9%

      \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d}{D} \cdot \frac{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-rr68.7%

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

      [Start]71.9%

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

      associate-*r/ [=>]71.9%

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

      *-commutative [<=]71.9%

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

      times-frac [=>]71.9%

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

      associate-/l/ [<=]71.9%

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

      associate-*r/ [=>]71.9%

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

      associate-/l/ [<=]68.7%

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

      associate-/l* [=>]68.7%

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

      div-inv [=>]68.7%

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

      clear-num [<=]68.7%

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

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

      [Start]68.7%

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

      associate-/l* [=>]68.7%

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

      associate-/l/ [=>]71.9%

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

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

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

      [Start]61.8%

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

      unpow2 [=>]61.8%

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

      unpow2 [=>]61.8%

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

      swap-sqr [<=]77.7%

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

      unpow2 [<=]77.7%

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

      *-commutative [=>]77.7%

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

      unpow2 [=>]77.7%

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

      unpow2 [=>]77.7%

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

      associate-*l* [=>]77.7%

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

      associate-*r* [=>]80.9%

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

      *-commutative [<=]80.9%

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

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

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

      [Start]61.8%

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

      unpow2 [=>]61.8%

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

      unpow2 [=>]61.8%

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

      swap-sqr [<=]77.7%

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

      unpow2 [=>]77.7%

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

      unpow2 [=>]77.7%

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

      associate-*r* [<=]80.9%

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

      *-commutative [=>]80.9%

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

      unpow2 [<=]80.9%

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

      associate-*r* [=>]77.7%

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

      unpow2 [<=]77.7%

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

      associate-*l* [=>]80.9%

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

      unpow2 [=>]80.9%

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

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

      [Start]80.9%

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

      pow2 [<=]80.9%

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

      *-commutative [=>]80.9%

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

      *-commutative [=>]80.9%

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

      associate-*r* [<=]77.7%

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

      expm1-log1p-u [=>]76.4%

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

      expm1-udef [=>]76.4%

      \[ \color{blue}{e^{\mathsf{log1p}\left(\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)} - 1} \]
    10. Simplified96.5%

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

      [Start]88.4%

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

      expm1-def [=>]94.7%

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

      expm1-log1p [=>]96.5%

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

      associate-/l* [=>]96.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\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) \leq -2 \cdot 10^{-304}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{M + \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}} \cdot \sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M}\right)\\ \mathbf{elif}\;\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) \leq 0 \lor \neg \left(\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) \leq \infty\right):\\ \;\;\;\;0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{d}{\frac{D \cdot \left(w \cdot \sqrt{h}\right)}{c0}}\right)}^{2}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy63.8%
Cost44484
\[\begin{array}{l} t_0 := \frac{c0}{w \cdot h}\\ t_1 := t_0 \cdot {\left(\frac{d}{D}\right)}^{2}\\ t_2 := \frac{c0}{2 \cdot w}\\ t_3 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ t_4 := t_2 \cdot \left(t_3 + \sqrt{t_3 \cdot t_3 - M \cdot M}\right)\\ \mathbf{if}\;t_4 \leq -2 \cdot 10^{-304}:\\ \;\;\;\;t_2 \cdot \mathsf{fma}\left(t_0, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{M + t_1} \cdot \sqrt{t_1 - M}\right)\\ \mathbf{elif}\;t_4 \leq 0 \lor \neg \left(t_4 \leq \infty\right):\\ \;\;\;\;0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{d}{\frac{D \cdot \left(w \cdot \sqrt{h}\right)}{c0}}\right)}^{2}\\ \end{array} \]
Alternative 2
Accuracy62.8%
Cost32904
\[\begin{array}{l} t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ t_1 := \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)\\ \mathbf{if}\;t_1 \leq 0:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;{\left(\frac{d}{D} \cdot \frac{\frac{c0}{w}}{\sqrt{h}}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\\ \end{array} \]
Alternative 3
Accuracy62.9%
Cost32904
\[\begin{array}{l} t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ t_1 := \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)\\ \mathbf{if}\;t_1 \leq 0:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;{\left(\frac{d}{\frac{D \cdot \left(w \cdot \sqrt{h}\right)}{c0}}\right)}^{2}\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\\ \end{array} \]
Alternative 4
Accuracy61.0%
Cost20552
\[\begin{array}{l} t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ t_1 := \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)\\ \mathbf{if}\;t_1 \leq 2 \cdot 10^{-28}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;\frac{c0 \cdot d}{D \cdot D} \cdot \frac{c0 \cdot d}{w \cdot \left(w \cdot h\right)}\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\\ \end{array} \]
Alternative 5
Accuracy42.6%
Cost7561
\[\begin{array}{l} \mathbf{if}\;h \leq 5.2 \cdot 10^{-225} \lor \neg \left(h \leq 2.15 \cdot 10^{+172}\right):\\ \;\;\;\;\frac{\frac{{\left(c0 \cdot d\right)}^{2}}{D}}{\left(w \cdot h\right) \cdot \left(w \cdot D\right)}\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \frac{D}{d \cdot \frac{d}{D}}\right)\\ \end{array} \]
Alternative 6
Accuracy42.6%
Cost2648
\[\begin{array}{l} t_0 := h \cdot \left(M \cdot M\right)\\ t_1 := 0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot t_0\right)\\ t_2 := \frac{c0 \cdot d}{D \cdot D} \cdot \frac{c0 \cdot d}{w \cdot \left(w \cdot h\right)}\\ \mathbf{if}\;D \cdot D \leq 0:\\ \;\;\;\;t_1\\ \mathbf{elif}\;D \cdot D \leq 5 \cdot 10^{-284}:\\ \;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\ \mathbf{elif}\;D \cdot D \leq 5 \cdot 10^{-271}:\\ \;\;\;\;0.25 \cdot \left(t_0 \cdot \frac{D}{d \cdot \frac{d}{D}}\right)\\ \mathbf{elif}\;D \cdot D \leq 5 \cdot 10^{-116}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;D \cdot D \leq 5 \cdot 10^{-54}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;D \cdot D \leq 5 \cdot 10^{+49}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(t_0 \cdot \frac{D \cdot \frac{D}{d}}{d}\right)\\ \end{array} \]
Alternative 7
Accuracy43.3%
Cost2389
\[\begin{array}{l} t_0 := h \cdot \left(M \cdot M\right)\\ t_1 := \left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\ \mathbf{if}\;M \cdot M \leq 1.6 \cdot 10^{-232}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \cdot M \leq 1.95 \cdot 10^{-190}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;M \cdot M \leq 2.4 \cdot 10^{+137}:\\ \;\;\;\;0.25 \cdot \left(t_0 \cdot \frac{D}{d \cdot \frac{d}{D}}\right)\\ \mathbf{elif}\;M \cdot M \leq 6.2 \cdot 10^{+187} \lor \neg \left(M \cdot M \leq 7 \cdot 10^{+275}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot t_0\right)\\ \end{array} \]
Alternative 8
Accuracy43.4%
Cost2388
\[\begin{array}{l} t_0 := h \cdot \left(M \cdot M\right)\\ t_1 := \left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\ \mathbf{if}\;M \cdot M \leq 3.7 \cdot 10^{-234}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \cdot M \leq 1.4 \cdot 10^{-190}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;M \cdot M \leq 1.2 \cdot 10^{+139}:\\ \;\;\;\;0.25 \cdot \left(t_0 \cdot \frac{D}{d \cdot \frac{d}{D}}\right)\\ \mathbf{elif}\;M \cdot M \leq 1.6 \cdot 10^{+188}:\\ \;\;\;\;\frac{d}{\frac{D \cdot D}{d}} \cdot \left(\frac{c0}{h} \cdot \frac{c0}{w \cdot w}\right)\\ \mathbf{elif}\;M \cdot M \leq 3.3 \cdot 10^{+274}:\\ \;\;\;\;0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot t_0\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Accuracy40.9%
Cost1616
\[\begin{array}{l} t_0 := \left(c0 \cdot d\right) \cdot \left(c0 \cdot d\right)\\ t_1 := 0.25 \cdot \left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \frac{D}{d \cdot \frac{d}{D}}\right)\\ t_2 := D \cdot \left(w \cdot \left(w \cdot h\right)\right)\\ \mathbf{if}\;h \leq -3 \cdot 10^{+99}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right)\right)\\ \mathbf{elif}\;h \leq -5.1 \cdot 10^{+81}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;h \leq 3 \cdot 10^{-225}:\\ \;\;\;\;\frac{\frac{t_0}{D}}{t_2}\\ \mathbf{elif}\;h \leq 4.6 \cdot 10^{+172}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{D \cdot t_2}\\ \end{array} \]
Alternative 10
Accuracy40.8%
Cost1616
\[\begin{array}{l} t_0 := \left(c0 \cdot d\right) \cdot \left(c0 \cdot d\right)\\ t_1 := 0.25 \cdot \left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \frac{D}{d \cdot \frac{d}{D}}\right)\\ t_2 := D \cdot \left(w \cdot \left(w \cdot h\right)\right)\\ \mathbf{if}\;h \leq -3 \cdot 10^{+98}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \mathbf{elif}\;h \leq -8 \cdot 10^{+81}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;h \leq 6 \cdot 10^{-226}:\\ \;\;\;\;\frac{\frac{t_0}{D}}{t_2}\\ \mathbf{elif}\;h \leq 1.75 \cdot 10^{+172}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{D \cdot t_2}\\ \end{array} \]
Alternative 11
Accuracy41.4%
Cost1353
\[\begin{array}{l} \mathbf{if}\;h \leq 4.2 \cdot 10^{-225} \lor \neg \left(h \leq 1.25 \cdot 10^{+172}\right):\\ \;\;\;\;\frac{\left(c0 \cdot d\right) \cdot \left(c0 \cdot d\right)}{D \cdot \left(D \cdot \left(w \cdot \left(w \cdot h\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \frac{D}{d \cdot \frac{d}{D}}\right)\\ \end{array} \]
Alternative 12
Accuracy41.9%
Cost1352
\[\begin{array}{l} t_0 := D \cdot \left(w \cdot \left(w \cdot h\right)\right)\\ t_1 := \left(c0 \cdot d\right) \cdot \left(c0 \cdot d\right)\\ \mathbf{if}\;h \leq 1.05 \cdot 10^{-224}:\\ \;\;\;\;\frac{\frac{t_1}{D}}{t_0}\\ \mathbf{elif}\;h \leq 4.5 \cdot 10^{+172}:\\ \;\;\;\;0.25 \cdot \left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \frac{D}{d \cdot \frac{d}{D}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1}{D \cdot t_0}\\ \end{array} \]
Alternative 13
Accuracy41.4%
Cost960
\[0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)\right) \]
Alternative 14
Accuracy32.4%
Cost64
\[0 \]

Reproduce?

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