#15820: Implement sequences of bounded integers
-------------------------------------+-------------------------------------
       Reporter:  SimonKing          |        Owner:
           Type:  enhancement        |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.3
      Component:  algebra            |   Resolution:
       Keywords:  sequence bounded   |    Merged in:
  integer                            |    Reviewers:
        Authors:  Simon King         |  Work issues:  Fix flakyness in
Report Upstream:  N/A                |  adding sequences
         Branch:                     |       Commit:
  u/SimonKing/ticket/15820           |  735939e593c9c302ff42c4973cbfe2e48eb22644
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by SimonKing):

 Now I can explain what goes wrong in above example.

 GMP has its limbs, and I have my sequence items. In the example, each item
 consumes 5 bit, but each limb comprises 32 bit. As it happens, the last
 bit of my last item is 0, and the last limb ''only'' stores this single
 zero bit. Hence, when I ask GMP to do high-level operations (which makes
 sense for concatenation, I wouldn't like to do it low-level), GMP tries to
 be clever and drops the last limb, since it is zero. But when I transform
 the result to a list, I want to access the last bit. But since the last
 bit is not in a limb any longer, it belongs to non-allocated memory.
 Hence, randomly, the last bit can be 0 or 1, which explains why in the
 example above the difference between the correct and the wrong last item
 is 16.

 So, what I should do: When transforming a sequence to a string or list (or
 when iterating), I should check whether I am running outside of GMP's
 limbs. Alternatively, I should provide a bit 1 right behind of my last
 item, so that GMP will not drop the last limb (as I forced it to be non-
 zero).

--
Ticket URL: <http://trac.sagemath.org/ticket/15820#comment:74>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to