Karim BELABAS on Mon, 6 May 2002 01:24:47 +0200 (MEST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: GP: issquare() bug |
On Mon, 29 Apr 2002, Michael Somos wrote: > ? issquare(I) > %1 = 1 > ? issquare(I,&x) > *** not an integer argument in an arithmetic function > > which seems inconsistent to me. Shalom, Michael Well, the manual says: issquare(x,{&n}): [...] If n is given and an exact square root had to be computed in the checking process, puts that square root in n. This is in particular the case when x is an integer or a polynomial. This means that the issquare(x,&n) form is (a priori) only accepted when x is a t_INT or a t_POL. The point is that, for some types, we can't prove x is a square without actually computing a square root. In that case, it is nicer to make that square root available to the user instead of forcing him to recompute it. Another potential problem in your example: a t_COMPLEX is understood as a general complex number, which admits a square root by definition. ( issquare(I) doesn't assert anything about Gauss integers. ) If you find the documentation for that routine misleading, please rewrite it in a less confusing way. Thanks, Karim. -- Karim Belabas Tel: (+33) (0)1 69 15 57 48 Dép. de Mathematiques, Bat. 425 Fax: (+33) (0)1 69 15 60 19 Université Paris-Sud Email: Karim.Belabas@math.u-psud.fr F-91405 Orsay (France) http://www.math.u-psud.fr/~belabas -- PARI/GP Home Page: http://www.parigp-home.de/