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

New issue 1239 by nicolas.pourcelot: decimals should be rationals (!)
http://code.google.com/p/sympy/issues/detail?id=1239

Hi,

Using, sympy 0.6.3, I noticed the following :

>>> s.Real('2.5').is_rational
>>> (sympy.Integer(5)/2).is_rational
True
>>> s.Real('2.5') == sympy.Integer(5)/2
True

I think 's.Real('2.5').is_rational' should return True, as for any Real
initialized with a float or a string (i.e. decimals).

(is_Rational attribute is enough to distinguish between fractions of
integers and floats.)


By the way, I think this should also work :

>>> sympy.factor(x**2+s.Real('2.5')*x+1)
Traceback (most recent call last):
   File "<input>", line 1, in <module>
   File ".../sympy/polynomials/wrapper.py", line 39, in factor
     return Mul(*[ff.sympy_expr for ff in factor_.factor(f, var, order)])
   File ".../sympy/polynomials/factor_.py", line 181, in factor
     denom, f = f.as_integer()
   File ".../sympy/polynomials/base.py", line 448, in as_integer
     raise PolynomialException("%s is no rational coefficient!" % term[0])
PolynomialException: 2.50000000000000 is no rational coefficient!



--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
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