Karim Belabas on Thu, 09 Jan 2014 17:32:56 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: precp and valp for zero p-adics |
* Jeroen Demeyer [2014-01-09 13:22]: > Hello pari-dev, > > it seems that p-adic numbers which equal zero (e.g. O(3^10)) are > always created with precp=0. However, the manual doesn't really > document the meaning of precp and valp for zero p-adic numbers. > > A 3-adic zero with precp=10 and valp=0 is printed as O(3^10), > exactly the same as precp=0 and valp=10 but the behaviour is > different. > > For example, trying to compute the poldisc() of > (1 + O(3^10))*x^3 + O(3^10)*x^2 + (1 + O(3^10))*x + (1 + O(3^10)) > yields the wrong answer if the x^2 term has precp=10 and valp=0. > > From this, I conclude that p-adic zero numbers should always have > precp=0. Is this a correct conclusion? Yes. > If yes, it should be documented better in the libpari manual. Done. :-) The 'setxxx' macros should never be used outside of the PARI kernel: there is no safety mechanism (you can trivially create invalid objects or corrupt one of the universal constants such as gen_0, etc.) and they usually provide negligible savings. We still document them for the sake of backward compatibility, but the preferred way is to use a higher lever routines, e.g. zeropadic(p, e) to create O(p^e). Cheers, K.B. -- Karim Belabas, IMB (UMR 5251) Tel: (+33) (0)5 40 00 26 17 Universite Bordeaux 1 Fax: (+33) (0)5 40 00 69 50 351, cours de la Liberation http://www.math.u-bordeaux1.fr/~kbelabas/ F-33405 Talence (France) http://pari.math.u-bordeaux1.fr/ [PARI/GP] `