Comment #3 on issue 1614 by smichr: Real tuple argument weirdness
http://code.google.com/p/sympy/issues/detail?id=1614

I'm not sure of the best thing to do...I don't see any code that uses this
initialization option for a real. I'm tempted to remove it.

Or perhaps the input should be sanitized there by just requesting a valid  
mpf tuple
with .from_float(). The info from the passed tuple would be passed to  
from_float() as
float((-1)*e*m*2**p) where e would be forced to be 1 if it is not zero.  
Since the mpf
value gets stored as a property of the real and is used for comparison  
purposes we
should store it the same way that it would be stored if the equivalent real  
were
passed instead of the tuple...and the way to guarantee that is to rebuild  
the float
and get the tuple as just described. If one doesn't do that then you can  
get things
which, though equal in value, are unequal as objects because of the  
different _mpf_
attributes:

>>> Real((0,2,0,1))==Real(-2.0) # "should be" the same since lhs is -2
False
>>> Real(-2.)._mpf_ #but the lhs isn't being stored in normalized fashion
(1, 1L, 1, 1)

That last tuple is the normalized form of (0,2,0,1).

Any objections to just sanitizing the passed tuple?

/c



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