]> www.ginac.de Git - ginac.git/blobdiff - ginac/inifcns_nstdsums.cpp
Fixed severe bug that caused Li and S to hang for certain parameters
[ginac.git] / ginac / inifcns_nstdsums.cpp
index 4b8122d23e33151d487405ea07d951c085e40770..5cc4c7ce7552eead5824c075f1911f9a33feb5db 100644 (file)
@@ -189,7 +189,7 @@ cln::cl_N Li2_do_sum(const cln::cl_N& x)
 {
        cln::cl_N res = x;
        cln::cl_N resbuf;
-       cln::cl_N num = x;
+       cln::cl_N num = x * cln::cl_float(1, cln::float_format(Digits));
        cln::cl_I den = 1; // n^2 = 1
        unsigned i = 3;
        do {
@@ -208,7 +208,7 @@ cln::cl_N Li2_do_sum_Xn(const cln::cl_N& x)
 {
        std::vector<cln::cl_N>::const_iterator it = Xn[0].begin();
        cln::cl_N u = -cln::log(1-x);
-       cln::cl_N factor = u;
+       cln::cl_N factor = u * cln::cl_float(1, cln::float_format(Digits));
        cln::cl_N res = u - u*u/4;
        cln::cl_N resbuf;
        unsigned i = 1;
@@ -226,7 +226,7 @@ cln::cl_N Li2_do_sum_Xn(const cln::cl_N& x)
 // calculates Li(n,x), n>2 without Xn
 cln::cl_N Lin_do_sum(int n, const cln::cl_N& x)
 {
-       cln::cl_N factor = x;
+       cln::cl_N factor = x * cln::cl_float(1, cln::float_format(Digits));
        cln::cl_N res = x;
        cln::cl_N resbuf;
        int i=2;
@@ -245,7 +245,7 @@ cln::cl_N Lin_do_sum_Xn(int n, const cln::cl_N& x)
 {
        std::vector<cln::cl_N>::const_iterator it = Xn[n-2].begin();
        cln::cl_N u = -cln::log(1-x);
-       cln::cl_N factor = u;
+       cln::cl_N factor = u * cln::cl_float(1, cln::float_format(Digits));
        cln::cl_N res = u;
        cln::cl_N resbuf;
        unsigned i=2;
@@ -846,7 +846,9 @@ cln::cl_N S_do_sum(int n, int p, const cln::cl_N& x, const cln::float_format_t&
        }
 
        // should be done otherwise
-       cln::cl_N xf = x * cln::cl_float(1, prec);
+       cln::cl_F one = cln::cl_float(1, cln::float_format(Digits));
+       cln::cl_N xf = x * one;
+       //cln::cl_N xf = x * cln::cl_float(1, prec);
 
        cln::cl_N res;
        cln::cl_N resbuf;