| Alternative 1 | |
|---|---|
| Accuracy | 63.7% |
| Cost | 1489 |
(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)) (* (* w h) (* D D))))
(t_1 (/ c0 (* 2.0 w)))
(t_2 (* t_1 (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
(if (or (<= t_2 0.0) (not (<= t_2 INFINITY)))
(* 0.25 (* h (pow (* M (/ D d)) 2.0)))
(* t_1 (* (* (/ d (* (* w h) D)) (/ d D)) (+ c0 c0))))))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)) / ((w * h) * (D * D));
double t_1 = c0 / (2.0 * w);
double t_2 = t_1 * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if ((t_2 <= 0.0) || !(t_2 <= ((double) INFINITY))) {
tmp = 0.25 * (h * pow((M * (D / d)), 2.0));
} else {
tmp = t_1 * (((d / ((w * h) * D)) * (d / D)) * (c0 + c0));
}
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)) / ((w * h) * (D * D));
double t_1 = c0 / (2.0 * w);
double t_2 = t_1 * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if ((t_2 <= 0.0) || !(t_2 <= Double.POSITIVE_INFINITY)) {
tmp = 0.25 * (h * Math.pow((M * (D / d)), 2.0));
} else {
tmp = t_1 * (((d / ((w * h) * D)) * (d / D)) * (c0 + c0));
}
return tmp;
}
def code(c0, w, h, D, d, 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))))
def code(c0, w, h, D, d, M): t_0 = (c0 * (d * d)) / ((w * h) * (D * D)) t_1 = c0 / (2.0 * w) t_2 = t_1 * (t_0 + math.sqrt(((t_0 * t_0) - (M * M)))) tmp = 0 if (t_2 <= 0.0) or not (t_2 <= math.inf): tmp = 0.25 * (h * math.pow((M * (D / d)), 2.0)) else: tmp = t_1 * (((d / ((w * h) * D)) * (d / D)) * (c0 + c0)) 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(w * h) * Float64(D * D))) t_1 = Float64(c0 / Float64(2.0 * w)) t_2 = Float64(t_1 * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) tmp = 0.0 if ((t_2 <= 0.0) || !(t_2 <= Inf)) tmp = Float64(0.25 * Float64(h * (Float64(M * Float64(D / d)) ^ 2.0))); else tmp = Float64(t_1 * Float64(Float64(Float64(d / Float64(Float64(w * h) * D)) * Float64(d / D)) * Float64(c0 + c0))); end return tmp end
function tmp = code(c0, w, h, D, d, M) tmp = (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)))); end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = (c0 * (d * d)) / ((w * h) * (D * D)); t_1 = c0 / (2.0 * w); t_2 = t_1 * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); tmp = 0.0; if ((t_2 <= 0.0) || ~((t_2 <= Inf))) tmp = 0.25 * (h * ((M * (D / d)) ^ 2.0)); else tmp = t_1 * (((d / ((w * h) * D)) * (d / D)) * (c0 + c0)); end tmp_2 = 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[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$2, 0.0], N[Not[LessEqual[t$95$2, Infinity]], $MachinePrecision]], N[(0.25 * N[(h * N[Power[N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(N[(d / N[(N[(w * h), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(c0 + c0), $MachinePrecision]), $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(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_1 := \frac{c0}{2 \cdot w}\\
t_2 := t_1 \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)\\
\mathbf{if}\;t_2 \leq 0 \lor \neg \left(t_2 \leq \infty\right):\\
\;\;\;\;0.25 \cdot \left(h \cdot {\left(M \cdot \frac{D}{d}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(\left(\frac{d}{\left(w \cdot h\right) \cdot D} \cdot \frac{d}{D}\right) \cdot \left(c0 + c0\right)\right)\\
\end{array}
Results
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))))) < -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))))) Initial program 5.6%
Simplified2.5%
[Start]5.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)
\] |
|---|---|
associate-*l/ [<=]4.8 | \[ \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 [=>]4.8 | \[ \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 [=>]3.9 | \[ \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)}
\] |
associate-*l* [=>]3.4 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{c0}{\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)
\] |
associate-/r* [=>]3.4 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \color{blue}{\frac{\frac{c0}{w}}{h \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-*r* [=>]3.4 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{\frac{c0}{w}}{\color{blue}{\left(h \cdot D\right) \cdot D}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
*-commutative [=>]3.4 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(d \cdot d, \frac{\frac{c0}{w}}{\color{blue}{D \cdot \left(h \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)
\] |
Taylor expanded in c0 around -inf 5.9%
Simplified46.2%
[Start]5.9 | \[ \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 [=>]5.9 | \[ \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)}
\] |
Taylor expanded in c0 around 0 45.4%
Simplified48.8%
[Start]45.4 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}
\] |
|---|---|
unpow2 [=>]45.4 | \[ 0.25 \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}
\] |
unpow2 [=>]45.4 | \[ 0.25 \cdot \frac{\left(D \cdot D\right) \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)}{{d}^{2}}
\] |
associate-*r* [<=]48.8 | \[ 0.25 \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot \left(M \cdot h\right)\right)}}{{d}^{2}}
\] |
*-commutative [<=]48.8 | \[ 0.25 \cdot \frac{\color{blue}{\left(M \cdot \left(M \cdot h\right)\right) \cdot \left(D \cdot D\right)}}{{d}^{2}}
\] |
unpow2 [=>]48.8 | \[ 0.25 \cdot \frac{\left(M \cdot \left(M \cdot h\right)\right) \cdot \left(D \cdot D\right)}{\color{blue}{d \cdot d}}
\] |
Applied egg-rr62.0%
[Start]48.8 | \[ 0.25 \cdot \frac{\left(M \cdot \left(M \cdot h\right)\right) \cdot \left(D \cdot D\right)}{d \cdot d}
\] |
|---|---|
associate-/l* [=>]48.5 | \[ 0.25 \cdot \color{blue}{\frac{M \cdot \left(M \cdot h\right)}{\frac{d \cdot d}{D \cdot D}}}
\] |
frac-2neg [=>]48.5 | \[ 0.25 \cdot \color{blue}{\frac{-M \cdot \left(M \cdot h\right)}{-\frac{d \cdot d}{D \cdot D}}}
\] |
distribute-frac-neg [=>]48.5 | \[ 0.25 \cdot \color{blue}{\left(-\frac{M \cdot \left(M \cdot h\right)}{-\frac{d \cdot d}{D \cdot D}}\right)}
\] |
times-frac [=>]62.0 | \[ 0.25 \cdot \left(-\frac{M \cdot \left(M \cdot h\right)}{-\color{blue}{\frac{d}{D} \cdot \frac{d}{D}}}\right)
\] |
distribute-rgt-neg-in [=>]62.0 | \[ 0.25 \cdot \left(-\frac{M \cdot \left(M \cdot h\right)}{\color{blue}{\frac{d}{D} \cdot \left(-\frac{d}{D}\right)}}\right)
\] |
Simplified70.5%
[Start]62.0 | \[ 0.25 \cdot \left(-\frac{M \cdot \left(M \cdot h\right)}{\frac{d}{D} \cdot \left(-\frac{d}{D}\right)}\right)
\] |
|---|---|
times-frac [=>]73.2 | \[ 0.25 \cdot \left(-\color{blue}{\frac{M}{\frac{d}{D}} \cdot \frac{M \cdot h}{-\frac{d}{D}}}\right)
\] |
distribute-lft-neg-in [=>]73.2 | \[ 0.25 \cdot \color{blue}{\left(\left(-\frac{M}{\frac{d}{D}}\right) \cdot \frac{M \cdot h}{-\frac{d}{D}}\right)}
\] |
associate-/r/ [=>]70.9 | \[ 0.25 \cdot \left(\left(-\color{blue}{\frac{M}{d} \cdot D}\right) \cdot \frac{M \cdot h}{-\frac{d}{D}}\right)
\] |
distribute-neg-frac [=>]70.9 | \[ 0.25 \cdot \left(\left(-\frac{M}{d} \cdot D\right) \cdot \frac{M \cdot h}{\color{blue}{\frac{-d}{D}}}\right)
\] |
associate-/r/ [=>]70.1 | \[ 0.25 \cdot \left(\left(-\frac{M}{d} \cdot D\right) \cdot \color{blue}{\left(\frac{M \cdot h}{-d} \cdot D\right)}\right)
\] |
associate-/l* [=>]70.5 | \[ 0.25 \cdot \left(\left(-\frac{M}{d} \cdot D\right) \cdot \left(\color{blue}{\frac{M}{\frac{-d}{h}}} \cdot D\right)\right)
\] |
Taylor expanded in M around 0 45.4%
Simplified72.6%
[Start]45.4 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}
\] |
|---|---|
*-commutative [<=]45.4 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}}{{d}^{2}}
\] |
associate-*r* [=>]46.2 | \[ 0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2}}
\] |
*-commutative [=>]46.2 | \[ 0.25 \cdot \frac{\color{blue}{\left({M}^{2} \cdot {D}^{2}\right)} \cdot h}{{d}^{2}}
\] |
unpow2 [=>]46.2 | \[ 0.25 \cdot \frac{\left(\color{blue}{\left(M \cdot M\right)} \cdot {D}^{2}\right) \cdot h}{{d}^{2}}
\] |
unpow2 [=>]46.2 | \[ 0.25 \cdot \frac{\left(\left(M \cdot M\right) \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot h}{{d}^{2}}
\] |
swap-sqr [<=]58.7 | \[ 0.25 \cdot \frac{\color{blue}{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right)} \cdot h}{{d}^{2}}
\] |
unpow2 [=>]58.7 | \[ 0.25 \cdot \frac{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot h}{\color{blue}{d \cdot d}}
\] |
associate-/l* [=>]58.0 | \[ 0.25 \cdot \color{blue}{\frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\frac{d \cdot d}{h}}}
\] |
associate-*r/ [<=]62.9 | \[ 0.25 \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{\color{blue}{d \cdot \frac{d}{h}}}
\] |
times-frac [=>]74.1 | \[ 0.25 \cdot \color{blue}{\left(\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{\frac{d}{h}}\right)}
\] |
associate-/l* [=>]71.7 | \[ 0.25 \cdot \left(\color{blue}{\frac{M}{\frac{d}{D}}} \cdot \frac{M \cdot D}{\frac{d}{h}}\right)
\] |
associate-/r/ [=>]75.0 | \[ 0.25 \cdot \left(\frac{M}{\frac{d}{D}} \cdot \color{blue}{\left(\frac{M \cdot D}{d} \cdot h\right)}\right)
\] |
associate-/l* [=>]77.5 | \[ 0.25 \cdot \left(\frac{M}{\frac{d}{D}} \cdot \left(\color{blue}{\frac{M}{\frac{d}{D}}} \cdot h\right)\right)
\] |
associate-*r* [=>]72.4 | \[ 0.25 \cdot \color{blue}{\left(\left(\frac{M}{\frac{d}{D}} \cdot \frac{M}{\frac{d}{D}}\right) \cdot h\right)}
\] |
unpow2 [<=]72.4 | \[ 0.25 \cdot \left(\color{blue}{{\left(\frac{M}{\frac{d}{D}}\right)}^{2}} \cdot h\right)
\] |
*-commutative [=>]72.4 | \[ 0.25 \cdot \color{blue}{\left(h \cdot {\left(\frac{M}{\frac{d}{D}}\right)}^{2}\right)}
\] |
associate-/l* [<=]72.5 | \[ 0.25 \cdot \left(h \cdot {\color{blue}{\left(\frac{M \cdot D}{d}\right)}}^{2}\right)
\] |
*-commutative [<=]72.5 | \[ 0.25 \cdot \left(h \cdot {\left(\frac{\color{blue}{D \cdot M}}{d}\right)}^{2}\right)
\] |
associate-*l/ [<=]72.6 | \[ 0.25 \cdot \left(h \cdot {\color{blue}{\left(\frac{D}{d} \cdot M\right)}}^{2}\right)
\] |
*-commutative [=>]72.6 | \[ 0.25 \cdot \left(h \cdot {\color{blue}{\left(M \cdot \frac{D}{d}\right)}}^{2}\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.0Initial program 25.8%
Taylor expanded in c0 around -inf 11.0%
Simplified4.2%
[Start]11.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)} + -1 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)
\] |
|---|---|
mul-1-neg [=>]11.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)} + \color{blue}{\left(-\frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}\right)
\] |
associate-/r* [=>]5.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)} + \left(-\color{blue}{\frac{\frac{{d}^{2} \cdot c0}{{D}^{2}}}{w \cdot h}}\right)\right)
\] |
*-commutative [=>]5.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)} + \left(-\frac{\frac{\color{blue}{c0 \cdot {d}^{2}}}{{D}^{2}}}{w \cdot h}\right)\right)
\] |
unpow2 [=>]5.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)} + \left(-\frac{\frac{c0 \cdot \color{blue}{\left(d \cdot d\right)}}{{D}^{2}}}{w \cdot h}\right)\right)
\] |
unpow2 [=>]5.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)} + \left(-\frac{\frac{c0 \cdot \left(d \cdot d\right)}{\color{blue}{D \cdot D}}}{w \cdot h}\right)\right)
\] |
associate-/l* [=>]4.8 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \left(-\frac{\color{blue}{\frac{c0}{\frac{D \cdot D}{d \cdot d}}}}{w \cdot h}\right)\right)
\] |
times-frac [=>]4.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)} + \left(-\frac{\frac{c0}{\color{blue}{\frac{D}{d} \cdot \frac{D}{d}}}}{w \cdot h}\right)\right)
\] |
Applied egg-rr28.7%
[Start]4.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)} + \left(-\frac{\frac{c0}{\frac{D}{d} \cdot \frac{D}{d}}}{w \cdot h}\right)\right)
\] |
|---|---|
expm1-log1p-u [=>]4.1 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \left(-\frac{\frac{c0}{\frac{D}{d} \cdot \frac{D}{d}}}{w \cdot h}\right)\right)\right)}
\] |
expm1-udef [=>]3.7 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \left(-\frac{\frac{c0}{\frac{D}{d} \cdot \frac{D}{d}}}{w \cdot h}\right)\right)} - 1\right)}
\] |
Simplified35.2%
[Start]28.7 | \[ \frac{c0}{2 \cdot w} \cdot \left(e^{\mathsf{log1p}\left(\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{D}{d}\right)}^{-2}, {\left(\frac{D}{d}\right)}^{-2} \cdot \frac{c0}{w \cdot h}\right)\right)} - 1\right)
\] |
|---|---|
expm1-def [=>]36.7 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{D}{d}\right)}^{-2}, {\left(\frac{D}{d}\right)}^{-2} \cdot \frac{c0}{w \cdot h}\right)\right)\right)}
\] |
expm1-log1p [=>]39.0 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, {\left(\frac{D}{d}\right)}^{-2}, {\left(\frac{D}{d}\right)}^{-2} \cdot \frac{c0}{w \cdot h}\right)}
\] |
fma-udef [=>]39.0 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{D}{d}\right)}^{-2} + {\left(\frac{D}{d}\right)}^{-2} \cdot \frac{c0}{w \cdot h}\right)}
\] |
associate-*l/ [=>]33.7 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0 \cdot {\left(\frac{D}{d}\right)}^{-2}}{w \cdot h}} + {\left(\frac{D}{d}\right)}^{-2} \cdot \frac{c0}{w \cdot h}\right)
\] |
associate-*r/ [<=]34.5 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{c0 \cdot \frac{{\left(\frac{D}{d}\right)}^{-2}}{w \cdot h}} + {\left(\frac{D}{d}\right)}^{-2} \cdot \frac{c0}{w \cdot h}\right)
\] |
associate-*r/ [=>]29.9 | \[ \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \frac{{\left(\frac{D}{d}\right)}^{-2}}{w \cdot h} + \color{blue}{\frac{{\left(\frac{D}{d}\right)}^{-2} \cdot c0}{w \cdot h}}\right)
\] |
*-commutative [<=]29.9 | \[ \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \frac{{\left(\frac{D}{d}\right)}^{-2}}{w \cdot h} + \frac{\color{blue}{c0 \cdot {\left(\frac{D}{d}\right)}^{-2}}}{w \cdot h}\right)
\] |
associate-*r/ [<=]35.2 | \[ \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \frac{{\left(\frac{D}{d}\right)}^{-2}}{w \cdot h} + \color{blue}{c0 \cdot \frac{{\left(\frac{D}{d}\right)}^{-2}}{w \cdot h}}\right)
\] |
distribute-rgt-out [=>]35.2 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{{\left(\frac{D}{d}\right)}^{-2}}{w \cdot h} \cdot \left(c0 + c0\right)\right)}
\] |
Applied egg-rr43.2%
[Start]35.2 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{{\left(\frac{D}{d}\right)}^{-2}}{w \cdot h} \cdot \left(c0 + c0\right)\right)
\] |
|---|---|
add-sqr-sqrt [=>]35.1 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\color{blue}{\sqrt{{\left(\frac{D}{d}\right)}^{-2}} \cdot \sqrt{{\left(\frac{D}{d}\right)}^{-2}}}}{w \cdot h} \cdot \left(c0 + c0\right)\right)
\] |
associate-/l* [=>]35.2 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{\sqrt{{\left(\frac{D}{d}\right)}^{-2}}}{\frac{w \cdot h}{\sqrt{{\left(\frac{D}{d}\right)}^{-2}}}}} \cdot \left(c0 + c0\right)\right)
\] |
associate-/r/ [=>]35.1 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(\frac{\sqrt{{\left(\frac{D}{d}\right)}^{-2}}}{w \cdot h} \cdot \sqrt{{\left(\frac{D}{d}\right)}^{-2}}\right)} \cdot \left(c0 + c0\right)\right)
\] |
sqrt-pow1 [=>]15.7 | \[ \frac{c0}{2 \cdot w} \cdot \left(\left(\frac{\color{blue}{{\left(\frac{D}{d}\right)}^{\left(\frac{-2}{2}\right)}}}{w \cdot h} \cdot \sqrt{{\left(\frac{D}{d}\right)}^{-2}}\right) \cdot \left(c0 + c0\right)\right)
\] |
metadata-eval [=>]15.7 | \[ \frac{c0}{2 \cdot w} \cdot \left(\left(\frac{{\left(\frac{D}{d}\right)}^{\color{blue}{-1}}}{w \cdot h} \cdot \sqrt{{\left(\frac{D}{d}\right)}^{-2}}\right) \cdot \left(c0 + c0\right)\right)
\] |
unpow-1 [=>]15.7 | \[ \frac{c0}{2 \cdot w} \cdot \left(\left(\frac{\color{blue}{\frac{1}{\frac{D}{d}}}}{w \cdot h} \cdot \sqrt{{\left(\frac{D}{d}\right)}^{-2}}\right) \cdot \left(c0 + c0\right)\right)
\] |
clear-num [<=]15.8 | \[ \frac{c0}{2 \cdot w} \cdot \left(\left(\frac{\color{blue}{\frac{d}{D}}}{w \cdot h} \cdot \sqrt{{\left(\frac{D}{d}\right)}^{-2}}\right) \cdot \left(c0 + c0\right)\right)
\] |
associate-/l/ [=>]15.8 | \[ \frac{c0}{2 \cdot w} \cdot \left(\left(\color{blue}{\frac{d}{\left(w \cdot h\right) \cdot D}} \cdot \sqrt{{\left(\frac{D}{d}\right)}^{-2}}\right) \cdot \left(c0 + c0\right)\right)
\] |
sqrt-pow1 [=>]43.1 | \[ \frac{c0}{2 \cdot w} \cdot \left(\left(\frac{d}{\left(w \cdot h\right) \cdot D} \cdot \color{blue}{{\left(\frac{D}{d}\right)}^{\left(\frac{-2}{2}\right)}}\right) \cdot \left(c0 + c0\right)\right)
\] |
metadata-eval [=>]43.1 | \[ \frac{c0}{2 \cdot w} \cdot \left(\left(\frac{d}{\left(w \cdot h\right) \cdot D} \cdot {\left(\frac{D}{d}\right)}^{\color{blue}{-1}}\right) \cdot \left(c0 + c0\right)\right)
\] |
unpow-1 [=>]43.1 | \[ \frac{c0}{2 \cdot w} \cdot \left(\left(\frac{d}{\left(w \cdot h\right) \cdot D} \cdot \color{blue}{\frac{1}{\frac{D}{d}}}\right) \cdot \left(c0 + c0\right)\right)
\] |
clear-num [<=]43.2 | \[ \frac{c0}{2 \cdot w} \cdot \left(\left(\frac{d}{\left(w \cdot h\right) \cdot D} \cdot \color{blue}{\frac{d}{D}}\right) \cdot \left(c0 + c0\right)\right)
\] |
Final simplification70.6%
| Alternative 1 | |
|---|---|
| Accuracy | 63.7% |
| Cost | 1489 |
| Alternative 2 | |
|---|---|
| Accuracy | 58.9% |
| Cost | 1480 |
| Alternative 3 | |
|---|---|
| Accuracy | 61.6% |
| Cost | 1357 |
| Alternative 4 | |
|---|---|
| Accuracy | 68.8% |
| Cost | 1225 |
| Alternative 5 | |
|---|---|
| Accuracy | 68.2% |
| Cost | 1225 |
| Alternative 6 | |
|---|---|
| Accuracy | 62.8% |
| Cost | 1092 |
| Alternative 7 | |
|---|---|
| Accuracy | 59.1% |
| Cost | 960 |
| Alternative 8 | |
|---|---|
| Accuracy | 62.7% |
| Cost | 960 |
| Alternative 9 | |
|---|---|
| Accuracy | 49.5% |
| Cost | 64 |
herbie shell --seed 2023133
(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))))))