Closed GoogleCodeExporter closed 9 years ago
Mario,
The change was an error on my part. mpq is supposed to behave just like
Fraction. I'll create tags/gmpy_1_13 with the fix in a day or two.
Thanks for the bug report.
Case
Original comment by casevh
on 22 Jul 2010 at 6:03
Thanks.
> mpq is supposed to behave just like Fraction.
Another difference between the two is
>>> a = mpq(1,3)
>>> print a.numer()
1
>>> b = Fraction(1,3)
>>> print b.numerator
1
similarly for the denominator.
Is it possible to add to gmpy.mpq something like
numerator = property(numer)
to allow the same call for both?
Mario
Original comment by mario.pe...@gmail.com
on 22 Jul 2010 at 7:44
I've committed tags/gmpy_1_13 and it should fix the formatting. I also added
improved caching for mpq types. I'm curious if you notice any performance
improvements.
I'll work on adding .numerator etc. next.
Case
Original comment by casevh
on 23 Jul 2010 at 6:40
Thank you.
With version 1.13 I get 1-3% speedup.
Mario
Original comment by mario.pe...@gmail.com
on 24 Jul 2010 at 6:57
I've added .numerator and .denominator to 1.13.
How soon do need this version officially released?
Case
Original comment by casevh
on 26 Jul 2010 at 6:47
> I've added .numerator and .denominator to 1.13.
Great!
Mario
Original comment by mario.pe...@gmail.com
on 26 Jul 2010 at 2:45
1.13 is officially released.
Original comment by casevh
on 31 Aug 2010 at 5:23
Mario,
While running some additional tests, I think my fix has a problem. Below is the
behaviour of the Fractions module, gmpy, and gmpy2 (development branch).
>>> from fractions import Fraction
>>> str(Fraction(3,1))
'3'
>>> repr(Fraction(3,1))
'Fraction(3, 1)'
>>> from gmpy import mpq
>>> str(mpq(3,1))
'3'
>>> repr(mpq(3,1))
'mpq(3)'
>>> from gmpy2 import mpq
>>> str(mpq(3,1))
'3'
>>> repr(mpq(3,1))
'mpq(3,1)
Right now, gmpy 1.13 doesn't display the denominator of 1 even with repr. (The
earlier bug displayed a denominator of 1 in all cases.) I'm planning a 1.14
release within a few weeks. Will you have any problems if I use the gmpy2
formatting rules since they match Fraction's?
casevh
Original comment by casevh
on 26 Oct 2010 at 6:09
Hi,
str(mpq(3,1))
is quite fine.
Mario
Original comment by mario.pe...@gmail.com
on 26 Oct 2010 at 8:37
Original issue reported on code.google.com by
mario.pe...@gmail.com
on 21 Jul 2010 at 8:28