"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/basemath/Ser.c" between
pari-2.13.0.tar.gz and pari-2.13.1.tar.gz

About: PARI/GP is a computer algebra system designed for fast computations in number theory (factorizations, algebraic number theory, elliptic curves...), but also contains a large number of other mathematical functions.

Ser.c  (pari-2.13.0):Ser.c  (pari-2.13.1)
skipping to change at line 25 skipping to change at line 25
#include "pari.h" #include "pari.h"
#include "paripriv.h" #include "paripriv.h"
/*******************************************************************/ /*******************************************************************/
/* */ /* */
/* Conversion --> t_SER */ /* Conversion --> t_SER */
/* */ /* */
/*******************************************************************/ /*******************************************************************/
static GEN static GEN
RgX_to_ser_i(GEN x, long l, long v, int copy) RgX_to_ser_i(GEN x, long l, long v, int copy)
{ {
long i, lx = lg(x); long i = 2, lx = lg(x), vx = varn(x);
GEN y; GEN y;
if (lx == 2) return zeroser(varn(x), l-2); if (lx == 2) return zeroser(vx, minss(l - 2, v));
if (l < 2) pari_err_BUG("RgX_to_ser (l < 2)"); if (l <= 2)
y = cgetg(l,t_SER); y[1] = x[1]; {
/* e.g. Mod(0,3) * x^0 */ if (l == 2 && v != LONG_MAX) return zeroser(vx, v);
if (v == LONG_MAX) { v = 1; lx = 3; } else { x += v; lx = minss(lx-v, l); } pari_err_BUG("RgX_to_ser (l < 2)");
setvalp(y, v); }
y = cgetg(l,t_SER);
if (v == LONG_MAX) { v = 1; lx = 3; } /* e.g. Mod(0,3) * x^0 */
else if (v)
{
long w = v;
while (isrationalzero(gel(x,2))) { x++; w--; }
lx -= v;
if (w)
{ /* keep type information, e.g. Mod(0,3) + x */
GEN z = gel(x,2); /* = 0 */
x += w; gel(y,2) = gadd(gel(x,2), z); i++;
}
}
y[1] = evalvarn(vx) | evalvalp(v); /* must come here because of LONG_MAX */
if (lx > l) lx = l;
/* 3 <= lx <= l */
if (copy) if (copy)
for (i = 2; i <lx; i++) gel(y,i) = gcopy(gel(x,i)); for (; i <lx; i++) gel(y,i) = gcopy(gel(x,i));
else else
for (i = 2; i <lx; i++) gel(y,i) = gel(x,i); for (; i <lx; i++) gel(y,i) = gel(x,i);
for ( ; i < l; i++) gel(y,i) = gen_0; for ( ; i < l; i++) gel(y,i) = gen_0;
return normalize(y); return normalize(y);
} }
/* enlarge/truncate t_POL x to a t_SER with lg l */ /* enlarge/truncate t_POL x to a t_SER with lg l */
GEN GEN
RgX_to_ser(GEN x, long l) { return RgX_to_ser_i(x, l, RgX_val(x), 0); } RgX_to_ser(GEN x, long l) { return RgX_to_ser_i(x, l, RgX_val(x), 0); }
GEN GEN
RgX_to_ser_inexact(GEN x, long l) RgX_to_ser_inexact(GEN x, long l)
{ {
long i, lx = lg(x); long i, lx = lg(x);
 End of changes. 4 change blocks. 
9 lines changed or deleted 25 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)