| Alternative 1 | |
|---|---|
| Error | 38.76% |
| Cost | 2264 |
(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 (* 2.0 w))) (t_1 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
(if (<= (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M))))) 5e+172)
(* t_0 (- (/ (* (/ d (/ w c0)) (/ 2.0 h)) (* D (/ D d))) M))
(* 0.25 (* h (pow (/ D (/ d M)) 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 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= 5e+172) {
tmp = t_0 * ((((d / (w / c0)) * (2.0 / h)) / (D * (D / d))) - M);
} else {
tmp = 0.25 * (h * pow((D / (d / M)), 2.0));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = (c0 / (2.0d0 * w)) * (((c0 * (d_1 * d_1)) / ((w * h) * (d * d))) + sqrt(((((c0 * (d_1 * d_1)) / ((w * h) * (d * d))) * ((c0 * (d_1 * d_1)) / ((w * h) * (d * d)))) - (m * m))))
end function
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = c0 / (2.0d0 * w)
t_1 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (m * m))))) <= 5d+172) then
tmp = t_0 * ((((d_1 / (w / c0)) * (2.0d0 / h)) / (d * (d / d_1))) - m)
else
tmp = 0.25d0 * (h * ((d / (d_1 / m)) ** 2.0d0))
end if
code = tmp
end function
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 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double tmp;
if ((t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))))) <= 5e+172) {
tmp = t_0 * ((((d / (w / c0)) * (2.0 / h)) / (D * (D / d))) - M);
} else {
tmp = 0.25 * (h * Math.pow((D / (d / M)), 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 / (2.0 * w) t_1 = (c0 * (d * d)) / ((w * h) * (D * D)) tmp = 0 if (t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M * M))))) <= 5e+172: tmp = t_0 * ((((d / (w / c0)) * (2.0 / h)) / (D * (D / d))) - M) else: tmp = 0.25 * (h * math.pow((D / (d / M)), 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(c0 / Float64(2.0 * w)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) tmp = 0.0 if (Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) <= 5e+172) tmp = Float64(t_0 * Float64(Float64(Float64(Float64(d / Float64(w / c0)) * Float64(2.0 / h)) / Float64(D * Float64(D / d))) - M)); else tmp = Float64(0.25 * Float64(h * (Float64(D / Float64(d / M)) ^ 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 / (2.0 * w); t_1 = (c0 * (d * d)) / ((w * h) * (D * D)); tmp = 0.0; if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))))) <= 5e+172) tmp = t_0 * ((((d / (w / c0)) * (2.0 / h)) / (D * (D / d))) - M); else tmp = 0.25 * (h * ((D / (d / M)) ^ 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[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+172], N[(t$95$0 * N[(N[(N[(N[(d / N[(w / c0), $MachinePrecision]), $MachinePrecision] * N[(2.0 / h), $MachinePrecision]), $MachinePrecision] / N[(D * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(h * N[Power[N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision], 2.0], $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}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\mathbf{if}\;t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right) \leq 5 \cdot 10^{+172}:\\
\;\;\;\;t_0 \cdot \left(\frac{\frac{d}{\frac{w}{c0}} \cdot \frac{2}{h}}{D \cdot \frac{D}{d}} - M\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(h \cdot {\left(\frac{D}{\frac{d}{M}}\right)}^{2}\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))))) < 5.0000000000000001e172Initial program 56
Simplified67.53
[Start]56 | \[ \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 [=>]67.35 | \[ \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 [=>]71.25 | \[ \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 [=>]72.56 | \[ \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 [=>]72.56 | \[ \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)
\] |
Applied egg-rr60.88
Simplified60.97
[Start]60.88 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - \left(M - \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)
\] |
|---|---|
associate--r- [=>]60.88 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M\right) + \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)}
\] |
+-commutative [<=]60.88 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M\right)\right)}
\] |
*-rgt-identity [<=]60.88 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \cdot 1} + \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} - M\right)\right)
\] |
associate--l+ [<=]60.88 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\left(\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \cdot 1 + \frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) - M\right)}
\] |
*-rgt-identity [<=]60.88 | \[ \frac{c0}{2 \cdot w} \cdot \left(\left(\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \cdot 1 + \color{blue}{\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \cdot 1}\right) - M\right)
\] |
distribute-lft-out [=>]60.88 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \cdot \left(1 + 1\right)} - M\right)
\] |
*-commutative [=>]60.88 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h}\right)} \cdot \left(1 + 1\right) - M\right)
\] |
metadata-eval [=>]60.88 | \[ \frac{c0}{2 \cdot w} \cdot \left(\left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h}\right) \cdot \color{blue}{2} - M\right)
\] |
associate-*l* [=>]60.97 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{{\left(\frac{d}{D}\right)}^{2} \cdot \left(\frac{c0}{w \cdot h} \cdot 2\right)} - M\right)
\] |
Applied egg-rr62.52
Applied egg-rr52.97
Simplified55.85
[Start]52.97 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{-d}{D} \cdot \left(d \cdot \frac{2}{\frac{w}{c0} \cdot h}\right)}{-D} - M\right)
\] |
|---|---|
*-commutative [=>]52.97 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\color{blue}{\left(d \cdot \frac{2}{\frac{w}{c0} \cdot h}\right) \cdot \frac{-d}{D}}}{-D} - M\right)
\] |
associate-/l* [=>]57.25 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{d \cdot \frac{2}{\frac{w}{c0} \cdot h}}{\frac{-D}{\frac{-d}{D}}}} - M\right)
\] |
associate-*r/ [=>]57.05 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\color{blue}{\frac{d \cdot 2}{\frac{w}{c0} \cdot h}}}{\frac{-D}{\frac{-d}{D}}} - M\right)
\] |
times-frac [=>]55.86 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\color{blue}{\frac{d}{\frac{w}{c0}} \cdot \frac{2}{h}}}{\frac{-D}{\frac{-d}{D}}} - M\right)
\] |
associate-/r/ [=>]55.85 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{d}{\frac{w}{c0}} \cdot \frac{2}{h}}{\color{blue}{\frac{-D}{-d} \cdot D}} - M\right)
\] |
neg-mul-1 [=>]55.85 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{d}{\frac{w}{c0}} \cdot \frac{2}{h}}{\frac{\color{blue}{-1 \cdot D}}{-d} \cdot D} - M\right)
\] |
metadata-eval [<=]55.85 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{d}{\frac{w}{c0}} \cdot \frac{2}{h}}{\frac{\color{blue}{\left(-1\right)} \cdot D}{-d} \cdot D} - M\right)
\] |
neg-mul-1 [=>]55.85 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{d}{\frac{w}{c0}} \cdot \frac{2}{h}}{\frac{\left(-1\right) \cdot D}{\color{blue}{-1 \cdot d}} \cdot D} - M\right)
\] |
metadata-eval [<=]55.85 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{d}{\frac{w}{c0}} \cdot \frac{2}{h}}{\frac{\left(-1\right) \cdot D}{\color{blue}{\left(-1\right)} \cdot d} \cdot D} - M\right)
\] |
times-frac [=>]55.85 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{d}{\frac{w}{c0}} \cdot \frac{2}{h}}{\color{blue}{\left(\frac{-1}{-1} \cdot \frac{D}{d}\right)} \cdot D} - M\right)
\] |
metadata-eval [=>]55.85 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{d}{\frac{w}{c0}} \cdot \frac{2}{h}}{\left(\frac{\color{blue}{-1}}{-1} \cdot \frac{D}{d}\right) \cdot D} - M\right)
\] |
metadata-eval [=>]55.85 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{d}{\frac{w}{c0}} \cdot \frac{2}{h}}{\left(\frac{-1}{\color{blue}{-1}} \cdot \frac{D}{d}\right) \cdot D} - M\right)
\] |
metadata-eval [=>]55.85 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{\frac{d}{\frac{w}{c0}} \cdot \frac{2}{h}}{\left(\color{blue}{1} \cdot \frac{D}{d}\right) \cdot D} - M\right)
\] |
if 5.0000000000000001e172 < (*.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 99.69
Simplified99.36
[Start]99.69 | \[ \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/ [<=]99.72 | \[ \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 [=>]99.72 | \[ \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 [=>]99.72 | \[ \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* [=>]99.73 | \[ \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* [=>]99.73 | \[ \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* [=>]99.73 | \[ \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 [=>]99.73 | \[ \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 97.73
Simplified54.95
[Start]97.73 | \[ \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 [=>]97.73 | \[ \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)}
\] |
Applied egg-rr65.56
Simplified64.01
[Start]65.56 | \[ \frac{\left(\frac{0.5}{c0} \cdot {\left(\frac{\sqrt{w \cdot h} \cdot M}{\frac{d}{D}}\right)}^{2}\right) \cdot \left(-c0\right)}{w \cdot -2}
\] |
|---|---|
*-commutative [<=]65.56 | \[ \frac{\color{blue}{\left(-c0\right) \cdot \left(\frac{0.5}{c0} \cdot {\left(\frac{\sqrt{w \cdot h} \cdot M}{\frac{d}{D}}\right)}^{2}\right)}}{w \cdot -2}
\] |
associate-*r* [=>]64.02 | \[ \frac{\color{blue}{\left(\left(-c0\right) \cdot \frac{0.5}{c0}\right) \cdot {\left(\frac{\sqrt{w \cdot h} \cdot M}{\frac{d}{D}}\right)}^{2}}}{w \cdot -2}
\] |
associate-/r/ [=>]64.01 | \[ \frac{\left(\left(-c0\right) \cdot \frac{0.5}{c0}\right) \cdot {\color{blue}{\left(\frac{\sqrt{w \cdot h} \cdot M}{d} \cdot D\right)}}^{2}}{w \cdot -2}
\] |
*-commutative [=>]64.01 | \[ \frac{\left(\left(-c0\right) \cdot \frac{0.5}{c0}\right) \cdot {\left(\frac{\color{blue}{M \cdot \sqrt{w \cdot h}}}{d} \cdot D\right)}^{2}}{w \cdot -2}
\] |
Applied egg-rr63.74
Simplified63.58
[Start]63.74 | \[ \frac{-0.5 \cdot c0}{c0} \cdot \left({\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2} \cdot \frac{-0.5}{w}\right)
\] |
|---|---|
*-commutative [=>]63.74 | \[ \frac{-0.5 \cdot c0}{c0} \cdot \color{blue}{\left(\frac{-0.5}{w} \cdot {\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}\right)}
\] |
associate-*r* [=>]63.73 | \[ \color{blue}{\left(\frac{-0.5 \cdot c0}{c0} \cdot \frac{-0.5}{w}\right) \cdot {\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}
\] |
associate-*r/ [=>]63.73 | \[ \color{blue}{\frac{\frac{-0.5 \cdot c0}{c0} \cdot -0.5}{w}} \cdot {\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}
\] |
associate-/r/ [<=]63.79 | \[ \color{blue}{\frac{\frac{-0.5 \cdot c0}{c0} \cdot -0.5}{\frac{w}{{\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}}}
\] |
associate-/l* [=>]63.79 | \[ \frac{\color{blue}{\frac{-0.5}{\frac{c0}{c0}}} \cdot -0.5}{\frac{w}{{\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}}
\] |
*-inverses [=>]63.79 | \[ \frac{\frac{-0.5}{\color{blue}{1}} \cdot -0.5}{\frac{w}{{\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}}
\] |
metadata-eval [=>]63.79 | \[ \frac{\color{blue}{-0.5} \cdot -0.5}{\frac{w}{{\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}}
\] |
metadata-eval [=>]63.79 | \[ \frac{\color{blue}{0.25}}{\frac{w}{{\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}}
\] |
metadata-eval [<=]63.79 | \[ \frac{\color{blue}{\frac{-0.5}{-2}}}{\frac{w}{{\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}}
\] |
metadata-eval [<=]63.79 | \[ \frac{\frac{-0.5}{\color{blue}{-2 \cdot 1}}}{\frac{w}{{\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}}
\] |
*-inverses [<=]63.79 | \[ \frac{\frac{-0.5}{-2 \cdot \color{blue}{\frac{c0}{c0}}}}{\frac{w}{{\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}}
\] |
associate-/l/ [<=]63.79 | \[ \frac{\color{blue}{\frac{\frac{-0.5}{\frac{c0}{c0}}}{-2}}}{\frac{w}{{\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}}
\] |
associate-/l* [<=]63.79 | \[ \frac{\frac{\color{blue}{\frac{-0.5 \cdot c0}{c0}}}{-2}}{\frac{w}{{\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}}
\] |
associate-/l* [<=]63.73 | \[ \color{blue}{\frac{\frac{\frac{-0.5 \cdot c0}{c0}}{-2} \cdot {\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}{w}}
\] |
associate-*r/ [<=]63.74 | \[ \color{blue}{\frac{\frac{-0.5 \cdot c0}{c0}}{-2} \cdot \frac{{\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}{w}}
\] |
Applied egg-rr47.5
Simplified26.78
[Start]47.5 | \[ 0.25 \cdot \left(e^{\mathsf{log1p}\left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h \cdot w}{w}\right)} - 1\right)
\] |
|---|---|
expm1-def [=>]38.56 | \[ 0.25 \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h \cdot w}{w}\right)\right)}
\] |
expm1-log1p [=>]35.52 | \[ 0.25 \cdot \color{blue}{\left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h \cdot w}{w}\right)}
\] |
*-commutative [=>]35.52 | \[ 0.25 \cdot \color{blue}{\left(\frac{h \cdot w}{w} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)}
\] |
*-rgt-identity [<=]35.52 | \[ 0.25 \cdot \left(\color{blue}{\left(\frac{h \cdot w}{w} \cdot 1\right)} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)
\] |
associate-*l/ [=>]35.52 | \[ 0.25 \cdot \left(\color{blue}{\frac{\left(h \cdot w\right) \cdot 1}{w}} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)
\] |
associate-*r/ [<=]35.54 | \[ 0.25 \cdot \left(\color{blue}{\left(\left(h \cdot w\right) \cdot \frac{1}{w}\right)} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)
\] |
associate-*l* [=>]26.85 | \[ 0.25 \cdot \left(\color{blue}{\left(h \cdot \left(w \cdot \frac{1}{w}\right)\right)} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)
\] |
associate-*l* [=>]26.85 | \[ 0.25 \cdot \color{blue}{\left(h \cdot \left(\left(w \cdot \frac{1}{w}\right) \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)\right)}
\] |
rgt-mult-inverse [=>]26.81 | \[ 0.25 \cdot \left(h \cdot \left(\color{blue}{1} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)\right)
\] |
*-lft-identity [=>]26.81 | \[ 0.25 \cdot \left(h \cdot \color{blue}{{\left(D \cdot \frac{M}{d}\right)}^{2}}\right)
\] |
associate-*r/ [=>]26.78 | \[ 0.25 \cdot \left(h \cdot {\color{blue}{\left(\frac{D \cdot M}{d}\right)}}^{2}\right)
\] |
associate-/l* [=>]26.78 | \[ 0.25 \cdot \left(h \cdot {\color{blue}{\left(\frac{D}{\frac{d}{M}}\right)}}^{2}\right)
\] |
Final simplification30.78
| Alternative 1 | |
|---|---|
| Error | 38.76% |
| Cost | 2264 |
| Alternative 2 | |
|---|---|
| Error | 38.28% |
| Cost | 1617 |
| Alternative 3 | |
|---|---|
| Error | 45.22% |
| Cost | 1356 |
| Alternative 4 | |
|---|---|
| Error | 47.01% |
| Cost | 1224 |
| Alternative 5 | |
|---|---|
| Error | 44.27% |
| Cost | 1220 |
| Alternative 6 | |
|---|---|
| Error | 49.48% |
| Cost | 64 |
herbie shell --seed 2023093
(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))))))