?

Average Error: 59.3 → 19.5
Time: 32.8s
Precision: binary64
Cost: 55500

?

\[\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 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\ t_1 := \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)\\ t_2 := c0 \cdot \frac{d}{D}\\ \mathbf{if}\;t_1 \leq -4 \cdot 10^{-66}:\\ \;\;\;\;t_2 \cdot \left(t_2 \cdot \frac{\frac{1}{w \cdot h}}{w}\right)\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;0.25 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\frac{d \cdot d}{h}}\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;{\left(\sqrt[3]{{\left(\frac{d}{D} \cdot \frac{c0}{w \cdot \sqrt{h}}\right)}^{2}}\right)}^{3}\\ \mathbf{else}:\\ \;\;\;\;D \cdot \frac{\left(D \cdot -0.25\right) \cdot \left(M \cdot \left(h \cdot \frac{M}{d}\right)\right)}{-d}\\ \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 (* d d)) (* (* D D) (* w h))))
        (t_1 (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M))))))
        (t_2 (* c0 (/ d D))))
   (if (<= t_1 -4e-66)
     (* t_2 (* t_2 (/ (/ 1.0 (* w h)) w)))
     (if (<= t_1 0.0)
       (* 0.25 (/ (* (* D M) (* D M)) (/ (* d d) h)))
       (if (<= t_1 INFINITY)
         (pow (cbrt (pow (* (/ d D) (/ c0 (* w (sqrt h)))) 2.0)) 3.0)
         (* D (/ (* (* D -0.25) (* M (* h (/ M d)))) (- d))))))))
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 * (d * d)) / ((D * D) * (w * h));
	double t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
	double t_2 = c0 * (d / D);
	double tmp;
	if (t_1 <= -4e-66) {
		tmp = t_2 * (t_2 * ((1.0 / (w * h)) / w));
	} else if (t_1 <= 0.0) {
		tmp = 0.25 * (((D * M) * (D * M)) / ((d * d) / h));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = pow(cbrt(pow(((d / D) * (c0 / (w * sqrt(h)))), 2.0)), 3.0);
	} else {
		tmp = D * (((D * -0.25) * (M * (h * (M / d)))) / -d);
	}
	return tmp;
}
public static 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))) + Math.sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))));
}
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * (d * d)) / ((D * D) * (w * h));
	double t_1 = (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
	double t_2 = c0 * (d / D);
	double tmp;
	if (t_1 <= -4e-66) {
		tmp = t_2 * (t_2 * ((1.0 / (w * h)) / w));
	} else if (t_1 <= 0.0) {
		tmp = 0.25 * (((D * M) * (D * M)) / ((d * d) / h));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = Math.pow(Math.cbrt(Math.pow(((d / D) * (c0 / (w * Math.sqrt(h)))), 2.0)), 3.0);
	} else {
		tmp = D * (((D * -0.25) * (M * (h * (M / d)))) / -d);
	}
	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(Float64(c0 * Float64(d * d)) / Float64(Float64(D * D) * Float64(w * h)))
	t_1 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M)))))
	t_2 = Float64(c0 * Float64(d / D))
	tmp = 0.0
	if (t_1 <= -4e-66)
		tmp = Float64(t_2 * Float64(t_2 * Float64(Float64(1.0 / Float64(w * h)) / w)));
	elseif (t_1 <= 0.0)
		tmp = Float64(0.25 * Float64(Float64(Float64(D * M) * Float64(D * M)) / Float64(Float64(d * d) / h)));
	elseif (t_1 <= Inf)
		tmp = cbrt((Float64(Float64(d / D) * Float64(c0 / Float64(w * sqrt(h)))) ^ 2.0)) ^ 3.0;
	else
		tmp = Float64(D * Float64(Float64(Float64(D * -0.25) * Float64(M * Float64(h * Float64(M / d)))) / Float64(-d)));
	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[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 * N[(d / D), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-66], N[(t$95$2 * N[(t$95$2 * N[(N[(1.0 / N[(w * h), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(0.25 * N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[Power[N[Power[N[Power[N[(N[(d / D), $MachinePrecision] * N[(c0 / N[(w * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], N[(D * N[(N[(N[(D * -0.25), $MachinePrecision] * N[(M * N[(h * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-d)), $MachinePrecision]), $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 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)\\
t_2 := c0 \cdot \frac{d}{D}\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{-66}:\\
\;\;\;\;t_2 \cdot \left(t_2 \cdot \frac{\frac{1}{w \cdot h}}{w}\right)\\

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

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;{\left(\sqrt[3]{{\left(\frac{d}{D} \cdot \frac{c0}{w \cdot \sqrt{h}}\right)}^{2}}\right)}^{3}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 4 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))))) < -3.9999999999999999e-66

    1. Initial program 53.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. Simplified54.5

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

      [Start]53.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 [=>]55.3

      \[ \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-neg [=>]55.3

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

      times-frac [=>]55.4

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

      times-frac [=>]54.5

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

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

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

      [Start]55.4

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

      times-frac [=>]57.2

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

      unpow2 [=>]57.2

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

      unpow2 [=>]57.2

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

      associate-/r* [=>]55.3

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

      associate-*r/ [<=]54.6

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

      associate-*l/ [<=]53.9

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

      unpow2 [<=]53.9

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

      unpow2 [=>]53.9

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

      *-commutative [=>]53.9

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

      unpow2 [=>]53.9

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

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

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

      [Start]42.9

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

      *-commutative [=>]42.9

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

      associate-*r* [=>]39.9

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

      *-commutative [=>]39.9

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

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

    if -3.9999999999999999e-66 < (*.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

    1. Initial program 23.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) \]
    2. Simplified50.4

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

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

      associate-*l/ [<=]29.0

      \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\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) \]

      *-commutative [=>]29.0

      \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(d \cdot d\right) \cdot \frac{c0}{\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) \]

      fma-def [=>]37.6

      \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(d \cdot d, \frac{c0}{\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)} \]
    3. Taylor expanded in c0 around -inf 31.3

      \[\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)} \]
    4. Simplified24.6

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

      [Start]31.3

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

      \[ \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)} \]
    5. Applied egg-rr44.5

      \[\leadsto \color{blue}{\frac{1}{\frac{w \cdot 2}{c0 \cdot \left(\frac{0.5}{c0} \cdot {\left(\frac{\sqrt{w \cdot h} \cdot M}{\frac{d}{D}}\right)}^{2}\right)}}} \]
    6. Simplified43.3

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

      [Start]44.5

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

      associate-/r/ [=>]44.5

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

      *-commutative [=>]44.5

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

      associate-*r* [=>]43.3

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

      associate-/r/ [=>]43.3

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

      *-commutative [=>]43.3

      \[ \frac{1}{2 \cdot w} \cdot \left(\left(c0 \cdot \frac{0.5}{c0}\right) \cdot {\left(\frac{\color{blue}{M \cdot \sqrt{w \cdot h}}}{d} \cdot D\right)}^{2}\right) \]
    7. Taylor expanded in w around 0 26.2

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

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

      [Start]26.2

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

      *-commutative [=>]26.2

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

      associate-*r* [=>]25.9

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

      associate-/l* [=>]26.8

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

      unpow2 [=>]26.8

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

      unpow2 [=>]26.8

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

      unswap-sqr [=>]21.2

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

      unpow2 [=>]21.2

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

    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 48.2

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

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

      [Start]48.2

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

      times-frac [=>]49.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-neg [=>]49.9

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

      times-frac [=>]50.0

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

      times-frac [=>]49.1

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

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

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

      [Start]53.6

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

      times-frac [=>]54.6

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

      unpow2 [=>]54.6

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

      unpow2 [=>]54.6

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

      associate-/r* [=>]53.5

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

      associate-*r/ [<=]53.1

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

      associate-*l/ [<=]52.4

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

      unpow2 [<=]52.4

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

      unpow2 [=>]52.4

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

      *-commutative [=>]52.4

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

      unpow2 [=>]52.4

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

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

    if +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 64.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. Simplified63.9

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

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

      associate-*l/ [<=]64.0

      \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\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) \]

      *-commutative [=>]64.0

      \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(d \cdot d\right) \cdot \frac{c0}{\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) \]

      fma-def [=>]64.0

      \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(d \cdot d, \frac{c0}{\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)} \]
    3. Taylor expanded in c0 around -inf 63.1

      \[\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)} \]
    4. Simplified34.8

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

      [Start]63.1

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

      \[ \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)} \]
    5. Taylor expanded in c0 around 0 34.1

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

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

      [Start]34.1

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

      associate-/l* [=>]34.0

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

      unpow2 [=>]34.0

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

      associate-*r/ [=>]34.0

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

      unpow2 [=>]34.0

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

      unpow2 [=>]34.0

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

      associate-/l* [=>]31.1

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

      associate-*r* [=>]28.6

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

      *-commutative [=>]28.6

      \[ \frac{0.25 \cdot \left(D \cdot D\right)}{\frac{d}{\frac{\color{blue}{M \cdot \left(h \cdot M\right)}}{d}}} \]
    7. Applied egg-rr25.4

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

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

      [Start]25.4

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

      associate-*l* [=>]20.8

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

      associate-/r* [=>]20.9

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

      associate-*r/ [=>]19.0

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

      associate-/l* [<=]19.0

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

      *-lft-identity [=>]19.0

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

      associate-/r/ [=>]19.0

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

      *-commutative [=>]19.0

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

      associate-*l* [=>]18.5

      \[ D \cdot \frac{\left(D \cdot -0.25\right) \cdot \color{blue}{\left(M \cdot \left(h \cdot \frac{M}{d}\right)\right)}}{-d} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification19.5

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

Alternatives

Alternative 1
Error20.8
Cost38220
\[\begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}\\ t_2 := t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right)\\ t_3 := c0 \cdot \frac{d}{D}\\ \mathbf{if}\;t_2 \leq -4 \cdot 10^{-66}:\\ \;\;\;\;t_3 \cdot \left(t_3 \cdot \frac{\frac{1}{w \cdot h}}{w}\right)\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;0.25 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\frac{d \cdot d}{h}}\\ \mathbf{elif}\;t_2 \leq \infty:\\ \;\;\;\;t_0 \cdot \mathsf{fma}\left(2, \frac{1}{D \cdot \frac{D}{d}} \cdot \frac{\frac{c0}{w}}{\frac{h}{d}}, -0.5 \cdot \left(\frac{D \cdot D}{d \cdot d} \cdot \frac{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}{c0}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;D \cdot \frac{\left(D \cdot -0.25\right) \cdot \left(M \cdot \left(h \cdot \frac{M}{d}\right)\right)}{-d}\\ \end{array} \]
Alternative 2
Error21.9
Cost1544
\[\begin{array}{l} \mathbf{if}\;d \cdot d \leq 2 \cdot 10^{-203}:\\ \;\;\;\;\frac{D}{d} \cdot \frac{D \cdot 0.25}{\frac{\frac{d}{h \cdot M}}{M}}\\ \mathbf{elif}\;d \cdot d \leq 5 \cdot 10^{+90}:\\ \;\;\;\;0.25 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\frac{d \cdot d}{h}}\\ \mathbf{else}:\\ \;\;\;\;D \cdot \frac{\left(D \cdot -0.25\right) \cdot \left(M \cdot \left(h \cdot \frac{M}{d}\right)\right)}{-d}\\ \end{array} \]
Alternative 3
Error24.8
Cost1490
\[\begin{array}{l} \mathbf{if}\;d \leq -4.3 \cdot 10^{+30} \lor \neg \left(d \leq -4.4 \cdot 10^{-45} \lor \neg \left(d \leq 1.45 \cdot 10^{-201}\right) \land d \leq 2 \cdot 10^{-7}\right):\\ \;\;\;\;\left(D \cdot 0.25\right) \cdot \left(D \cdot \frac{\frac{M}{\frac{d}{h \cdot M}}}{d}\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\frac{d \cdot d}{h}}\\ \end{array} \]
Alternative 4
Error23.9
Cost1489
\[\begin{array}{l} \mathbf{if}\;D \leq -1.1 \cdot 10^{+94}:\\ \;\;\;\;\frac{0.25}{d} \cdot \frac{D \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot D\right)\right)}{d}\\ \mathbf{elif}\;D \leq -2 \cdot 10^{-154}:\\ \;\;\;\;\frac{\left(D \cdot D\right) \cdot 0.25}{\frac{d}{M \cdot \left(h \cdot \frac{M}{d}\right)}}\\ \mathbf{elif}\;D \leq 10^{-302} \lor \neg \left(D \leq 4.9 \cdot 10^{-151}\right):\\ \;\;\;\;\frac{D}{d} \cdot \frac{D \cdot 0.25}{\frac{\frac{d}{h \cdot M}}{M}}\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\frac{d \cdot d}{h}}\\ \end{array} \]
Alternative 5
Error23.1
Cost1488
\[\begin{array}{l} t_0 := \frac{d}{h \cdot M}\\ t_1 := 0.25 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\frac{d \cdot d}{h}}\\ t_2 := \frac{D}{d} \cdot \frac{D \cdot 0.25}{\frac{t_0}{M}}\\ \mathbf{if}\;d \leq -1 \cdot 10^{+32}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;d \leq -1.45 \cdot 10^{-87}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq 4.9 \cdot 10^{-157}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;d \leq 2 \cdot 10^{-10}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\left(D \cdot 0.25\right) \cdot \left(D \cdot \frac{\frac{M}{t_0}}{d}\right)\\ \end{array} \]
Alternative 6
Error25.0
Cost1357
\[\begin{array}{l} \mathbf{if}\;D \leq -2.2 \cdot 10^{+94}:\\ \;\;\;\;\frac{0.25}{d} \cdot \frac{D \cdot \left(\left(M \cdot M\right) \cdot \left(h \cdot D\right)\right)}{d}\\ \mathbf{elif}\;D \leq 2 \cdot 10^{-302} \lor \neg \left(D \leq 5.6 \cdot 10^{-151}\right):\\ \;\;\;\;\left(D \cdot 0.25\right) \cdot \left(D \cdot \frac{\frac{M}{\frac{d}{h \cdot M}}}{d}\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\frac{d \cdot d}{h}}\\ \end{array} \]
Alternative 7
Error27.2
Cost1225
\[\begin{array}{l} \mathbf{if}\;d \leq -2.3 \cdot 10^{-56} \lor \neg \left(d \leq 3.4 \cdot 10^{-157}\right):\\ \;\;\;\;0.25 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\frac{d \cdot d}{h}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 8
Error26.4
Cost1224
\[\begin{array}{l} \mathbf{if}\;d \leq -1.28 \cdot 10^{-127}:\\ \;\;\;\;D \cdot \left(0.25 \cdot \left(\frac{D}{\frac{d \cdot d}{M}} \cdot \left(h \cdot M\right)\right)\right)\\ \mathbf{elif}\;d \leq 2.05 \cdot 10^{-157}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\frac{d \cdot d}{h}}\\ \end{array} \]
Alternative 9
Error31.6
Cost64
\[0 \]

Error

Reproduce?

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