Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 2950 by tlora...@gmail.com: Rational() doesn't work with floats
http://code.google.com/p/sympy/issues/detail?id=2950
Below is a session demonstrating the problems. Especially line 85 should
produce something more meaningful.
In [85]: Rational(3.2)
Out[85]: 3
In [86]: Rational(2.5, 3.5) # Should be 5/7.
Out[86]: 2/3
In [87]: Rational('3.2') # Correct.
Out[87]: 16/5
In [88]: Rational('2.5', '3.5')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/miha_shr/coding/repos/sympy/<ipython-input-88-88f12531eaec> in <module>()
----> 1 Rational('2.5', '3.5')
/miha_shr/coding/repos/sympy/sympy/core/cache.pyc in wrapper(*args,
**kw_args)
88 except KeyError:
89 pass
---> 90 func_cache_it_cache[k] = r = func(*args, **kw_args)
91 return r
92 return wrapper
/miha_shr/coding/repos/sympy/sympy/core/numbers.py in __new__(cls, p, q)
645 q *= p.q
646 p = p.p
--> 647 p = int(p)
648 q = int(q)
649 if q == 0:
ValueError: invalid literal for int() with base 10: '2.5'
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.