Karim Belabas on Thu, 17 Mar 2005 11:22:38 +0100


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

Re: Valuation Overflow


* Igor Schein [2005-03-17 00:39]:
> On Wed, Mar 16, 2005 at 05:19:23PM -0600, Ariel Pacetti wrote:
>>
>>               GP/PARI CALCULATOR Version 2.2.8 (development
>> CHANGES-1.1059)
>>                      i686 running linux (ix86 kernel) 32-bit version
>>             compiled: Feb 15 2005, gcc-3.2 20020903 (Red Hat Linux 8.0
>> 3.2-7)
>>                      (readline v4.3 enabled, extended help available)
>>
>>                             Copyright (C) 2003 The PARI Group
>>
>> PARI/GP is free software, covered by the GNU General Public License, and
>> comes WITHOUT
>> ANY WARRANTY WHATSOEVER.
>>
>> Type ? for help, \q to quit.
>> Type ?12 for how to get moral (and possibly technical) support.
>>
>> parisize = 4000000, primelimit = 500000
>> ? 1/(1+q)+O(q^40000)
>>   ***   valuation (valp) overflow
>
> On 32bit machine you can only go as high as 2^15-1.  I can't find
> immediately where, but I am pretty sure it's documented somewhere in
> the manual.

PARI was written at a time where memory was expensive and every byte
mattered. So a number of (then assumed to be) "small" parameters are
unfortunately crammed into a single codeword. This involves t_SER and
t_PADIC valuations, t_REAL exponents, t_INT and t_REAL mantissa lengths,
etc. All of them having smaller maximal value than the "natural" one.

This is a big limitation but lifting it completely requires destroying
backward compatibility. Disregarding this, allowing much larger objets is
relatively easy to do but
1) it has a huge potential for introducing bugs,
2) it would be mostly useless since PARI was built with the assumption that
all objects will remain "small". This is no longer the case for
multiprecision arithmetic and (to a lesser extent) the polynomial kernel.
But t_SERs and t_PADICs become appallingly inefficient as their sizes
increase.

So it's been indefinitely postponed.

In any case, you can go up to 2^VALPnumBITS - 1, with

   VALPnumBITS = BITS_IN_LONG - SIGNnumBITS - VARNnumBITS

where SIGNnumBITS = 2 and VARNnumBITS is 14 by default. Bearing the second
comment above in mind, you can do some fine tuning by yourself with these
constants in src/headers/parigen.h [ lowering VARNnumBITS will increase
VALPnumBITS by the corresponding amount ].

Cheers,

    Karim.
--
Karim Belabas                     Tel: (+33) (0)1 69 15 57 48
Dep. de Mathematiques, Bat. 425   Fax: (+33) (0)1 69 15 60 19
Universite Paris-Sud              http://www.math.u-psud.fr/~belabas/
F-91405 Orsay (France)            http://pari.math.u-bordeaux.fr/  [PARI/GP]