Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 2357 by [email protected]: bugs in PythonRationalType
http://code.google.com/p/sympy/issues/detail?id=2357

Hi,
there are a few bugs in PythonRationalType

from sympy import *
from sympy.polys.domains.pythonrationaltype import PythonRationalType
print Rational(3)
3
print PythonRationalType(3)
3/1
a = Rational(3,2)
Rational(a)
3/2
a1 = PythonRationalType(3,2)
PythonRationalType(a1)
PythonRationalType(1, 1)

I made a quick fix for these bugs in
https://github.com/pernici/sympy/commit/a9a7381a087739f0650846abe1c61103586d1d6d

to make the tests in https://github.com/sympy/sympy/pull/295 pass, however there are other bugs I did not fix

PythonRationalType(a1,7)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sympy/polys/domains/pythonrationaltype.py", line 38, in __init__
    self.p = p//g
TypeError: unsupported operand type(s) for //: 'PythonRationalType' and 'int'

b = Rational(4,5)
Rational(a,b)
15/8
b1 = PythonRationalType(4,5)
PythonRationalType(a1,b1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sympy/polys/domains/pythonrationaltype.py", line 43, in __init__
    q = p.q*q
AttributeError: 'int' object has no attribute 'q'

By the way, what is the reason of having both Rational and
PythonRationalType?

Mario

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to