| Alternative 1 | |
|---|---|
| Error | 32.39% |
| Cost | 2384 |
(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 (/ (/ d D) M))
(t_1
(/ (* (/ (/ (* c0 d) w) D) (/ 2.0 h)) (* (/ D d) (* 2.0 (/ w c0)))))
(t_2 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_3 (* (/ c0 (* 2.0 w)) (+ t_2 (sqrt (- (* t_2 t_2) (* M M)))))))
(if (<= t_3 -4e-152)
t_1
(if (<= t_3 0.0)
(* 0.25 (/ (* M (/ (* h D) d)) t_0))
(if (<= t_3 INFINITY) t_1 (* 0.25 (/ (* (/ D d) (* h M)) t_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 = (d / D) / M;
double t_1 = ((((c0 * d) / w) / D) * (2.0 / h)) / ((D / d) * (2.0 * (w / c0)));
double t_2 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_3 = (c0 / (2.0 * w)) * (t_2 + sqrt(((t_2 * t_2) - (M * M))));
double tmp;
if (t_3 <= -4e-152) {
tmp = t_1;
} else if (t_3 <= 0.0) {
tmp = 0.25 * ((M * ((h * D) / d)) / t_0);
} else if (t_3 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = 0.25 * (((D / d) * (h * M)) / t_0);
}
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 = (d / D) / M;
double t_1 = ((((c0 * d) / w) / D) * (2.0 / h)) / ((D / d) * (2.0 * (w / c0)));
double t_2 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_3 = (c0 / (2.0 * w)) * (t_2 + Math.sqrt(((t_2 * t_2) - (M * M))));
double tmp;
if (t_3 <= -4e-152) {
tmp = t_1;
} else if (t_3 <= 0.0) {
tmp = 0.25 * ((M * ((h * D) / d)) / t_0);
} else if (t_3 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = 0.25 * (((D / d) * (h * M)) / t_0);
}
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 = (d / D) / M t_1 = ((((c0 * d) / w) / D) * (2.0 / h)) / ((D / d) * (2.0 * (w / c0))) t_2 = (c0 * (d * d)) / ((w * h) * (D * D)) t_3 = (c0 / (2.0 * w)) * (t_2 + math.sqrt(((t_2 * t_2) - (M * M)))) tmp = 0 if t_3 <= -4e-152: tmp = t_1 elif t_3 <= 0.0: tmp = 0.25 * ((M * ((h * D) / d)) / t_0) elif t_3 <= math.inf: tmp = t_1 else: tmp = 0.25 * (((D / d) * (h * M)) / t_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(Float64(d / D) / M) t_1 = Float64(Float64(Float64(Float64(Float64(c0 * d) / w) / D) * Float64(2.0 / h)) / Float64(Float64(D / d) * Float64(2.0 * Float64(w / c0)))) t_2 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_3 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_2 + sqrt(Float64(Float64(t_2 * t_2) - Float64(M * M))))) tmp = 0.0 if (t_3 <= -4e-152) tmp = t_1; elseif (t_3 <= 0.0) tmp = Float64(0.25 * Float64(Float64(M * Float64(Float64(h * D) / d)) / t_0)); elseif (t_3 <= Inf) tmp = t_1; else tmp = Float64(0.25 * Float64(Float64(Float64(D / d) * Float64(h * M)) / t_0)); 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 = (d / D) / M; t_1 = ((((c0 * d) / w) / D) * (2.0 / h)) / ((D / d) * (2.0 * (w / c0))); t_2 = (c0 * (d * d)) / ((w * h) * (D * D)); t_3 = (c0 / (2.0 * w)) * (t_2 + sqrt(((t_2 * t_2) - (M * M)))); tmp = 0.0; if (t_3 <= -4e-152) tmp = t_1; elseif (t_3 <= 0.0) tmp = 0.25 * ((M * ((h * D) / d)) / t_0); elseif (t_3 <= Inf) tmp = t_1; else tmp = 0.25 * (((D / d) * (h * M)) / t_0); 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[(d / D), $MachinePrecision] / M), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(c0 * d), $MachinePrecision] / w), $MachinePrecision] / D), $MachinePrecision] * N[(2.0 / h), $MachinePrecision]), $MachinePrecision] / N[(N[(D / d), $MachinePrecision] * N[(2.0 * N[(w / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 + N[Sqrt[N[(N[(t$95$2 * t$95$2), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -4e-152], t$95$1, If[LessEqual[t$95$3, 0.0], N[(0.25 * N[(N[(M * N[(N[(h * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], t$95$1, N[(0.25 * N[(N[(N[(D / d), $MachinePrecision] * N[(h * M), $MachinePrecision]), $MachinePrecision] / t$95$0), $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{\frac{d}{D}}{M}\\
t_1 := \frac{\frac{\frac{c0 \cdot d}{w}}{D} \cdot \frac{2}{h}}{\frac{D}{d} \cdot \left(2 \cdot \frac{w}{c0}\right)}\\
t_2 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_3 := \frac{c0}{2 \cdot w} \cdot \left(t_2 + \sqrt{t_2 \cdot t_2 - M \cdot M}\right)\\
\mathbf{if}\;t_3 \leq -4 \cdot 10^{-152}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_3 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{M \cdot \frac{h \cdot D}{d}}{t_0}\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{\frac{D}{d} \cdot \left(h \cdot M\right)}{t_0}\\
\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))))) < -4.00000000000000026e-152 or 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 76.26
Simplified70.78
[Start]76.26 | \[ \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 [=>]78.72 | \[ \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 [=>]78.7 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d \cdot d}{D \cdot D}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)}
\] |
associate-/r* [=>]78.71 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\color{blue}{\frac{\frac{c0}{w}}{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 [=>]78.69 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{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 [=>]78.7 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{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)
\] |
sub-neg [=>]78.7 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{\frac{c0}{w}}{h}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \left(-M\right)\right)}}\right)
\] |
Taylor expanded in c0 around inf 67.11
Simplified63.42
[Start]67.11 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)
\] |
|---|---|
times-frac [=>]68.42 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{{d}^{2}}{{D}^{2}} \cdot \frac{c0}{w \cdot h}\right)}\right)
\] |
associate-*l/ [=>]67.04 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\frac{{d}^{2} \cdot \frac{c0}{w \cdot h}}{{D}^{2}}}\right)
\] |
unpow2 [=>]67.04 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\color{blue}{\left(d \cdot d\right)} \cdot \frac{c0}{w \cdot h}}{{D}^{2}}\right)
\] |
unpow2 [=>]67.04 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\left(d \cdot d\right) \cdot \frac{c0}{w \cdot h}}{\color{blue}{D \cdot D}}\right)
\] |
times-frac [=>]56.52 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{d \cdot d}{D} \cdot \frac{\frac{c0}{w \cdot h}}{D}\right)}\right)
\] |
associate-*r/ [=>]57.01 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\frac{\frac{d \cdot d}{D} \cdot \frac{c0}{w \cdot h}}{D}}\right)
\] |
associate-*l/ [<=]63.46 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{\frac{d \cdot d}{D}}{D} \cdot \frac{c0}{w \cdot h}\right)}\right)
\] |
associate-*l/ [<=]59.97 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\color{blue}{\frac{d}{D} \cdot d}}{D} \cdot \frac{c0}{w \cdot h}\right)\right)
\] |
associate-*r/ [<=]58.33 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} \cdot \frac{c0}{w \cdot h}\right)\right)
\] |
unpow2 [<=]58.33 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\color{blue}{{\left(\frac{d}{D}\right)}^{2}} \cdot \frac{c0}{w \cdot h}\right)\right)
\] |
associate-*r/ [=>]60.5 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\frac{{\left(\frac{d}{D}\right)}^{2} \cdot c0}{w \cdot h}}\right)
\] |
associate-/l* [=>]58.2 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\frac{{\left(\frac{d}{D}\right)}^{2}}{\frac{w \cdot h}{c0}}}\right)
\] |
associate-/r/ [=>]63.42 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{{\left(\frac{d}{D}\right)}^{2}}{w \cdot h} \cdot c0\right)}\right)
\] |
Applied egg-rr57.28
Applied egg-rr24.08
Simplified26.21
[Start]24.08 | \[ \frac{\frac{2}{\frac{h}{\frac{d}{D} \cdot \frac{c0}{w}}}}{\left(2 \cdot \frac{w}{c0}\right) \cdot \frac{D}{d}}
\] |
|---|---|
associate-/r/ [=>]24.08 | \[ \frac{\color{blue}{\frac{2}{h} \cdot \left(\frac{d}{D} \cdot \frac{c0}{w}\right)}}{\left(2 \cdot \frac{w}{c0}\right) \cdot \frac{D}{d}}
\] |
*-commutative [=>]24.08 | \[ \frac{\color{blue}{\left(\frac{d}{D} \cdot \frac{c0}{w}\right) \cdot \frac{2}{h}}}{\left(2 \cdot \frac{w}{c0}\right) \cdot \frac{D}{d}}
\] |
associate-*l/ [=>]24.96 | \[ \frac{\color{blue}{\frac{d \cdot \frac{c0}{w}}{D}} \cdot \frac{2}{h}}{\left(2 \cdot \frac{w}{c0}\right) \cdot \frac{D}{d}}
\] |
associate-*r/ [=>]26.21 | \[ \frac{\frac{\color{blue}{\frac{d \cdot c0}{w}}}{D} \cdot \frac{2}{h}}{\left(2 \cdot \frac{w}{c0}\right) \cdot \frac{D}{d}}
\] |
*-commutative [=>]26.21 | \[ \frac{\frac{\frac{d \cdot c0}{w}}{D} \cdot \frac{2}{h}}{\color{blue}{\frac{D}{d} \cdot \left(2 \cdot \frac{w}{c0}\right)}}
\] |
if -4.00000000000000026e-152 < (*.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.0Initial program 44.26
Simplified50.46
[Start]44.26 | \[ \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 [=>]62 | \[ \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 [=>]62 | \[ \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 [=>]57.15 | \[ \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 [=>]50.46 | \[ \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)
\] |
Taylor expanded in c0 around -inf 48.12
Simplified48.71
[Start]48.12 | \[ \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 [=>]48.12 | \[ \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 40.76
Simplified36.68
[Start]40.76 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}
\] |
|---|---|
*-commutative [=>]40.76 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}}{{d}^{2}}
\] |
associate-/l* [=>]41.78 | \[ 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}}
\] |
unpow2 [=>]41.78 | \[ 0.25 \cdot \frac{{D}^{2}}{\frac{{d}^{2}}{\color{blue}{\left(M \cdot M\right)} \cdot h}}
\] |
*-commutative [<=]41.78 | \[ 0.25 \cdot \frac{{D}^{2}}{\frac{{d}^{2}}{\color{blue}{h \cdot \left(M \cdot M\right)}}}
\] |
associate-/r/ [=>]41.11 | \[ 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}
\] |
unpow2 [=>]41.11 | \[ 0.25 \cdot \left(\frac{\color{blue}{D \cdot D}}{{d}^{2}} \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)
\] |
unpow2 [=>]41.11 | \[ 0.25 \cdot \left(\frac{D \cdot D}{\color{blue}{d \cdot d}} \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)
\] |
times-frac [=>]36.68 | \[ 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)
\] |
Applied egg-rr23.51
Applied egg-rr22.21
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))))) Initial program 100
Simplified98.91
[Start]100 | \[ \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 [=>]100 | \[ \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 [=>]100 | \[ \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 [=>]100 | \[ \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 [=>]98.91 | \[ \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)
\] |
Taylor expanded in c0 around -inf 98.35
Simplified89.96
[Start]98.35 | \[ \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 [=>]98.35 | \[ \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 52.7
Simplified40.22
[Start]52.7 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}
\] |
|---|---|
*-commutative [=>]52.7 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}}{{d}^{2}}
\] |
associate-/l* [=>]52.96 | \[ 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}}
\] |
unpow2 [=>]52.96 | \[ 0.25 \cdot \frac{{D}^{2}}{\frac{{d}^{2}}{\color{blue}{\left(M \cdot M\right)} \cdot h}}
\] |
*-commutative [<=]52.96 | \[ 0.25 \cdot \frac{{D}^{2}}{\frac{{d}^{2}}{\color{blue}{h \cdot \left(M \cdot M\right)}}}
\] |
associate-/r/ [=>]52.94 | \[ 0.25 \cdot \color{blue}{\left(\frac{{D}^{2}}{{d}^{2}} \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)}
\] |
unpow2 [=>]52.94 | \[ 0.25 \cdot \left(\frac{\color{blue}{D \cdot D}}{{d}^{2}} \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)
\] |
unpow2 [=>]52.94 | \[ 0.25 \cdot \left(\frac{D \cdot D}{\color{blue}{d \cdot d}} \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)
\] |
times-frac [=>]40.22 | \[ 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)
\] |
Applied egg-rr23.15
Final simplification23.48
| Alternative 1 | |
|---|---|
| Error | 32.39% |
| Cost | 2384 |
| Alternative 2 | |
|---|---|
| Error | 32.37% |
| Cost | 2384 |
| Alternative 3 | |
|---|---|
| Error | 31.97% |
| Cost | 2384 |
| Alternative 4 | |
|---|---|
| Error | 45.23% |
| Cost | 1225 |
| Alternative 5 | |
|---|---|
| Error | 44.2% |
| Cost | 1225 |
| Alternative 6 | |
|---|---|
| Error | 41.65% |
| Cost | 1225 |
| Alternative 7 | |
|---|---|
| Error | 40.61% |
| Cost | 1225 |
| Alternative 8 | |
|---|---|
| Error | 39.64% |
| Cost | 1224 |
| Alternative 9 | |
|---|---|
| Error | 34.04% |
| Cost | 1224 |
| Alternative 10 | |
|---|---|
| Error | 34.25% |
| Cost | 1224 |
| Alternative 11 | |
|---|---|
| Error | 32.73% |
| Cost | 1224 |
| Alternative 12 | |
|---|---|
| Error | 32.83% |
| Cost | 1224 |
| Alternative 13 | |
|---|---|
| Error | 30.75% |
| Cost | 1224 |
| Alternative 14 | |
|---|---|
| Error | 37.5% |
| Cost | 1092 |
| Alternative 15 | |
|---|---|
| Error | 51.23% |
| Cost | 64 |
herbie shell --seed 2023115
(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))))))