Karim BELABAS on Thu, 3 Apr 2003 15:43:01 +0200 (MEST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: polredabs(,16) bug


On Thu, 3 Apr 2003, Bill Allombert wrote:

> On Thu, Apr 03, 2003 at 12:13:12PM +0200, Karim BELABAS wrote:
> > On Thu, 3 Apr 2003, Igor Schein wrote:
> > > ? polredabs(x^4+9670527181567158504671*x^2+4840282594390812607599424249,16);
> > >   ***   impossible concatenation in concat
> >
> > I can't reproduce this [ CHANGES-1.724, ix86 kernel, gcc-2.96 20000731 ].
> >
> > Any special setting I should be aware of ?
> Strange, it seems easy to reproduce (on a2x1 for example).

Sorry, I had changed my default primelimit setting (to investigate another
problem) and forgot to test using 'gp -f'. Now I can reproduce it :0).

Fixed.

> /* prototype of positive small ints */
> static long pos_s[] = {
>   evaltyp(t_INT) | _evallg(3), evalsigne(1) | evallgefint(3), 0 };
>
> /* prototype of negative small ints */
> static long neg_s[] = {
>   evaltyp(t_INT) | _evallg(3), evalsigne(-1) | evallgefint(3), 0 };
>
> should probably be moved to add.C or mp_indep.c

Actually, they're legacy stuff, which I wanted to remove completely.
In order to add a C long to a t_REAL, it's rather inefficient to start by
padding it with lots of 0 words first, then add two t_REALs of huge accuracy.
[ besides, it adds a spurious precision word to the result with high
probability ]

I've moved the addition routines to add.c to be able to do such things
conveniently:

* write a dedicated addsr (kill pos_s / neg_s)

* remove the 'subtraction' hacks (change the sign in place, call 'add',
  restore sign). It was a mistake to mix both signed / unsigned arithmetic
  and low level (limbs) / high level (GEN) data in a single kernel.

[ There's also the old project of changing the format of t_REAL so that they
use the same normalization as t_INT (currently, t_REALs are shifted so that
high bit is set): would speed up conversion and addition (a lot), slow down
division (a little), and remove most of the "growing accuracy" problems. ]

    Karim.
-- 
Karim Belabas                     Tel: (+33) (0)1 69 15 57 48
Dép. de Mathématiques, Bât. 425   Fax: (+33) (0)1 69 15 60 19
Université Paris-Sud              http://www.math.u-psud.fr/~belabas/
F-91405 Orsay (France)            http://www.parigp-home.de/  [PARI/GP]