Giter Club home page Giter Club logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on September 4, 2024
Since the gmpy_test.py file is empty, I can't recreate the original issue. I 
think
the correct solution is to a long for the hash. Using the attached patch, I 
tested a
wide variety of values and verified that hash(long) always equaled hash(mpz).

casevh

Original comment by casevh on 22 May 2008 at 5:43

Attachments:

from gmpy.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 4, 2024
Here's gmpy_test.py

Original comment by [email protected] on 22 May 2008 at 11:41

Attachments:

from gmpy.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 4, 2024
I've run gmpy_test.py with gmpy.c(r17) and my version.  There are failures with 
r17
and no failures with my version.  The attached file shows runs (with both 
versions)
as well as the output of "svn diff", "setup.py build", and "setup.py install"

Original comment by [email protected] on 22 May 2008 at 10:26

Attachments:

from gmpy.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 4, 2024
Thank you for gmpy_test.py. I runs successfully with r18.

Your patch runs gmpy_test.py successfully but breaks the following:

>>> import gmpy
>>> hash(long('12345678901234567890'))
-6101065172474983726
>>> hash(gmpy.mpz('1234567901234567890'))
338664146

At least on my system, hash appears to be a 64-bit value.

Can you test r18?

casevh

Original comment by casevh on 23 May 2008 at 4:28

  • Changed state: Started

from gmpy.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 4, 2024
I can duplicate your results for hash(long()) and hash(gmpy.mpz()) for my 
patch. 
However running R18 produces -6101065172474983726 and 1234567901234567890.

*** R18 ***

Python 2.5.2 (r252:60911, May 16 2008, 23:11:42) 
[GCC 4.1.2 (Gentoo 4.1.2 p1.1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gmpy
>>> print hash(long('12345678901234567890'))  
-6101065172474983726
>>> print hash(gmpy.mpz('1234567901234567890'))  
1234567901234567890
>>> 


*** My Patch ***
Python 2.5.2 (r252:60911, May 16 2008, 23:11:42) 
[GCC 4.1.2 (Gentoo 4.1.2 p1.1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gmpy
>>> print hash(long('12345678901234567890'))  
-6101065172474983726
>>> print hash(gmpy.mpz('1234567901234567890'))  
338664146
>>> 


Original comment by [email protected] on 23 May 2008 at 11:48

from gmpy.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 4, 2024
hash(gmpy.mpz('1234567901234567890')) is missing an "8". 

Since your hash values match mine, I'll mark this issue as fixed.

Thanks for the bug report.

casevh

Original comment by casevh on 23 May 2008 at 1:05

  • Changed state: Fixed

from gmpy.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 4, 2024
Thanks for the fix!

Original comment by [email protected] on 24 May 2008 at 3:54

from gmpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.