Comments (9)
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
- Changed state: Started
from gmpy.
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 [email protected]
on 22 Jul 2010 at 7:44
from gmpy.
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
from gmpy.
Thank you.
With version 1.13 I get 1-3% speedup.
Mario
Original comment by [email protected]
on 24 Jul 2010 at 6:57
from gmpy.
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
from gmpy.
> I've added .numerator and .denominator to 1.13.
Great!
Mario
Original comment by [email protected]
on 26 Jul 2010 at 2:45
from gmpy.
1.13 is officially released.
Original comment by casevh
on 31 Aug 2010 at 5:23
- Changed state: Fixed
from gmpy.
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
from gmpy.
Hi,
str(mpq(3,1))
is quite fine.
Mario
Original comment by [email protected]
on 26 Oct 2010 at 8:37
from gmpy.
Related Issues (20)
- Support for erfinv HOT 2
- Creating an mpq from Decimal no longer works HOT 2
- mul_2exp does not accept negative exponents
- https://gmpy2.readthedocs.io/en/latest/history.html outdated HOT 1
- How can I use powmod function within cython.parallel.prange? HOT 18
- ImportError: undefined symbol mpz_limbs_write HOT 3
- Unexpected mpq() behaviour. HOT 2
- Possible incorrect calculations in subnormalize mode HOT 2
- runtests: bad Python version check HOT 1
- is_divisible() gives wrong answer for integers on 64-bit boundary HOT 2
- possible issue (sigsegv) with cached_context HOT 4
- Incorrect values when accessing sign bits through slicing HOT 3
- Setter method on xmpz slices does not modify the value when the slice is unbounded
- Would you consider releasing the 2.1.3 version? HOT 5
- mpfr: subnormalize=True breaks mpfr('inf') and mpfr('nan') HOT 8
- gmpy2 failed to install in Python 3.11 HOT 7
- Segmentation fault using mpz on OSX HOT 6
- Building wheels with GMP et al HOT 5
- Adding _sympy_ method to mpfr type for robust interoperability with sympy HOT 3
- Expose mpz_probab_prime_p() int return values from is_prime() HOT 5
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.