Karim Belabas on Mon, 21 Mar 2005 14:46:33 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: ispower error? |
* cino hilliard [2005-03-21 05:30]: > (14:42) gp > ispower(1) > *** ispower: isanypower: argument must be > 1. ispower(x) does not return a boolean value, but the largest exponent k > 1 such that x is a k-th power. This is not defined for x = 1, so the above is correct. On the other hand ispower(x, 2), with explicit second argument, returns a boolean. Perhaps this is confusing; I hesitated a lot before settling for the current interface. The other possibility was to split ispower in two functions: ispower(x, k, {&n}) \\ k is now mandatory issomepower(x, {&n}) \\ for the current ispower(x, /*omitted*/, &n) I eventually overloaded ispower because I couldn't come up with a satisfactory name for the is_some_unspecified_power functionnality. Suggestions/Opinions are welcome. 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]