On Tuesday, February 4, 2014 8:38:57 AM UTC+1, Rajath Shashidhara wrote: > > > > On Monday, February 3, 2014 11:05:50 PM UTC+5:30, mario wrote: >> >> 5.2 is a Python floating point number (a double) represented as >> 5854679515581645*2**(-50); >> using Rational( '5.2' ) it is recognized as exactly 52/10 >> >> > Isn't it better to have Rational(5.2) also store 26/5 , just like > Rational( '5.2' ) does ? > Is there a reason why it is left the way it is? > > It's Python that stores floating points that way. Moreover, the handling of the internal representation of 5.2 is handled by the CPU. It's the correct behavior as Python was not meant to be a CAS, just an ordinary programming language.
I can make a patch for this, if more people feel this way. > You can? How? The only possibility I see is by modifying IPython to capture 5.2 before it gets evaluated by Python. Anyways, I don't see any reason for it, just use *Rational(26, 5)* -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
