Updates:
        Cc: Ronan.Lamy

Comment #25 on issue 1778 by smichr: Rational from string can be improved
http://code.google.com/p/sympy/issues/detail?id=1778

I suppose we could make Rational quite limited and strict, instantiating from 1 or 2 integers/longs/Integers/Rationals: Rational(i, j=1) -> i/j. All the manipulations of strings and decision making about what is intended could be put in sympify with, like
polys, a flag indicating how numbers should be handled, e.g.

S(expr, Q=True) -> expr with all numbers becoming instances of Rational/Integer
S(expr, Z=True) -> expr with all numbers becoming instances of Real/Integer

Further, in the case of Q=True one should be able to signify whether the numbers should be converted approximately (e.g. as they would be represented by str()) or whether they should use full precision ('full' is the flag used by nsimplify)

S(repr(.2), Q=True, full=True) -> 20000000000000001/100000000000000000
S(repr(.2), Q=True, full=False) -> 1/5
S('.23232323232323', Q=True, full=False) -> 23/99

I would vote for Q=True, full=False being the default so
S(1e2) -> 100 rather than 100.0 as it is now.

Any thoughts on this proposal?

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