| Alternative 1 | |
|---|---|
| Error | 16.0 |
| Cost | 30285 |
(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 d)) (* (* w h) (* D D))))
(t_2 (* (/ c0 (* 2.0 w)) (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))))
(if (<= t_2 -2e-212)
(/ (* (* d (/ c0 w)) (/ d D)) (* (/ w c0) (* h D)))
(if (<= t_2 0.0)
(/ (* M 0.25) (* t_0 (/ d (* h D))))
(if (<= t_2 INFINITY)
(pow (* (/ d D) (* (sqrt (/ c0 (* w h))) (sqrt (/ c0 w)))) 2.0)
(* 0.25 (/ (* M (/ h (/ d D))) 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 * d)) / ((w * h) * (D * D));
double t_2 = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= -2e-212) {
tmp = ((d * (c0 / w)) * (d / D)) / ((w / c0) * (h * D));
} else if (t_2 <= 0.0) {
tmp = (M * 0.25) / (t_0 * (d / (h * D)));
} else if (t_2 <= ((double) INFINITY)) {
tmp = pow(((d / D) * (sqrt((c0 / (w * h))) * sqrt((c0 / w)))), 2.0);
} else {
tmp = 0.25 * ((M * (h / (d / D))) / 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 * d)) / ((w * h) * (D * D));
double t_2 = (c0 / (2.0 * w)) * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= -2e-212) {
tmp = ((d * (c0 / w)) * (d / D)) / ((w / c0) * (h * D));
} else if (t_2 <= 0.0) {
tmp = (M * 0.25) / (t_0 * (d / (h * D)));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = Math.pow(((d / D) * (Math.sqrt((c0 / (w * h))) * Math.sqrt((c0 / w)))), 2.0);
} else {
tmp = 0.25 * ((M * (h / (d / D))) / 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 * d)) / ((w * h) * (D * D)) t_2 = (c0 / (2.0 * w)) * (t_1 + math.sqrt(((t_1 * t_1) - (M * M)))) tmp = 0 if t_2 <= -2e-212: tmp = ((d * (c0 / w)) * (d / D)) / ((w / c0) * (h * D)) elif t_2 <= 0.0: tmp = (M * 0.25) / (t_0 * (d / (h * D))) elif t_2 <= math.inf: tmp = math.pow(((d / D) * (math.sqrt((c0 / (w * h))) * math.sqrt((c0 / w)))), 2.0) else: tmp = 0.25 * ((M * (h / (d / D))) / 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(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_2 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) tmp = 0.0 if (t_2 <= -2e-212) tmp = Float64(Float64(Float64(d * Float64(c0 / w)) * Float64(d / D)) / Float64(Float64(w / c0) * Float64(h * D))); elseif (t_2 <= 0.0) tmp = Float64(Float64(M * 0.25) / Float64(t_0 * Float64(d / Float64(h * D)))); elseif (t_2 <= Inf) tmp = Float64(Float64(d / D) * Float64(sqrt(Float64(c0 / Float64(w * h))) * sqrt(Float64(c0 / w)))) ^ 2.0; else tmp = Float64(0.25 * Float64(Float64(M * Float64(h / Float64(d / D))) / 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 * d)) / ((w * h) * (D * D)); t_2 = (c0 / (2.0 * w)) * (t_1 + sqrt(((t_1 * t_1) - (M * M)))); tmp = 0.0; if (t_2 <= -2e-212) tmp = ((d * (c0 / w)) * (d / D)) / ((w / c0) * (h * D)); elseif (t_2 <= 0.0) tmp = (M * 0.25) / (t_0 * (d / (h * D))); elseif (t_2 <= Inf) tmp = ((d / D) * (sqrt((c0 / (w * h))) * sqrt((c0 / w)))) ^ 2.0; else tmp = 0.25 * ((M * (h / (d / D))) / 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[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-212], N[(N[(N[(d * N[(c0 / w), $MachinePrecision]), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] / N[(N[(w / c0), $MachinePrecision] * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(N[(M * 0.25), $MachinePrecision] / N[(t$95$0 * N[(d / N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[Power[N[(N[(d / D), $MachinePrecision] * N[(N[Sqrt[N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(c0 / w), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], N[(0.25 * N[(N[(M * N[(h / N[(d / D), $MachinePrecision]), $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{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_2 := \frac{c0}{2 \cdot w} \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right)\\
\mathbf{if}\;t_2 \leq -2 \cdot 10^{-212}:\\
\;\;\;\;\frac{\left(d \cdot \frac{c0}{w}\right) \cdot \frac{d}{D}}{\frac{w}{c0} \cdot \left(h \cdot D\right)}\\
\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;\frac{M \cdot 0.25}{t_0 \cdot \frac{d}{h \cdot D}}\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;{\left(\frac{d}{D} \cdot \left(\sqrt{\frac{c0}{w \cdot h}} \cdot \sqrt{\frac{c0}{w}}\right)\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{M \cdot \frac{h}{\frac{d}{D}}}{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))))) < -1.99999999999999991e-212Initial program 48.9
Simplified45.5
[Start]48.9 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
|---|---|
times-frac [=>]50.0 | \[ \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 [=>]50.0 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d \cdot d}{D \cdot D}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)}
\] |
times-frac [=>]50.0 | \[ \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 [=>]50.0 | \[ \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)
\] |
Taylor expanded in c0 around inf 43.0
Simplified43.2
[Start]43.0 | \[ \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 [=>]43.2 | \[ \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)
\] |
unpow2 [=>]43.2 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\color{blue}{d \cdot d}}{{D}^{2}} \cdot \frac{c0}{w \cdot h}\right)\right)
\] |
unpow2 [=>]43.2 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{d \cdot d}{\color{blue}{D \cdot D}} \cdot \frac{c0}{w \cdot h}\right)\right)
\] |
Applied egg-rr38.2
Applied egg-rr62.2
Simplified30.4
[Start]62.2 | \[ e^{\mathsf{log1p}\left(\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{d \cdot d}{\left(\left(\frac{w}{c0} \cdot h\right) \cdot D\right) \cdot D}\right)\right)} - 1
\] |
|---|---|
expm1-def [=>]56.3 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{d \cdot d}{\left(\left(\frac{w}{c0} \cdot h\right) \cdot D\right) \cdot D}\right)\right)\right)}
\] |
expm1-log1p [=>]38.2 | \[ \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{d \cdot d}{\left(\left(\frac{w}{c0} \cdot h\right) \cdot D\right) \cdot D}\right)}
\] |
associate-/r/ [<=]41.9 | \[ \color{blue}{\frac{c0}{\frac{2 \cdot w}{2 \cdot \frac{d \cdot d}{\left(\left(\frac{w}{c0} \cdot h\right) \cdot D\right) \cdot D}}}}
\] |
times-frac [=>]41.9 | \[ \frac{c0}{\color{blue}{\frac{2}{2} \cdot \frac{w}{\frac{d \cdot d}{\left(\left(\frac{w}{c0} \cdot h\right) \cdot D\right) \cdot D}}}}
\] |
metadata-eval [=>]41.9 | \[ \frac{c0}{\color{blue}{1} \cdot \frac{w}{\frac{d \cdot d}{\left(\left(\frac{w}{c0} \cdot h\right) \cdot D\right) \cdot D}}}
\] |
*-commutative [=>]41.9 | \[ \frac{c0}{\color{blue}{\frac{w}{\frac{d \cdot d}{\left(\left(\frac{w}{c0} \cdot h\right) \cdot D\right) \cdot D}} \cdot 1}}
\] |
associate-/r/ [<=]41.9 | \[ \frac{c0}{\color{blue}{\frac{w}{\frac{\frac{d \cdot d}{\left(\left(\frac{w}{c0} \cdot h\right) \cdot D\right) \cdot D}}{1}}}}
\] |
/-rgt-identity [=>]41.9 | \[ \frac{c0}{\frac{w}{\color{blue}{\frac{d \cdot d}{\left(\left(\frac{w}{c0} \cdot h\right) \cdot D\right) \cdot D}}}}
\] |
/-rgt-identity [<=]41.9 | \[ \frac{c0}{\frac{\color{blue}{\frac{w}{1}}}{\frac{d \cdot d}{\left(\left(\frac{w}{c0} \cdot h\right) \cdot D\right) \cdot D}}}
\] |
associate-/r/ [=>]38.2 | \[ \color{blue}{\frac{c0}{\frac{w}{1}} \cdot \frac{d \cdot d}{\left(\left(\frac{w}{c0} \cdot h\right) \cdot D\right) \cdot D}}
\] |
/-rgt-identity [=>]38.2 | \[ \frac{c0}{\color{blue}{w}} \cdot \frac{d \cdot d}{\left(\left(\frac{w}{c0} \cdot h\right) \cdot D\right) \cdot D}
\] |
*-commutative [=>]38.2 | \[ \frac{c0}{w} \cdot \frac{d \cdot d}{\color{blue}{D \cdot \left(\left(\frac{w}{c0} \cdot h\right) \cdot D\right)}}
\] |
Applied egg-rr25.6
if -1.99999999999999991e-212 < (*.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 30.5
Taylor expanded in c0 around -inf 29.3
Simplified29.2
[Start]29.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 [=>]29.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)}
\] |
times-frac [=>]28.3 | \[ \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 [=>]28.3 | \[ \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 [=>]28.3 | \[ \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)
\] |
times-frac [=>]26.0 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)} \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 [<=]26.0 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \left(\frac{D}{d} \cdot \frac{D}{d}\right) \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)
\] |
associate-*r* [=>]27.4 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{\color{blue}{\left(w \cdot h\right) \cdot {M}^{2}}}{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 [=>]27.4 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{\left(w \cdot h\right) \cdot \color{blue}{\left(M \cdot M\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-/l* [=>]28.0 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \color{blue}{\frac{w \cdot h}{\frac{c0}{M \cdot M}}}, -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 24.6
Simplified22.2
[Start]24.6 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}
\] |
|---|---|
*-commutative [<=]24.6 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}}{{d}^{2}}
\] |
associate-/l* [=>]24.7 | \[ 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}}
\] |
unpow2 [=>]24.7 | \[ 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}
\] |
associate-/r/ [=>]24.5 | \[ 0.25 \cdot \color{blue}{\left(\frac{D \cdot D}{{d}^{2}} \cdot \left({M}^{2} \cdot h\right)\right)}
\] |
unpow2 [=>]24.5 | \[ 0.25 \cdot \left(\frac{D \cdot D}{\color{blue}{d \cdot d}} \cdot \left({M}^{2} \cdot h\right)\right)
\] |
times-frac [=>]22.2 | \[ 0.25 \cdot \left(\color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)} \cdot \left({M}^{2} \cdot h\right)\right)
\] |
unpow2 [<=]22.2 | \[ 0.25 \cdot \left(\color{blue}{{\left(\frac{D}{d}\right)}^{2}} \cdot \left({M}^{2} \cdot h\right)\right)
\] |
unpow2 [=>]22.2 | \[ 0.25 \cdot \left({\left(\frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)\right)
\] |
*-commutative [<=]22.2 | \[ 0.25 \cdot \left({\left(\frac{D}{d}\right)}^{2} \cdot \color{blue}{\left(h \cdot \left(M \cdot M\right)\right)}\right)
\] |
Taylor expanded in D around 0 24.6
Simplified18.2
[Start]24.6 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}
\] |
|---|---|
*-commutative [=>]24.6 | \[ \color{blue}{\frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}} \cdot 0.25}
\] |
unpow2 [=>]24.6 | \[ \frac{\color{blue}{\left(D \cdot D\right)} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}} \cdot 0.25
\] |
unpow2 [=>]24.6 | \[ \frac{\left(D \cdot D\right) \cdot \left(h \cdot \color{blue}{\left(M \cdot M\right)}\right)}{{d}^{2}} \cdot 0.25
\] |
*-commutative [<=]24.6 | \[ \frac{\color{blue}{\left(h \cdot \left(M \cdot M\right)\right) \cdot \left(D \cdot D\right)}}{{d}^{2}} \cdot 0.25
\] |
unpow2 [=>]24.6 | \[ \frac{\left(h \cdot \left(M \cdot M\right)\right) \cdot \left(D \cdot D\right)}{\color{blue}{d \cdot d}} \cdot 0.25
\] |
associate-/l* [=>]24.6 | \[ \color{blue}{\frac{h \cdot \left(M \cdot M\right)}{\frac{d \cdot d}{D \cdot D}}} \cdot 0.25
\] |
times-frac [=>]22.1 | \[ \frac{h \cdot \left(M \cdot M\right)}{\color{blue}{\frac{d}{D} \cdot \frac{d}{D}}} \cdot 0.25
\] |
times-frac [=>]18.2 | \[ \color{blue}{\left(\frac{h}{\frac{d}{D}} \cdot \frac{M \cdot M}{\frac{d}{D}}\right)} \cdot 0.25
\] |
Applied egg-rr11.1
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 47.2
Simplified45.3
[Start]47.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.7 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
fma-def [=>]49.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)}
\] |
times-frac [=>]49.7 | \[ \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 [=>]49.7 | \[ \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)
\] |
Taylor expanded in c0 around inf 41.6
Simplified43.2
[Start]41.6 | \[ \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 [=>]43.2 | \[ \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)
\] |
unpow2 [=>]43.2 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\color{blue}{d \cdot d}}{{D}^{2}} \cdot \frac{c0}{w \cdot h}\right)\right)
\] |
unpow2 [=>]43.2 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{d \cdot d}{\color{blue}{D \cdot D}} \cdot \frac{c0}{w \cdot h}\right)\right)
\] |
Applied egg-rr22.9
Simplified22.9
[Start]22.9 | \[ {\left(\sqrt{\frac{c0}{w}} \cdot \left(\sqrt{\frac{c0}{w \cdot h}} \cdot \frac{d}{D}\right)\right)}^{2}
\] |
|---|---|
associate-*r* [=>]22.9 | \[ {\color{blue}{\left(\left(\sqrt{\frac{c0}{w}} \cdot \sqrt{\frac{c0}{w \cdot h}}\right) \cdot \frac{d}{D}\right)}}^{2}
\] |
*-commutative [=>]22.9 | \[ {\color{blue}{\left(\frac{d}{D} \cdot \left(\sqrt{\frac{c0}{w}} \cdot \sqrt{\frac{c0}{w \cdot h}}\right)\right)}}^{2}
\] |
*-commutative [=>]22.9 | \[ {\left(\frac{d}{D} \cdot \color{blue}{\left(\sqrt{\frac{c0}{w \cdot h}} \cdot \sqrt{\frac{c0}{w}}\right)}\right)}^{2}
\] |
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 64.0
Taylor expanded in c0 around -inf 62.8
Simplified59.7
[Start]62.8 | \[ \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 [=>]62.8 | \[ \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 [=>]62.7 | \[ \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 [=>]62.7 | \[ \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 [=>]62.7 | \[ \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)
\] |
times-frac [=>]62.4 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)} \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 [<=]62.4 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \left(\frac{D}{d} \cdot \frac{D}{d}\right) \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)
\] |
associate-*r* [=>]62.6 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{\color{blue}{\left(w \cdot h\right) \cdot {M}^{2}}}{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 [=>]62.6 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{\left(w \cdot h\right) \cdot \color{blue}{\left(M \cdot M\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-/l* [=>]62.6 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \color{blue}{\frac{w \cdot h}{\frac{c0}{M \cdot M}}}, -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 34.6
Simplified25.7
[Start]34.6 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}
\] |
|---|---|
*-commutative [<=]34.6 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}}{{d}^{2}}
\] |
associate-/l* [=>]34.6 | \[ 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}}
\] |
unpow2 [=>]34.6 | \[ 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}
\] |
associate-/r/ [=>]34.7 | \[ 0.25 \cdot \color{blue}{\left(\frac{D \cdot D}{{d}^{2}} \cdot \left({M}^{2} \cdot h\right)\right)}
\] |
unpow2 [=>]34.7 | \[ 0.25 \cdot \left(\frac{D \cdot D}{\color{blue}{d \cdot d}} \cdot \left({M}^{2} \cdot h\right)\right)
\] |
times-frac [=>]25.7 | \[ 0.25 \cdot \left(\color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)} \cdot \left({M}^{2} \cdot h\right)\right)
\] |
unpow2 [<=]25.7 | \[ 0.25 \cdot \left(\color{blue}{{\left(\frac{D}{d}\right)}^{2}} \cdot \left({M}^{2} \cdot h\right)\right)
\] |
unpow2 [=>]25.7 | \[ 0.25 \cdot \left({\left(\frac{D}{d}\right)}^{2} \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)\right)
\] |
*-commutative [<=]25.7 | \[ 0.25 \cdot \left({\left(\frac{D}{d}\right)}^{2} \cdot \color{blue}{\left(h \cdot \left(M \cdot M\right)\right)}\right)
\] |
Taylor expanded in D around 0 34.6
Simplified22.2
[Start]34.6 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}
\] |
|---|---|
*-commutative [=>]34.6 | \[ \color{blue}{\frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}} \cdot 0.25}
\] |
unpow2 [=>]34.6 | \[ \frac{\color{blue}{\left(D \cdot D\right)} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}} \cdot 0.25
\] |
unpow2 [=>]34.6 | \[ \frac{\left(D \cdot D\right) \cdot \left(h \cdot \color{blue}{\left(M \cdot M\right)}\right)}{{d}^{2}} \cdot 0.25
\] |
*-commutative [<=]34.6 | \[ \frac{\color{blue}{\left(h \cdot \left(M \cdot M\right)\right) \cdot \left(D \cdot D\right)}}{{d}^{2}} \cdot 0.25
\] |
unpow2 [=>]34.6 | \[ \frac{\left(h \cdot \left(M \cdot M\right)\right) \cdot \left(D \cdot D\right)}{\color{blue}{d \cdot d}} \cdot 0.25
\] |
associate-/l* [=>]34.7 | \[ \color{blue}{\frac{h \cdot \left(M \cdot M\right)}{\frac{d \cdot d}{D \cdot D}}} \cdot 0.25
\] |
times-frac [=>]25.8 | \[ \frac{h \cdot \left(M \cdot M\right)}{\color{blue}{\frac{d}{D} \cdot \frac{d}{D}}} \cdot 0.25
\] |
times-frac [=>]22.2 | \[ \color{blue}{\left(\frac{h}{\frac{d}{D}} \cdot \frac{M \cdot M}{\frac{d}{D}}\right)} \cdot 0.25
\] |
Applied egg-rr14.3
Final simplification15.4
| Alternative 1 | |
|---|---|
| Error | 16.0 |
| Cost | 30285 |
| Alternative 2 | |
|---|---|
| Error | 20.0 |
| Cost | 1353 |
| Alternative 3 | |
|---|---|
| Error | 20.0 |
| Cost | 1353 |
| Alternative 4 | |
|---|---|
| Error | 20.2 |
| Cost | 1353 |
| Alternative 5 | |
|---|---|
| Error | 18.9 |
| Cost | 1289 |
| Alternative 6 | |
|---|---|
| Error | 27.1 |
| Cost | 1220 |
| Alternative 7 | |
|---|---|
| Error | 27.1 |
| Cost | 1220 |
| Alternative 8 | |
|---|---|
| Error | 25.1 |
| Cost | 1220 |
| Alternative 9 | |
|---|---|
| Error | 20.9 |
| Cost | 1220 |
| Alternative 10 | |
|---|---|
| Error | 21.1 |
| Cost | 960 |
| Alternative 11 | |
|---|---|
| Error | 18.8 |
| Cost | 960 |
| Alternative 12 | |
|---|---|
| Error | 32.0 |
| Cost | 64 |
herbie shell --seed 2023011
(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))))))