| Alternative 1 | |
|---|---|
| Error | 20.4 |
| Cost | 1993 |
(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 (* M D)))
(t_1 (* 0.25 (* (/ (* M h) (/ d D)) (* D (/ M d))))))
(if (<= M -9.8e+51)
(* h (/ (* c0 (/ 0.25 c0)) (pow t_0 2.0)))
(if (<= M -1.75e-102)
t_1
(if (<= M 1.4e-214)
(* (/ 1.0 w) (* (/ w (* t_0 (/ t_0 h))) (* (/ 0.5 c0) (* c0 0.5))))
(if (<= M 5.1e-169)
(pow (* (/ d D) (/ c0 (* w (sqrt h)))) 2.0)
t_1))))))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 / (M * D);
double t_1 = 0.25 * (((M * h) / (d / D)) * (D * (M / d)));
double tmp;
if (M <= -9.8e+51) {
tmp = h * ((c0 * (0.25 / c0)) / pow(t_0, 2.0));
} else if (M <= -1.75e-102) {
tmp = t_1;
} else if (M <= 1.4e-214) {
tmp = (1.0 / w) * ((w / (t_0 * (t_0 / h))) * ((0.5 / c0) * (c0 * 0.5)));
} else if (M <= 5.1e-169) {
tmp = pow(((d / D) * (c0 / (w * sqrt(h)))), 2.0);
} else {
tmp = t_1;
}
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 = d_1 / (m * d)
t_1 = 0.25d0 * (((m * h) / (d_1 / d)) * (d * (m / d_1)))
if (m <= (-9.8d+51)) then
tmp = h * ((c0 * (0.25d0 / c0)) / (t_0 ** 2.0d0))
else if (m <= (-1.75d-102)) then
tmp = t_1
else if (m <= 1.4d-214) then
tmp = (1.0d0 / w) * ((w / (t_0 * (t_0 / h))) * ((0.5d0 / c0) * (c0 * 0.5d0)))
else if (m <= 5.1d-169) then
tmp = ((d_1 / d) * (c0 / (w * sqrt(h)))) ** 2.0d0
else
tmp = t_1
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 = d / (M * D);
double t_1 = 0.25 * (((M * h) / (d / D)) * (D * (M / d)));
double tmp;
if (M <= -9.8e+51) {
tmp = h * ((c0 * (0.25 / c0)) / Math.pow(t_0, 2.0));
} else if (M <= -1.75e-102) {
tmp = t_1;
} else if (M <= 1.4e-214) {
tmp = (1.0 / w) * ((w / (t_0 * (t_0 / h))) * ((0.5 / c0) * (c0 * 0.5)));
} else if (M <= 5.1e-169) {
tmp = Math.pow(((d / D) * (c0 / (w * Math.sqrt(h)))), 2.0);
} else {
tmp = t_1;
}
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 / (M * D) t_1 = 0.25 * (((M * h) / (d / D)) * (D * (M / d))) tmp = 0 if M <= -9.8e+51: tmp = h * ((c0 * (0.25 / c0)) / math.pow(t_0, 2.0)) elif M <= -1.75e-102: tmp = t_1 elif M <= 1.4e-214: tmp = (1.0 / w) * ((w / (t_0 * (t_0 / h))) * ((0.5 / c0) * (c0 * 0.5))) elif M <= 5.1e-169: tmp = math.pow(((d / D) * (c0 / (w * math.sqrt(h)))), 2.0) else: tmp = t_1 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(d / Float64(M * D)) t_1 = Float64(0.25 * Float64(Float64(Float64(M * h) / Float64(d / D)) * Float64(D * Float64(M / d)))) tmp = 0.0 if (M <= -9.8e+51) tmp = Float64(h * Float64(Float64(c0 * Float64(0.25 / c0)) / (t_0 ^ 2.0))); elseif (M <= -1.75e-102) tmp = t_1; elseif (M <= 1.4e-214) tmp = Float64(Float64(1.0 / w) * Float64(Float64(w / Float64(t_0 * Float64(t_0 / h))) * Float64(Float64(0.5 / c0) * Float64(c0 * 0.5)))); elseif (M <= 5.1e-169) tmp = Float64(Float64(d / D) * Float64(c0 / Float64(w * sqrt(h)))) ^ 2.0; else tmp = t_1; 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 / (M * D); t_1 = 0.25 * (((M * h) / (d / D)) * (D * (M / d))); tmp = 0.0; if (M <= -9.8e+51) tmp = h * ((c0 * (0.25 / c0)) / (t_0 ^ 2.0)); elseif (M <= -1.75e-102) tmp = t_1; elseif (M <= 1.4e-214) tmp = (1.0 / w) * ((w / (t_0 * (t_0 / h))) * ((0.5 / c0) * (c0 * 0.5))); elseif (M <= 5.1e-169) tmp = ((d / D) * (c0 / (w * sqrt(h)))) ^ 2.0; else tmp = t_1; 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[(d / N[(M * D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.25 * N[(N[(N[(M * h), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -9.8e+51], N[(h * N[(N[(c0 * N[(0.25 / c0), $MachinePrecision]), $MachinePrecision] / N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, -1.75e-102], t$95$1, If[LessEqual[M, 1.4e-214], N[(N[(1.0 / w), $MachinePrecision] * N[(N[(w / N[(t$95$0 * N[(t$95$0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 / c0), $MachinePrecision] * N[(c0 * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 5.1e-169], N[Power[N[(N[(d / D), $MachinePrecision] * N[(c0 / N[(w * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], t$95$1]]]]]]
\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{d}{M \cdot D}\\
t_1 := 0.25 \cdot \left(\frac{M \cdot h}{\frac{d}{D}} \cdot \left(D \cdot \frac{M}{d}\right)\right)\\
\mathbf{if}\;M \leq -9.8 \cdot 10^{+51}:\\
\;\;\;\;h \cdot \frac{c0 \cdot \frac{0.25}{c0}}{{t_0}^{2}}\\
\mathbf{elif}\;M \leq -1.75 \cdot 10^{-102}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;M \leq 1.4 \cdot 10^{-214}:\\
\;\;\;\;\frac{1}{w} \cdot \left(\frac{w}{t_0 \cdot \frac{t_0}{h}} \cdot \left(\frac{0.5}{c0} \cdot \left(c0 \cdot 0.5\right)\right)\right)\\
\mathbf{elif}\;M \leq 5.1 \cdot 10^{-169}:\\
\;\;\;\;{\left(\frac{d}{D} \cdot \frac{c0}{w \cdot \sqrt{h}}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
Results
if M < -9.79999999999999967e51Initial program 63.8
Simplified63.8
[Start]63.8 | \[ \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 [=>]63.9 | \[ \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 [=>]63.9 | \[ \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 [=>]63.9 | \[ \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 [=>]63.8 | \[ \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 63.4
Simplified52.4
[Start]63.4 | \[ \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 [=>]63.4 | \[ \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-rr46.4
Simplified46.5
[Start]46.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}
\] |
|---|---|
times-frac [=>]47.2 | \[ \color{blue}{\frac{\frac{0.5}{c0} \cdot {\left(\frac{\sqrt{w \cdot h} \cdot M}{\frac{d}{D}}\right)}^{2}}{w} \cdot \frac{-c0}{-2}}
\] |
*-commutative [=>]47.2 | \[ \frac{\color{blue}{{\left(\frac{\sqrt{w \cdot h} \cdot M}{\frac{d}{D}}\right)}^{2} \cdot \frac{0.5}{c0}}}{w} \cdot \frac{-c0}{-2}
\] |
associate-/l* [=>]46.5 | \[ \frac{{\color{blue}{\left(\frac{\sqrt{w \cdot h}}{\frac{\frac{d}{D}}{M}}\right)}}^{2} \cdot \frac{0.5}{c0}}{w} \cdot \frac{-c0}{-2}
\] |
Applied egg-rr28.6
Simplified24.9
[Start]28.6 | \[ \frac{1}{\frac{w}{\frac{w \cdot h}{{\left(\frac{d}{D \cdot M}\right)}^{2}} \cdot \left(\frac{0.5}{c0} \cdot \left(c0 \cdot 0.5\right)\right)}}
\] |
|---|---|
associate-/r/ [=>]28.5 | \[ \color{blue}{\frac{1}{w} \cdot \left(\frac{w \cdot h}{{\left(\frac{d}{D \cdot M}\right)}^{2}} \cdot \left(\frac{0.5}{c0} \cdot \left(c0 \cdot 0.5\right)\right)\right)}
\] |
associate-/l* [=>]24.9 | \[ \frac{1}{w} \cdot \left(\color{blue}{\frac{w}{\frac{{\left(\frac{d}{D \cdot M}\right)}^{2}}{h}}} \cdot \left(\frac{0.5}{c0} \cdot \left(c0 \cdot 0.5\right)\right)\right)
\] |
*-commutative [=>]24.9 | \[ \frac{1}{w} \cdot \left(\frac{w}{\frac{{\left(\frac{d}{D \cdot M}\right)}^{2}}{h}} \cdot \left(\frac{0.5}{c0} \cdot \color{blue}{\left(0.5 \cdot c0\right)}\right)\right)
\] |
Applied egg-rr39.6
Simplified20.7
[Start]39.6 | \[ e^{\mathsf{log1p}\left(\frac{w \cdot \left(c0 \cdot \frac{0.25}{c0}\right)}{w \cdot \frac{{\left(\frac{d}{D \cdot M}\right)}^{2}}{h}}\right)} - 1
\] |
|---|---|
expm1-def [=>]29.7 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{w \cdot \left(c0 \cdot \frac{0.25}{c0}\right)}{w \cdot \frac{{\left(\frac{d}{D \cdot M}\right)}^{2}}{h}}\right)\right)}
\] |
expm1-log1p [=>]26.0 | \[ \color{blue}{\frac{w \cdot \left(c0 \cdot \frac{0.25}{c0}\right)}{w \cdot \frac{{\left(\frac{d}{D \cdot M}\right)}^{2}}{h}}}
\] |
associate-/r* [=>]20.7 | \[ \color{blue}{\frac{\frac{w \cdot \left(c0 \cdot \frac{0.25}{c0}\right)}{w}}{\frac{{\left(\frac{d}{D \cdot M}\right)}^{2}}{h}}}
\] |
*-rgt-identity [<=]20.7 | \[ \frac{\frac{\color{blue}{\left(w \cdot \left(c0 \cdot \frac{0.25}{c0}\right)\right) \cdot 1}}{w}}{\frac{{\left(\frac{d}{D \cdot M}\right)}^{2}}{h}}
\] |
associate-*r/ [<=]20.7 | \[ \frac{\color{blue}{\left(w \cdot \left(c0 \cdot \frac{0.25}{c0}\right)\right) \cdot \frac{1}{w}}}{\frac{{\left(\frac{d}{D \cdot M}\right)}^{2}}{h}}
\] |
associate-/r/ [=>]20.7 | \[ \color{blue}{\frac{\left(w \cdot \left(c0 \cdot \frac{0.25}{c0}\right)\right) \cdot \frac{1}{w}}{{\left(\frac{d}{D \cdot M}\right)}^{2}} \cdot h}
\] |
*-commutative [=>]20.7 | \[ \color{blue}{h \cdot \frac{\left(w \cdot \left(c0 \cdot \frac{0.25}{c0}\right)\right) \cdot \frac{1}{w}}{{\left(\frac{d}{D \cdot M}\right)}^{2}}}
\] |
*-commutative [=>]20.7 | \[ h \cdot \frac{\color{blue}{\frac{1}{w} \cdot \left(w \cdot \left(c0 \cdot \frac{0.25}{c0}\right)\right)}}{{\left(\frac{d}{D \cdot M}\right)}^{2}}
\] |
associate-*r* [=>]20.7 | \[ h \cdot \frac{\color{blue}{\left(\frac{1}{w} \cdot w\right) \cdot \left(c0 \cdot \frac{0.25}{c0}\right)}}{{\left(\frac{d}{D \cdot M}\right)}^{2}}
\] |
*-commutative [=>]20.7 | \[ h \cdot \frac{\color{blue}{\left(c0 \cdot \frac{0.25}{c0}\right) \cdot \left(\frac{1}{w} \cdot w\right)}}{{\left(\frac{d}{D \cdot M}\right)}^{2}}
\] |
lft-mult-inverse [=>]20.7 | \[ h \cdot \frac{\left(c0 \cdot \frac{0.25}{c0}\right) \cdot \color{blue}{1}}{{\left(\frac{d}{D \cdot M}\right)}^{2}}
\] |
*-rgt-identity [=>]20.7 | \[ h \cdot \frac{\color{blue}{c0 \cdot \frac{0.25}{c0}}}{{\left(\frac{d}{D \cdot M}\right)}^{2}}
\] |
if -9.79999999999999967e51 < M < -1.74999999999999993e-102 or 5.09999999999999997e-169 < M Initial program 61.5
Simplified61.4
[Start]61.5 | \[ \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 [=>]61.9 | \[ \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 [=>]61.9 | \[ \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 [=>]61.9 | \[ \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 [=>]61.4 | \[ \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 61.1
Simplified38.0
[Start]61.1 | \[ \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 [=>]61.1 | \[ \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-rr33.1
Taylor expanded in c0 around 0 35.8
Simplified26.4
[Start]35.8 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}
\] |
|---|---|
*-commutative [=>]35.8 | \[ 0.25 \cdot \frac{\color{blue}{\left({M}^{2} \cdot h\right) \cdot {D}^{2}}}{{d}^{2}}
\] |
associate-/l* [=>]36.0 | \[ 0.25 \cdot \color{blue}{\frac{{M}^{2} \cdot h}{\frac{{d}^{2}}{{D}^{2}}}}
\] |
unpow2 [=>]36.0 | \[ 0.25 \cdot \frac{\color{blue}{\left(M \cdot M\right)} \cdot h}{\frac{{d}^{2}}{{D}^{2}}}
\] |
associate-*l* [=>]34.5 | \[ 0.25 \cdot \frac{\color{blue}{M \cdot \left(M \cdot h\right)}}{\frac{{d}^{2}}{{D}^{2}}}
\] |
unpow2 [=>]34.5 | \[ 0.25 \cdot \frac{M \cdot \left(M \cdot h\right)}{\frac{\color{blue}{d \cdot d}}{{D}^{2}}}
\] |
unpow2 [=>]34.5 | \[ 0.25 \cdot \frac{M \cdot \left(M \cdot h\right)}{\frac{d \cdot d}{\color{blue}{D \cdot D}}}
\] |
times-frac [=>]26.4 | \[ 0.25 \cdot \frac{M \cdot \left(M \cdot h\right)}{\color{blue}{\frac{d}{D} \cdot \frac{d}{D}}}
\] |
unpow2 [<=]26.4 | \[ 0.25 \cdot \frac{M \cdot \left(M \cdot h\right)}{\color{blue}{{\left(\frac{d}{D}\right)}^{2}}}
\] |
Applied egg-rr20.5
if -1.74999999999999993e-102 < M < 1.4000000000000001e-214Initial program 56.0
Simplified55.5
[Start]56.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 [=>]58.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-neg [=>]58.0 | \[ \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 [=>]57.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 [=>]55.5 | \[ \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 57.9
Simplified27.5
[Start]57.9 | \[ \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.9 | \[ \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-rr41.9
Simplified42.0
[Start]41.9 | \[ \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}
\] |
|---|---|
times-frac [=>]42.0 | \[ \color{blue}{\frac{\frac{0.5}{c0} \cdot {\left(\frac{\sqrt{w \cdot h} \cdot M}{\frac{d}{D}}\right)}^{2}}{w} \cdot \frac{-c0}{-2}}
\] |
*-commutative [=>]42.0 | \[ \frac{\color{blue}{{\left(\frac{\sqrt{w \cdot h} \cdot M}{\frac{d}{D}}\right)}^{2} \cdot \frac{0.5}{c0}}}{w} \cdot \frac{-c0}{-2}
\] |
associate-/l* [=>]42.0 | \[ \frac{{\color{blue}{\left(\frac{\sqrt{w \cdot h}}{\frac{\frac{d}{D}}{M}}\right)}}^{2} \cdot \frac{0.5}{c0}}{w} \cdot \frac{-c0}{-2}
\] |
Applied egg-rr24.3
Simplified20.4
[Start]24.3 | \[ \frac{1}{\frac{w}{\frac{w \cdot h}{{\left(\frac{d}{D \cdot M}\right)}^{2}} \cdot \left(\frac{0.5}{c0} \cdot \left(c0 \cdot 0.5\right)\right)}}
\] |
|---|---|
associate-/r/ [=>]24.3 | \[ \color{blue}{\frac{1}{w} \cdot \left(\frac{w \cdot h}{{\left(\frac{d}{D \cdot M}\right)}^{2}} \cdot \left(\frac{0.5}{c0} \cdot \left(c0 \cdot 0.5\right)\right)\right)}
\] |
associate-/l* [=>]20.4 | \[ \frac{1}{w} \cdot \left(\color{blue}{\frac{w}{\frac{{\left(\frac{d}{D \cdot M}\right)}^{2}}{h}}} \cdot \left(\frac{0.5}{c0} \cdot \left(c0 \cdot 0.5\right)\right)\right)
\] |
*-commutative [=>]20.4 | \[ \frac{1}{w} \cdot \left(\frac{w}{\frac{{\left(\frac{d}{D \cdot M}\right)}^{2}}{h}} \cdot \left(\frac{0.5}{c0} \cdot \color{blue}{\left(0.5 \cdot c0\right)}\right)\right)
\] |
Applied egg-rr19.7
if 1.4000000000000001e-214 < M < 5.09999999999999997e-169Initial program 56.9
Simplified56.2
[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)
\] |
|---|---|
times-frac [=>]58.2 | \[ \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 [=>]58.2 | \[ \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 [=>]58.2 | \[ \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 [=>]56.2 | \[ \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 58.2
Simplified55.4
[Start]58.2 | \[ \frac{{d}^{2} \cdot {c0}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)}
\] |
|---|---|
times-frac [=>]59.1 | \[ \color{blue}{\frac{{d}^{2}}{{D}^{2}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}}
\] |
unpow2 [=>]59.1 | \[ \frac{\color{blue}{d \cdot d}}{{D}^{2}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}
\] |
unpow2 [=>]59.1 | \[ \frac{d \cdot d}{\color{blue}{D \cdot D}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}
\] |
times-frac [=>]54.4 | \[ \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}
\] |
unpow2 [<=]54.4 | \[ \color{blue}{{\left(\frac{d}{D}\right)}^{2}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}
\] |
*-commutative [=>]54.4 | \[ {\left(\frac{d}{D}\right)}^{2} \cdot \frac{{c0}^{2}}{\color{blue}{h \cdot {w}^{2}}}
\] |
associate-/r* [=>]55.4 | \[ {\left(\frac{d}{D}\right)}^{2} \cdot \color{blue}{\frac{\frac{{c0}^{2}}{h}}{{w}^{2}}}
\] |
unpow2 [=>]55.4 | \[ {\left(\frac{d}{D}\right)}^{2} \cdot \frac{\frac{\color{blue}{c0 \cdot c0}}{h}}{{w}^{2}}
\] |
unpow2 [=>]55.4 | \[ {\left(\frac{d}{D}\right)}^{2} \cdot \frac{\frac{c0 \cdot c0}{h}}{\color{blue}{w \cdot w}}
\] |
Applied egg-rr53.7
Final simplification21.9
| Alternative 1 | |
|---|---|
| Error | 20.4 |
| Cost | 1993 |
| Alternative 2 | |
|---|---|
| Error | 28.2 |
| Cost | 1480 |
| Alternative 3 | |
|---|---|
| Error | 28.3 |
| Cost | 1480 |
| Alternative 4 | |
|---|---|
| Error | 21.0 |
| Cost | 1225 |
| Alternative 5 | |
|---|---|
| Error | 25.2 |
| Cost | 1220 |
| Alternative 6 | |
|---|---|
| Error | 20.6 |
| Cost | 960 |
| Alternative 7 | |
|---|---|
| Error | 31.6 |
| Cost | 64 |
herbie shell --seed 2023039
(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))))))