#11796: inconsistency between 0.nbits() and 0.ndigits(base=2)
--------------------------------+-------------------------------------------
   Reporter:  marion            |          Owner:  AlexGhitza
       Type:  defect            |         Status:  needs_info
   Priority:  minor             |      Milestone:  sage-4.8  
  Component:  basic arithmetic  |       Keywords:  ecc2011   
Work_issues:                    |       Upstream:  N/A       
   Reviewer:                    |         Author:            
     Merged:                    |   Dependencies:            
--------------------------------+-------------------------------------------

Comment(by zimmerma):

 Replying to [comment:6 aapitzsch]:
 > The problem was already mentioned in #10596.
 > But there {{{ndigits()}}} was changed to return 1 instead of 0.
 >
 > So, whose solution is ''correct'' and why?

 I cannot apply the patches from #10596 to Sage 4.7:
 {{{
 sage: hg_sage.import_patch("/tmp/trac_10596.patch")
 cd "/usr/local/sage/devel/sage" && hg status
 cd "/usr/local/sage/devel/sage" && hg status
 cd "/usr/local/sage/devel/sage" && hg import   "/tmp/trac_10596.patch"
 applying /tmp/trac_10596.patch
 patching file sage/rings/integer.pyx
 Hunk #4 succeeded at 566 with fuzz 2 (offset -34 lines).
 Hunk #69 FAILED at 5248
 1 out of 80 hunks FAILED -- saving rejects to file
 sage/rings/integer.pyx.rej
 }}}

 What is inconsistent is that we should have {{{0.nbits() == len(0.bits())
 == 0.ndigits(base=2) == len(0.digits(base=2))}}}, which currently does not
 hold.

 Now if {{{0.nbits()}}} is 1, then {{{0.bits()}}} should be {{{[0]}}}.
 I would prefer to return 0 and [] respectively, but first solve the
 inconsistency.

 Paul

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11796#comment:7>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to