Status: Accepted
Owner: smichr
Labels: Type-Defect Priority-Medium

New issue 1584 by smichr: as_numer_denom() returns wrong result when both  
num and den are negative
http://code.google.com/p/sympy/issues/detail?id=1584

As per issue 1263's fix, I think, .as_numer_denom() checks to see if the
denominator is negative when the exponent is not an integer. I think it
should actually be checking to see if that is the only quantity that is
negative, because if the numerator is also negative then the two signs will
cancel and nothing special needs to be done. If nothing is known about the
numerator nor the denominator, then nothing can be done.

Here is an example with the correct result:
>>> N(sqrt(1/(1-sqrt(5)))) #neg in denominator
0.899453719973934*I
>>> N(sqrt(-1/(1-sqrt(5)))) #neg in numerator and denominator
0.899453719973934

Tests and patch to follow.

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