We have to regard 0 as a special case, I don't think there's any point in pretending otherwise. If all leading zeros were stripped off in all cases then the string representing 0 would be the empty string, and obviously that would be silly.
I went to see what the degree of the 0 polynomial is in Sage, expecting one of : -Infinity, Undefined, and found it is -1. Well ok, that is one convention, but please do not try to convince me that it is anything other than a convention. (I prefer -Infinity but am not fussy). John On 03/04/2008, Carl Witty <[EMAIL PROTECTED]> wrote: > > On Apr 3, 7:37 am, Alex Ghitza <[EMAIL PROTECTED]> wrote: > > I guess this is a question of convention, and depends on how you think > > of "digit": > > > > (1) a digit is a symbol used to construct representations of numbers, > > and so the base 10 digits are: "0", "1", ..., "9". In this case, > > 0.ndigits() should return 1 and 0.digits() should return [0] > > > > (2) when writing an integer n in base b, you compute a b-adic expansion > > n = d_0 + d_1*b^1 + d_2*b^2 + ... + d_k b^k > > with d_k nonzero; you call the d_i the "digits" of a. Then 0 *has no > > such expansion*, therefore 0.digits() should return [] and 0.ndigits() > > should return 0. > > > I have a slight preference for (2), but I would be happy either way as > long as everything is consistent and documented. > > > Carl > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---