andyvand / gmpy

Automatically exported from code.google.com/p/gmpy
GNU Lesser General Public License v3.0
0 stars 0 forks source link

the divm function destroys my input variable #90

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. python gmpybug.py

What is the expected output? What do you see instead?
I expect the program to terminate normally, all assertions should succeed, and 
the final print statement should be executed.
The numbers printed after the ++++ and after the ---- should be equal, since 
they are the same number.

What actually happens is this:
++++
89226154549407725604881348819887345711623368910461712420443145367089062362255717
28380106878396876254787523174879564253277619261577551664466234017641670411259745
60999202959133244295908240253622132333662431342132397375592034078785491179602600
13743733341362415413380559707893657625848834793738013539968001312030
----
44613077274703862802440674409943672855811684455230856210221572683544531181127858
64190053439198438127393761587439782126638809630788775832233117008820835205629872
80499601479566622147954120126811066166831215671066198687796017039392745589801300
06871866670681207706690279853946828812924417396869006769984000656015
Traceback (most recent call last):
  File "gmpybug.py", line 40, in <module>
    assert ( (minus_bed + gmpy2.divexact(a,e)*d) % n == 0)
AssertionError

What version of the product are you using? On what operating system?
gmpy2.0.0
python2.7 or python3, both can reproduce the bug
gmp 5.1.3-r1
i'm using Gentoo Linux, using the hardened profile.

Original issue reported on code.google.com by f...@windfisch.org on 7 Oct 2014 at 2:59

Attachments:

GoogleCodeExporter commented 9 years ago
I can reproduce the bug. I should have a patch this evening.

Original comment by casevh on 7 Oct 2014 at 6:31

GoogleCodeExporter commented 9 years ago
Thanks for the report. I have corrected the bug and released a new version. 
gmpy2 2.0.4 is now the recommended version.

Original comment by casevh on 8 Oct 2014 at 4:54