Comments (7)
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.
Here's gmpy_test.py
Original comment by [email protected]
on 22 May 2008 at 11:41
Attachments:
from gmpy.
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.
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.
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.
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.
Thanks for the fix!
Original comment by [email protected]
on 24 May 2008 at 3:54
from gmpy.
Related Issues (20)
- Breaking changes in Python 3.12.0a7 release HOT 4
- Add function csqrt HOT 2
- Incompatible (wrt the MPC library) parsing in the master HOT 1
- bit_count() not found HOT 3
- Build failure on CPython 3.13 (dev)
- test failures with mpfr 4.2.1 (change in MPFR formatted functions) HOT 32
- New version? 🤔 HOT 15
- 2.1.5: test suite fails with errors `invalid option: '+SKIP_MPC_LESS_THAN_110'` HOT 9
- 2.1.5: *.h and *.pxd files are installed HOT 5
- Is the `is_strong_bpsw_prp` code correct? HOT 2
- Assessment of the difficulty in porting CPU architecture for the gmpy
- Description of `is_euler_prp` HOT 1
- mpz object missing to_bytes() method HOT 4
- complex conjugate crash HOT 2
- Linux wheels in the latest release (2.2.0a1) are broken HOT 10
- What is the paper that `is_extra_strong_lucas_prp` is referring to? HOT 4
- About the case where `k=0` is input to `lucasu_mod` and `lucasv_mod` HOT 2
- gmpy-2.1.5 fails to compile with python-3.12 HOT 11
- cython C-API is broken in published wheels (and in the build_wheels.yml CI workflow) HOT 9
- Pip install build fails, can't find mpc.h HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gmpy.