Open GoogleCodeExporter opened 9 years ago
Yes, I am +1.
Btw, I think we are trying to solve the same problem as Sage has with it's
coercion.
I haven't studied how they do it thoroughly yet, but it may be worth learning
from
their mistakes.
Original comment by ondrej.c...@gmail.com
on 26 Aug 2008 at 9:05
http://www.dd.chalmers.se/~frejohl/code/libarith/
Why not add the rationals from there?
Original comment by Vinzent.Steinberg@gmail.com
on 5 Nov 2008 at 5:26
No reason not to, except for sorting out the interface issues.
Original comment by fredrik....@gmail.com
on 6 Nov 2008 at 5:38
Which interface issues are to be sorted out?
sqrt(mpq) etc.?
sqrt(4)?
Original comment by Vinzent.Steinberg@gmail.com
on 6 Nov 2008 at 9:44
Yes, the meaning of sqrt(4) is one issue.
Whether mpq(3,2)*2 should return an integer (and similar, mostly speed related
issues).
One alternative would be to keep the fast fraction type somewhere behind the
scenes
and implement mpq as a wrapper. Then, in gmpy mode, the fast fraction type
could even
be replaced by gmpy.mpq.
Original comment by fredrik....@gmail.com
on 7 Nov 2008 at 10:49
I have no problems with sqrt(4) being an integer.
I'm not sure about mpq simplifying to integer. Would it affect speed
dramatically?
Please note that matrix([[1]]) does not simplify to a scalar.
+1 for mpq as a wrapper for the sake of using gmpy.
Original comment by Vinzent.Steinberg@gmail.com
on 17 Feb 2009 at 12:41
> I'm not sure about mpq simplifying to integer. Would it affect speed
dramatically?
It does make a significant difference when values are likely to be integral.
Small
Python integers are much faster than gmpy.mpq, even. In particular, there can
be a
big advantage for a rational complex type where one component is likely to be 0
or 1.
Original comment by fredrik....@gmail.com
on 17 Feb 2009 at 6:44
Is there actually any disadvantage when simplifying to integer? If not, let's
just
implement it.
Original comment by Vinzent.Steinberg@gmail.com
on 17 Feb 2009 at 9:00
I might do it in connection with some refactoring of integer functions.
Original comment by fredrik....@gmail.com
on 18 Feb 2009 at 6:51
Original issue reported on code.google.com by
fredrik....@gmail.com
on 25 Aug 2008 at 2:52