From ae83d19a16dbeecc5f2697291682ac3acfe9f8bd Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Sun, 26 Sep 2004 01:47:39 +0000 Subject: [PATCH] * Li2_do_sum_Xn: Optimize (avoid repeated multiplication). --- ginac/inifcns_nstdsums.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ginac/inifcns_nstdsums.cpp b/ginac/inifcns_nstdsums.cpp index 16f09691..94d0fb0c 100644 --- a/ginac/inifcns_nstdsums.cpp +++ b/ginac/inifcns_nstdsums.cpp @@ -257,12 +257,13 @@ cln::cl_N Li2_do_sum_Xn(const cln::cl_N& x) std::vector::const_iterator xend = Xn[0].end(); cln::cl_N u = -cln::log(1-x); cln::cl_N factor = u * cln::cl_float(1, cln::float_format(Digits)); - cln::cl_N res = u - u*u/4; + cln::cl_N uu = cln::square(u); + cln::cl_N res = u - uu/4; cln::cl_N resbuf; unsigned i = 1; do { resbuf = res; - factor = factor * u*u / (2*i * (2*i+1)); + factor = factor * uu / (2*i * (2*i+1)); res = res + (*it) * factor; i++; if (++it == xend) { -- 2.47.0