| Alternative 1 | |
|---|---|
| Error | 27.2 |
| Cost | 1220 |
(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 (* (/ 0.25 d) (* (/ D (/ d M)) (* M (* D h))))))
(if (<= D -2e-304)
t_0
(if (<= D 5e-248)
(/ (* M (* D (* M h))) (* (* d 4.0) (/ d D)))
(if (<= D 4.3e-45)
t_0
(* (* D (/ M (/ d D))) (/ M (/ (* d 4.0) h))))))))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 = (0.25 / d) * ((D / (d / M)) * (M * (D * h)));
double tmp;
if (D <= -2e-304) {
tmp = t_0;
} else if (D <= 5e-248) {
tmp = (M * (D * (M * h))) / ((d * 4.0) * (d / D));
} else if (D <= 4.3e-45) {
tmp = t_0;
} else {
tmp = (D * (M / (d / D))) * (M / ((d * 4.0) / h));
}
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) :: tmp
t_0 = (0.25d0 / d_1) * ((d / (d_1 / m)) * (m * (d * h)))
if (d <= (-2d-304)) then
tmp = t_0
else if (d <= 5d-248) then
tmp = (m * (d * (m * h))) / ((d_1 * 4.0d0) * (d_1 / d))
else if (d <= 4.3d-45) then
tmp = t_0
else
tmp = (d * (m / (d_1 / d))) * (m / ((d_1 * 4.0d0) / h))
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 = (0.25 / d) * ((D / (d / M)) * (M * (D * h)));
double tmp;
if (D <= -2e-304) {
tmp = t_0;
} else if (D <= 5e-248) {
tmp = (M * (D * (M * h))) / ((d * 4.0) * (d / D));
} else if (D <= 4.3e-45) {
tmp = t_0;
} else {
tmp = (D * (M / (d / D))) * (M / ((d * 4.0) / h));
}
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 = (0.25 / d) * ((D / (d / M)) * (M * (D * h))) tmp = 0 if D <= -2e-304: tmp = t_0 elif D <= 5e-248: tmp = (M * (D * (M * h))) / ((d * 4.0) * (d / D)) elif D <= 4.3e-45: tmp = t_0 else: tmp = (D * (M / (d / D))) * (M / ((d * 4.0) / h)) 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(0.25 / d) * Float64(Float64(D / Float64(d / M)) * Float64(M * Float64(D * h)))) tmp = 0.0 if (D <= -2e-304) tmp = t_0; elseif (D <= 5e-248) tmp = Float64(Float64(M * Float64(D * Float64(M * h))) / Float64(Float64(d * 4.0) * Float64(d / D))); elseif (D <= 4.3e-45) tmp = t_0; else tmp = Float64(Float64(D * Float64(M / Float64(d / D))) * Float64(M / Float64(Float64(d * 4.0) / h))); 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 = (0.25 / d) * ((D / (d / M)) * (M * (D * h))); tmp = 0.0; if (D <= -2e-304) tmp = t_0; elseif (D <= 5e-248) tmp = (M * (D * (M * h))) / ((d * 4.0) * (d / D)); elseif (D <= 4.3e-45) tmp = t_0; else tmp = (D * (M / (d / D))) * (M / ((d * 4.0) / h)); 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[(0.25 / d), $MachinePrecision] * N[(N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision] * N[(M * N[(D * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, -2e-304], t$95$0, If[LessEqual[D, 5e-248], N[(N[(M * N[(D * N[(M * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(d * 4.0), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 4.3e-45], t$95$0, N[(N[(D * N[(M / N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(M / N[(N[(d * 4.0), $MachinePrecision] / h), $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{0.25}{d} \cdot \left(\frac{D}{\frac{d}{M}} \cdot \left(M \cdot \left(D \cdot h\right)\right)\right)\\
\mathbf{if}\;D \leq -2 \cdot 10^{-304}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;D \leq 5 \cdot 10^{-248}:\\
\;\;\;\;\frac{M \cdot \left(D \cdot \left(M \cdot h\right)\right)}{\left(d \cdot 4\right) \cdot \frac{d}{D}}\\
\mathbf{elif}\;D \leq 4.3 \cdot 10^{-45}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(D \cdot \frac{M}{\frac{d}{D}}\right) \cdot \frac{M}{\frac{d \cdot 4}{h}}\\
\end{array}
Results
if D < -1.99999999999999994e-304 or 5.0000000000000001e-248 < D < 4.2999999999999999e-45Initial program 59.7
Simplified62.0
[Start]59.7 | \[ \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/ [<=]60.2 | \[ \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 [=>]60.2 | \[ \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 [=>]60.8 | \[ \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)}
\] |
Taylor expanded in c0 around -inf 59.7
Simplified36.3
[Start]59.7 | \[ \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 [=>]59.7 | \[ \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 34.9
Simplified30.1
[Start]34.9 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}
\] |
|---|---|
associate-*r/ [=>]34.9 | \[ \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left(h \cdot {M}^{2}\right)\right)}{{d}^{2}}}
\] |
*-commutative [=>]34.9 | \[ \frac{0.25 \cdot \left({D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}\right)}{{d}^{2}}
\] |
unpow2 [=>]34.9 | \[ \frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{d \cdot d}}
\] |
times-frac [=>]32.3 | \[ \color{blue}{\frac{0.25}{d} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d}}
\] |
unpow2 [=>]32.3 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot \left({M}^{2} \cdot h\right)}{d}
\] |
unpow2 [=>]32.3 | \[ \frac{0.25}{d} \cdot \frac{\left(D \cdot D\right) \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)}{d}
\] |
*-commutative [<=]32.3 | \[ \frac{0.25}{d} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(h \cdot \left(M \cdot M\right)\right)}}{d}
\] |
*-commutative [<=]32.3 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{\left(h \cdot \left(M \cdot M\right)\right) \cdot \left(D \cdot D\right)}}{d}
\] |
associate-*r* [=>]30.1 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{\left(\left(h \cdot M\right) \cdot M\right)} \cdot \left(D \cdot D\right)}{d}
\] |
*-commutative [=>]30.1 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{\left(M \cdot \left(h \cdot M\right)\right)} \cdot \left(D \cdot D\right)}{d}
\] |
Taylor expanded in M around 0 32.3
Simplified21.0
[Start]32.3 | \[ \frac{0.25}{d} \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{d}
\] |
|---|---|
unpow2 [=>]32.3 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot \left(h \cdot {M}^{2}\right)}{d}
\] |
*-commutative [<=]32.3 | \[ \frac{0.25}{d} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left({M}^{2} \cdot h\right)}}{d}
\] |
unpow2 [=>]32.3 | \[ \frac{0.25}{d} \cdot \frac{\left(D \cdot D\right) \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)}{d}
\] |
associate-*r* [<=]30.1 | \[ \frac{0.25}{d} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot \left(M \cdot h\right)\right)}}{d}
\] |
associate-/l* [=>]29.4 | \[ \frac{0.25}{d} \cdot \color{blue}{\frac{D \cdot D}{\frac{d}{M \cdot \left(M \cdot h\right)}}}
\] |
associate-/l* [=>]26.2 | \[ \frac{0.25}{d} \cdot \color{blue}{\frac{D}{\frac{\frac{d}{M \cdot \left(M \cdot h\right)}}{D}}}
\] |
*-lft-identity [<=]26.2 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{1 \cdot D}}{\frac{\frac{d}{M \cdot \left(M \cdot h\right)}}{D}}
\] |
associate-/r* [<=]25.1 | \[ \frac{0.25}{d} \cdot \frac{1 \cdot D}{\color{blue}{\frac{d}{\left(M \cdot \left(M \cdot h\right)\right) \cdot D}}}
\] |
associate-*r* [<=]22.5 | \[ \frac{0.25}{d} \cdot \frac{1 \cdot D}{\frac{d}{\color{blue}{M \cdot \left(\left(M \cdot h\right) \cdot D\right)}}}
\] |
*-commutative [<=]22.5 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{D \cdot 1}}{\frac{d}{M \cdot \left(\left(M \cdot h\right) \cdot D\right)}}
\] |
associate-/r* [=>]22.0 | \[ \frac{0.25}{d} \cdot \frac{D \cdot 1}{\color{blue}{\frac{\frac{d}{M}}{\left(M \cdot h\right) \cdot D}}}
\] |
associate-/r/ [=>]21.8 | \[ \frac{0.25}{d} \cdot \color{blue}{\left(\frac{D \cdot 1}{\frac{d}{M}} \cdot \left(\left(M \cdot h\right) \cdot D\right)\right)}
\] |
*-rgt-identity [=>]21.8 | \[ \frac{0.25}{d} \cdot \left(\frac{\color{blue}{D}}{\frac{d}{M}} \cdot \left(\left(M \cdot h\right) \cdot D\right)\right)
\] |
associate-*l* [=>]21.0 | \[ \frac{0.25}{d} \cdot \left(\frac{D}{\frac{d}{M}} \cdot \color{blue}{\left(M \cdot \left(h \cdot D\right)\right)}\right)
\] |
*-commutative [=>]21.0 | \[ \frac{0.25}{d} \cdot \left(\frac{D}{\frac{d}{M}} \cdot \left(M \cdot \color{blue}{\left(D \cdot h\right)}\right)\right)
\] |
if -1.99999999999999994e-304 < D < 5.0000000000000001e-248Initial program 64.0
Simplified64.0
[Start]64.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)
\] |
|---|---|
associate-*l/ [<=]64.0 | \[ \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 [=>]64.0 | \[ \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 [=>]64.0 | \[ \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)}
\] |
Taylor expanded in c0 around -inf 64.0
Simplified31.2
[Start]64.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 [=>]64.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.6
Simplified26.5
[Start]33.6 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}
\] |
|---|---|
associate-*r/ [=>]33.6 | \[ \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left(h \cdot {M}^{2}\right)\right)}{{d}^{2}}}
\] |
*-commutative [=>]33.6 | \[ \frac{0.25 \cdot \left({D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}\right)}{{d}^{2}}
\] |
unpow2 [=>]33.6 | \[ \frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{d \cdot d}}
\] |
times-frac [=>]28.2 | \[ \color{blue}{\frac{0.25}{d} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d}}
\] |
unpow2 [=>]28.2 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot \left({M}^{2} \cdot h\right)}{d}
\] |
unpow2 [=>]28.2 | \[ \frac{0.25}{d} \cdot \frac{\left(D \cdot D\right) \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)}{d}
\] |
*-commutative [<=]28.2 | \[ \frac{0.25}{d} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(h \cdot \left(M \cdot M\right)\right)}}{d}
\] |
*-commutative [<=]28.2 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{\left(h \cdot \left(M \cdot M\right)\right) \cdot \left(D \cdot D\right)}}{d}
\] |
associate-*r* [=>]26.5 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{\left(\left(h \cdot M\right) \cdot M\right)} \cdot \left(D \cdot D\right)}{d}
\] |
*-commutative [=>]26.5 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{\left(M \cdot \left(h \cdot M\right)\right)} \cdot \left(D \cdot D\right)}{d}
\] |
Applied egg-rr18.4
if 4.2999999999999999e-45 < D Initial program 56.9
Simplified60.0
[Start]56.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)
\] |
|---|---|
associate-*l/ [<=]57.5 | \[ \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 [=>]57.5 | \[ \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 [=>]58.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)}
\] |
Taylor expanded in c0 around -inf 57.7
Simplified38.4
[Start]57.7 | \[ \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 [=>]57.7 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)}
\] |
Taylor expanded in c0 around 0 40.5
Simplified37.2
[Start]40.5 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}
\] |
|---|---|
associate-*r/ [=>]40.5 | \[ \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left(h \cdot {M}^{2}\right)\right)}{{d}^{2}}}
\] |
*-commutative [=>]40.5 | \[ \frac{0.25 \cdot \left({D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}\right)}{{d}^{2}}
\] |
unpow2 [=>]40.5 | \[ \frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{d \cdot d}}
\] |
times-frac [=>]38.8 | \[ \color{blue}{\frac{0.25}{d} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d}}
\] |
unpow2 [=>]38.8 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{\left(D \cdot D\right)} \cdot \left({M}^{2} \cdot h\right)}{d}
\] |
unpow2 [=>]38.8 | \[ \frac{0.25}{d} \cdot \frac{\left(D \cdot D\right) \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)}{d}
\] |
*-commutative [<=]38.8 | \[ \frac{0.25}{d} \cdot \frac{\left(D \cdot D\right) \cdot \color{blue}{\left(h \cdot \left(M \cdot M\right)\right)}}{d}
\] |
*-commutative [<=]38.8 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{\left(h \cdot \left(M \cdot M\right)\right) \cdot \left(D \cdot D\right)}}{d}
\] |
associate-*r* [=>]37.2 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{\left(\left(h \cdot M\right) \cdot M\right)} \cdot \left(D \cdot D\right)}{d}
\] |
*-commutative [=>]37.2 | \[ \frac{0.25}{d} \cdot \frac{\color{blue}{\left(M \cdot \left(h \cdot M\right)\right)} \cdot \left(D \cdot D\right)}{d}
\] |
Applied egg-rr35.4
Simplified24.2
[Start]35.4 | \[ \frac{M}{\left(d \cdot 4\right) \cdot \frac{d}{M \cdot \left(h \cdot \left(D \cdot D\right)\right)}}
\] |
|---|---|
associate-*r/ [=>]38.4 | \[ \frac{M}{\color{blue}{\frac{\left(d \cdot 4\right) \cdot d}{M \cdot \left(h \cdot \left(D \cdot D\right)\right)}}}
\] |
associate-*r* [=>]37.5 | \[ \frac{M}{\frac{\left(d \cdot 4\right) \cdot d}{\color{blue}{\left(M \cdot h\right) \cdot \left(D \cdot D\right)}}}
\] |
associate-/l/ [<=]38.1 | \[ \frac{M}{\color{blue}{\frac{\frac{\left(d \cdot 4\right) \cdot d}{D \cdot D}}{M \cdot h}}}
\] |
associate-*r/ [<=]36.0 | \[ \frac{M}{\frac{\color{blue}{\left(d \cdot 4\right) \cdot \frac{d}{D \cdot D}}}{M \cdot h}}
\] |
associate-/l* [<=]37.4 | \[ \color{blue}{\frac{M \cdot \left(M \cdot h\right)}{\left(d \cdot 4\right) \cdot \frac{d}{D \cdot D}}}
\] |
*-commutative [=>]37.4 | \[ \frac{M \cdot \left(M \cdot h\right)}{\color{blue}{\frac{d}{D \cdot D} \cdot \left(d \cdot 4\right)}}
\] |
times-frac [=>]32.3 | \[ \color{blue}{\frac{M}{\frac{d}{D \cdot D}} \cdot \frac{M \cdot h}{d \cdot 4}}
\] |
associate-/r* [=>]26.0 | \[ \frac{M}{\color{blue}{\frac{\frac{d}{D}}{D}}} \cdot \frac{M \cdot h}{d \cdot 4}
\] |
associate-/r/ [=>]24.3 | \[ \color{blue}{\left(\frac{M}{\frac{d}{D}} \cdot D\right)} \cdot \frac{M \cdot h}{d \cdot 4}
\] |
associate-/l* [=>]24.2 | \[ \left(\frac{M}{\frac{d}{D}} \cdot D\right) \cdot \color{blue}{\frac{M}{\frac{d \cdot 4}{h}}}
\] |
Final simplification21.3
| Alternative 1 | |
|---|---|
| Error | 27.2 |
| Cost | 1220 |
| Alternative 2 | |
|---|---|
| Error | 21.4 |
| Cost | 1092 |
| Alternative 3 | |
|---|---|
| Error | 22.0 |
| Cost | 960 |
| Alternative 4 | |
|---|---|
| Error | 31.8 |
| Cost | 64 |
herbie shell --seed 2023067
(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))))))