| Alternative 1 | |
|---|---|
| Error | 61.2% |
| Cost | 2264.00 |
(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 44.0
Simplified32.5
[Start]44.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 [=>]32.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 [=>]28.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 [=>]27.4 | \[ \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 [=>]27.4 | \[ \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-rr39.1
Simplified39.0
[Start]39.1 | \[ \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- [=>]39.1 | \[ \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 [<=]39.1 | \[ \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 [<=]39.1 | \[ \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+ [<=]39.1 | \[ \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 [<=]39.1 | \[ \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 [=>]39.1 | \[ \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 [=>]39.1 | \[ \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 [=>]39.1 | \[ \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* [=>]39.0 | \[ \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-rr37.5
Applied egg-rr47.0
Simplified44.1
[Start]47.0 | \[ \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 [=>]47.0 | \[ \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* [=>]42.8 | \[ \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/ [=>]43.0 | \[ \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 [=>]44.1 | \[ \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/ [=>]44.1 | \[ \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 [=>]44.1 | \[ \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 [<=]44.1 | \[ \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 [=>]44.1 | \[ \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 [<=]44.1 | \[ \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 [=>]44.1 | \[ \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 [=>]44.1 | \[ \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 [=>]44.1 | \[ \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 [=>]44.1 | \[ \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 0.3
Simplified0.6
[Start]0.3 | \[ \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/ [<=]0.3 | \[ \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 [=>]0.3 | \[ \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 [=>]0.3 | \[ \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* [=>]0.3 | \[ \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* [=>]0.3 | \[ \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* [=>]0.3 | \[ \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 [=>]0.3 | \[ \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 2.3
Simplified45.1
[Start]2.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 [=>]2.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)}
\] |
Applied egg-rr34.4
Simplified36.0
[Start]34.4 | \[ \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 [<=]34.4 | \[ \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* [=>]36.0 | \[ \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/ [=>]36.0 | \[ \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 [=>]36.0 | \[ \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-rr36.3
Simplified36.4
[Start]36.3 | \[ \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 [=>]36.3 | \[ \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* [=>]36.3 | \[ \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/ [=>]36.3 | \[ \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/ [<=]36.2 | \[ \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* [=>]36.2 | \[ \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 [=>]36.2 | \[ \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 [=>]36.2 | \[ \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 [=>]36.2 | \[ \frac{\color{blue}{0.25}}{\frac{w}{{\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}}
\] |
metadata-eval [<=]36.2 | \[ \frac{\color{blue}{\frac{-0.5}{-2}}}{\frac{w}{{\left(\frac{D}{\frac{\frac{d}{M}}{\sqrt{w \cdot h}}}\right)}^{2}}}
\] |
metadata-eval [<=]36.2 | \[ \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 [<=]36.2 | \[ \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/ [<=]36.2 | \[ \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* [<=]36.2 | \[ \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* [<=]36.3 | \[ \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/ [<=]36.3 | \[ \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-rr52.5
Simplified73.2
[Start]52.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 [=>]61.4 | \[ 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 [=>]64.5 | \[ 0.25 \cdot \color{blue}{\left({\left(D \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h \cdot w}{w}\right)}
\] |
*-commutative [=>]64.5 | \[ 0.25 \cdot \color{blue}{\left(\frac{h \cdot w}{w} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)}
\] |
*-rgt-identity [<=]64.5 | \[ 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/ [=>]64.5 | \[ 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/ [<=]64.5 | \[ 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* [=>]73.2 | \[ 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* [=>]73.2 | \[ 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 [=>]73.2 | \[ 0.25 \cdot \left(h \cdot \left(\color{blue}{1} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right)\right)
\] |
*-lft-identity [=>]73.2 | \[ 0.25 \cdot \left(h \cdot \color{blue}{{\left(D \cdot \frac{M}{d}\right)}^{2}}\right)
\] |
associate-*r/ [=>]73.2 | \[ 0.25 \cdot \left(h \cdot {\color{blue}{\left(\frac{D \cdot M}{d}\right)}}^{2}\right)
\] |
associate-/l* [=>]73.2 | \[ 0.25 \cdot \left(h \cdot {\color{blue}{\left(\frac{D}{\frac{d}{M}}\right)}}^{2}\right)
\] |
Final simplification69.2
| Alternative 1 | |
|---|---|
| Error | 61.2% |
| Cost | 2264.00 |
| Alternative 2 | |
|---|---|
| Error | 61.7% |
| Cost | 1617.00 |
| Alternative 3 | |
|---|---|
| Error | 54.8% |
| Cost | 1356.00 |
| Alternative 4 | |
|---|---|
| Error | 53.0% |
| Cost | 1224.00 |
| Alternative 5 | |
|---|---|
| Error | 55.7% |
| Cost | 1220.00 |
| Alternative 6 | |
|---|---|
| Error | 50.5% |
| Cost | 64.00 |
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))))))