Hi,

Recently, I wanted to apply the digits method of an integer with a large base.  
I ran into problems and entered:
http://trac.sagemath.org/sage_trac/ticket/2362
Now, I thought I'd sit down and fix the bug but there are two other bugs that 
I'd like discussion on:
http://trac.sagemath.org/sage_trac/ticket/2232
http://trac.sagemath.org/sage_trac/ticket/2170
I made comments in both of those last tickets.  I think the first is invalid 
and I think the second is not a very good fix (although it does fix the most 
obvious issue).

Some questions:

What is the desired output for negative numbers?
sage:  (-12).digits(10)
[-2, -1] # 2.10.2 output
I like that output.  I'm a bit disturbed by it's mismatching
sage:  (-12).digits(2)
[0, 0, 1, 0]
Hmm, I don't comprehend that last 0 -- not from the code or from the 
mathematics!

How should negative numbers interact with the digits parameter?
sage: (-12).digits(10,digits='0123456789')
['2', '1']
I'm not sure what to think about that output.  It's certainly not clear to me 
what the user would expect.  I do think it's a little unnerving that there is 
no evidence what-so-ever of the lost information (minus sign).

I do think that 
sage: base=3; n=25
sage: l=n.digits(base)
sage: sum(base^i*l[i] for i in range(len(l)))==n
True
should always be 'True' on the last line for all base and n.  It's not 
currently true for negatives and binary.  It does not really apply when we 
have 'digits' given.

I would like some feedback on correct understanding of these things.

I'm also deeply disturbed that we didn't follow the fast path for binary with 
digits.  It's trivial to fix that though.

--
Joel

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to