| Alternative 1 | |
|---|---|
| Error | 15.1 |
| Cost | 42637 |
(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_0 (sqrt (- (* t_0 t_0) (* M M)))))))
(if (<= t_1 -1e-224)
(/ d (* (* (/ 2.0 c0) (* w D)) (/ (* h (/ (* w D) 2.0)) (* c0 d))))
(if (or (<= t_1 0.0) (not (<= t_1 INFINITY)))
(* (/ 0.25 d) (* (* D M) (/ h (/ d (* D M)))))
(pow (* (/ d D) (/ (/ c0 w) (sqrt h))) 2.0)))))double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))));
}
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= -1e-224) {
tmp = d / (((2.0 / c0) * (w * D)) * ((h * ((w * D) / 2.0)) / (c0 * d)));
} else if ((t_1 <= 0.0) || !(t_1 <= ((double) INFINITY))) {
tmp = (0.25 / d) * ((D * M) * (h / (d / (D * M))));
} else {
tmp = pow(((d / D) * ((c0 / w) / sqrt(h))), 2.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 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_1 = (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
double tmp;
if (t_1 <= -1e-224) {
tmp = d / (((2.0 / c0) * (w * D)) * ((h * ((w * D) / 2.0)) / (c0 * d)));
} else if ((t_1 <= 0.0) || !(t_1 <= Double.POSITIVE_INFINITY)) {
tmp = (0.25 / d) * ((D * M) * (h / (d / (D * M))));
} else {
tmp = Math.pow(((d / D) * ((c0 / w) / Math.sqrt(h))), 2.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 = (c0 * (d * d)) / ((w * h) * (D * D)) t_1 = (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M)))) tmp = 0 if t_1 <= -1e-224: tmp = d / (((2.0 / c0) * (w * D)) * ((h * ((w * D) / 2.0)) / (c0 * d))) elif (t_1 <= 0.0) or not (t_1 <= math.inf): tmp = (0.25 / d) * ((D * M) * (h / (d / (D * M)))) else: tmp = math.pow(((d / D) * ((c0 / w) / math.sqrt(h))), 2.0) return tmp
function code(c0, w, h, D, d, M) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) + sqrt(Float64(Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) * Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))) - Float64(M * M))))) end
function code(c0, w, h, D, d, M) t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_1 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) tmp = 0.0 if (t_1 <= -1e-224) tmp = Float64(d / Float64(Float64(Float64(2.0 / c0) * Float64(w * D)) * Float64(Float64(h * Float64(Float64(w * D) / 2.0)) / Float64(c0 * d)))); elseif ((t_1 <= 0.0) || !(t_1 <= Inf)) tmp = Float64(Float64(0.25 / d) * Float64(Float64(D * M) * Float64(h / Float64(d / Float64(D * M))))); else tmp = Float64(Float64(d / D) * Float64(Float64(c0 / w) / sqrt(h))) ^ 2.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 = (c0 * (d * d)) / ((w * h) * (D * D)); t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M)))); tmp = 0.0; if (t_1 <= -1e-224) tmp = d / (((2.0 / c0) * (w * D)) * ((h * ((w * D) / 2.0)) / (c0 * d))); elseif ((t_1 <= 0.0) || ~((t_1 <= Inf))) tmp = (0.25 / d) * ((D * M) * (h / (d / (D * M)))); else tmp = ((d / D) * ((c0 / w) / sqrt(h))) ^ 2.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[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $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]}, If[LessEqual[t$95$1, -1e-224], N[(d / N[(N[(N[(2.0 / c0), $MachinePrecision] * N[(w * D), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(N[(w * D), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] / N[(c0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$1, 0.0], N[Not[LessEqual[t$95$1, Infinity]], $MachinePrecision]], N[(N[(0.25 / d), $MachinePrecision] * N[(N[(D * M), $MachinePrecision] * N[(h / N[(d / N[(D * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(d / D), $MachinePrecision] * N[(N[(c0 / w), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]]]]
\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{-224}:\\
\;\;\;\;\frac{d}{\left(\frac{2}{c0} \cdot \left(w \cdot D\right)\right) \cdot \frac{h \cdot \frac{w \cdot D}{2}}{c0 \cdot d}}\\
\mathbf{elif}\;t_1 \leq 0 \lor \neg \left(t_1 \leq \infty\right):\\
\;\;\;\;\frac{0.25}{d} \cdot \left(\left(D \cdot M\right) \cdot \frac{h}{\frac{d}{D \cdot M}}\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{d}{D} \cdot \frac{\frac{c0}{w}}{\sqrt{h}}\right)}^{2}\\
\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))))) < -1e-224Initial program 49.0
Simplified50.0
[Start]49.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
|---|---|
times-frac [=>]51.1 | \[ \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 [=>]51.1 | \[ \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 [=>]51.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(\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.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(\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 43.0
Simplified41.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)
\] |
|---|---|
associate-*r/ [=>]43.0 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\frac{2 \cdot \left({d}^{2} \cdot c0\right)}{{D}^{2} \cdot \left(w \cdot h\right)}}
\] |
*-commutative [=>]43.0 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \color{blue}{\left(c0 \cdot {d}^{2}\right)}}{{D}^{2} \cdot \left(w \cdot h\right)}
\] |
unpow2 [=>]43.0 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(c0 \cdot \color{blue}{\left(d \cdot d\right)}\right)}{{D}^{2} \cdot \left(w \cdot h\right)}
\] |
associate-*r* [=>]39.8 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \color{blue}{\left(\left(c0 \cdot d\right) \cdot d\right)}}{{D}^{2} \cdot \left(w \cdot h\right)}
\] |
*-commutative [<=]39.8 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(\color{blue}{\left(d \cdot c0\right)} \cdot d\right)}{{D}^{2} \cdot \left(w \cdot h\right)}
\] |
*-commutative [=>]39.8 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(\left(d \cdot c0\right) \cdot d\right)}{\color{blue}{\left(w \cdot h\right) \cdot {D}^{2}}}
\] |
unpow2 [=>]39.8 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(\left(d \cdot c0\right) \cdot d\right)}{\left(w \cdot h\right) \cdot \color{blue}{\left(D \cdot D\right)}}
\] |
associate-*r* [<=]41.2 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(\left(d \cdot c0\right) \cdot d\right)}{\color{blue}{w \cdot \left(h \cdot \left(D \cdot D\right)\right)}}
\] |
Applied egg-rr29.3
Simplified24.6
[Start]29.3 | \[ \frac{\frac{d \cdot \left(d \cdot c0\right)}{\left(h \cdot D\right) \cdot \frac{w}{2}}}{\left(\frac{2}{c0} \cdot w\right) \cdot D}
\] |
|---|---|
associate-/l* [=>]26.8 | \[ \frac{\color{blue}{\frac{d}{\frac{\left(h \cdot D\right) \cdot \frac{w}{2}}{d \cdot c0}}}}{\left(\frac{2}{c0} \cdot w\right) \cdot D}
\] |
associate-/l/ [=>]25.9 | \[ \color{blue}{\frac{d}{\left(\left(\frac{2}{c0} \cdot w\right) \cdot D\right) \cdot \frac{\left(h \cdot D\right) \cdot \frac{w}{2}}{d \cdot c0}}}
\] |
associate-*l* [=>]27.6 | \[ \frac{d}{\color{blue}{\left(\frac{2}{c0} \cdot \left(w \cdot D\right)\right)} \cdot \frac{\left(h \cdot D\right) \cdot \frac{w}{2}}{d \cdot c0}}
\] |
*-commutative [=>]27.6 | \[ \frac{d}{\left(\frac{2}{c0} \cdot \color{blue}{\left(D \cdot w\right)}\right) \cdot \frac{\left(h \cdot D\right) \cdot \frac{w}{2}}{d \cdot c0}}
\] |
associate-*l* [=>]24.6 | \[ \frac{d}{\left(\frac{2}{c0} \cdot \left(D \cdot w\right)\right) \cdot \frac{\color{blue}{h \cdot \left(D \cdot \frac{w}{2}\right)}}{d \cdot c0}}
\] |
associate-*r/ [=>]24.6 | \[ \frac{d}{\left(\frac{2}{c0} \cdot \left(D \cdot w\right)\right) \cdot \frac{h \cdot \color{blue}{\frac{D \cdot w}{2}}}{d \cdot c0}}
\] |
if -1e-224 < (*.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 61.2
Applied egg-rr62.1
Taylor expanded in c0 around -inf 60.0
Simplified34.2
[Start]60.0 | \[ \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 [=>]60.0 | \[ \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 33.1
Simplified20.5
[Start]33.1 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}
\] |
|---|---|
associate-*r/ [=>]33.1 | \[ \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2}}}
\] |
unpow2 [=>]33.1 | \[ \frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{d \cdot d}}
\] |
times-frac [=>]30.1 | \[ \color{blue}{\frac{0.25}{d} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d}}
\] |
associate-*r* [=>]29.7 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{d}
\] |
*-commutative [=>]29.7 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}}{d}
\] |
unpow2 [=>]29.7 | \[ \frac{0.25}{d} \cdot \frac{h \cdot \left(\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}\right)}{d}
\] |
unpow2 [=>]29.7 | \[ \frac{0.25}{d} \cdot \frac{h \cdot \left(\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}\right)}{d}
\] |
unswap-sqr [=>]20.5 | \[ \frac{0.25}{d} \cdot \frac{h \cdot \color{blue}{\left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right)}}{d}
\] |
Applied egg-rr14.2
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 49.2
Simplified49.7
[Start]49.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 [=>]50.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-neg [=>]50.7 | \[ \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.7 | \[ \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.7 | \[ \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 55.2
Simplified53.1
[Start]55.2 | \[ \frac{{d}^{2} \cdot {c0}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)}
\] |
|---|---|
times-frac [=>]56.7 | \[ \color{blue}{\frac{{d}^{2}}{{D}^{2}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}}
\] |
unpow2 [=>]56.7 | \[ \frac{\color{blue}{d \cdot d}}{{D}^{2}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}
\] |
unpow2 [=>]56.7 | \[ \frac{d \cdot d}{\color{blue}{D \cdot D}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}
\] |
associate-/r* [=>]54.5 | \[ \color{blue}{\frac{\frac{d \cdot d}{D}}{D}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}
\] |
associate-*r/ [<=]53.9 | \[ \frac{\color{blue}{d \cdot \frac{d}{D}}}{D} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}
\] |
associate-*l/ [<=]53.1 | \[ \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}
\] |
unpow2 [<=]53.1 | \[ \color{blue}{{\left(\frac{d}{D}\right)}^{2}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}
\] |
unpow2 [=>]53.1 | \[ {\left(\frac{d}{D}\right)}^{2} \cdot \frac{\color{blue}{c0 \cdot c0}}{{w}^{2} \cdot h}
\] |
*-commutative [=>]53.1 | \[ {\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0 \cdot c0}{\color{blue}{h \cdot {w}^{2}}}
\] |
unpow2 [=>]53.1 | \[ {\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0 \cdot c0}{h \cdot \color{blue}{\left(w \cdot w\right)}}
\] |
Applied egg-rr34.3
Simplified20.0
[Start]34.3 | \[ e^{\mathsf{log1p}\left({\left(\frac{d}{D} \cdot \frac{c0}{w \cdot \sqrt{h}}\right)}^{2}\right)} - 1
\] |
|---|---|
expm1-def [=>]21.9 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\frac{d}{D} \cdot \frac{c0}{w \cdot \sqrt{h}}\right)}^{2}\right)\right)}
\] |
expm1-log1p [=>]19.6 | \[ \color{blue}{{\left(\frac{d}{D} \cdot \frac{c0}{w \cdot \sqrt{h}}\right)}^{2}}
\] |
associate-/r* [=>]20.0 | \[ {\left(\frac{d}{D} \cdot \color{blue}{\frac{\frac{c0}{w}}{\sqrt{h}}}\right)}^{2}
\] |
Final simplification15.2
| Alternative 1 | |
|---|---|
| Error | 15.1 |
| Cost | 42637 |
| Alternative 2 | |
|---|---|
| Error | 16.0 |
| Cost | 30541 |
| Alternative 3 | |
|---|---|
| Error | 24.4 |
| Cost | 1481 |
| Alternative 4 | |
|---|---|
| Error | 21.4 |
| Cost | 1225 |
| Alternative 5 | |
|---|---|
| Error | 18.7 |
| Cost | 1225 |
| Alternative 6 | |
|---|---|
| Error | 21.8 |
| Cost | 1224 |
| Alternative 7 | |
|---|---|
| Error | 25.4 |
| Cost | 960 |
| Alternative 8 | |
|---|---|
| Error | 23.0 |
| Cost | 960 |
| Alternative 9 | |
|---|---|
| Error | 31.8 |
| Cost | 64 |
herbie shell --seed 2023037
(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))))))