]> 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 6217d8b5b2901ace0eb1cd547781cdaf03d0f465..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;
@@ -1141,10 +1143,6 @@ bool convert_parameter_H_to_Li(const lst& l, lst& m, lst& s, ex& pf)
                        }
                }
        }
-       for (; acc > 1; acc--) {
-               throw std::runtime_error("ERROR!");
-               m.append(0);
-       }
        
        return has_negative_parameters;
 }
@@ -2141,9 +2139,9 @@ ex convert_H_to_Li(const ex& m, const ex& x)
        map_trafo_H_reduce_trailing_zeros filter;
        map_trafo_H_convert_to_Li filter2;
        if (is_a<lst>(m)) {
-               return filter2(filter(H(m, x).hold())).eval();
+               return filter2(filter(H(m, x).hold()));
        } else {
-               return filter2(filter(H(lst(m), x).hold())).eval();
+               return filter2(filter(H(lst(m), x).hold()));
        }
 }