#11611: Equal PARI integers have different hashes
-----------------------------+----------------------------------------------
   Reporter:  jdemeyer       |          Owner:  jdemeyer                    
       Type:  defect         |         Status:  new                         
   Priority:  major          |      Milestone:  sage-4.7.2                  
  Component:  number fields  |       Keywords:  pari cgetg integer ideal hnf
Work_issues:                 |       Upstream:  N/A                         
   Reviewer:                 |         Author:                              
     Merged:                 |   Dependencies:                              
-----------------------------+----------------------------------------------
Changes (by jdemeyer):

  * keywords:  pari integer ideal hnf => pari cgetg integer ideal hnf


Old description:

> In the code below, `a5` and `b5` are PARI integers equal to 5 but they
> have different hashes:
>
> {{{
> sage: pariK=pari("nfinit(x^2-x-1)"); b5 = pari(5); b5.debug(); a5 =
> pari(5); a5.debug(); print a5.__hash__(), b5.__hash__()
> [&=00000000049437b0] INT(lg=3):0200000000000003
> (+,lgefint=3):4000000000000003 0000000000000005
> [&=000000000493cfe0] INT(lg=3):0200000000000003
> (+,lgefint=3):7000000000000003 0000000000000005
> -1729382256910270461 -8646911284551352317
> }}}
>
> This bug was discovered for ideals having different hashes.

New description:

 In the code below, `a5` and `b5` are PARI integers equal to 5 but they
 have different hashes:

 {{{
 sage: pariK=pari("nfinit(x^2-x-1)"); b5 = pari(5); b5.debug(); a5 =
 pari(5); a5.debug(); print a5.__hash__(), b5.__hash__()
 [&=00000000049437b0] INT(lg=3):0200000000000003
 (+,lgefint=3):4000000000000003 0000000000000005
 [&=000000000493cfe0] INT(lg=3):0200000000000003
 (+,lgefint=3):7000000000000003 0000000000000005
 -1729382256910270461 -8646911284551352317
 }}}

 This bug was discovered for ideals having different hashes.

 The problem is with the initialization of integers in
 `new_gen_from_mpz_t()`.  The attached patch fixes various instances of bad
 PARI object initialization.

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11611#comment:5>
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