Comment #11 on issue 3068 by smi...@gmail.com: incorrect sign calculated
http://code.google.com/p/sympy/issues/detail?id=3068

So it looks like the sign of some numbers can come back as an expression which, when evaluated, will give the correct sign:

n=pi**1000
i=int(n)
sign(n-i)
sign(-14121235445157648123104397328815876354759634615820625740483463241129528844
74452775306450654297508705097932887843986156765682639878790173172011514327663828
52945411305269317749985012739462716111596721506105128205513023970079702904404288
68834035366715627960831224418497658597558053786268442220701962040550428767112425
51520296866903300565030193813895002519835302685083200044863383976554312520576824
91778564893224035632529909176296721558266993909464943451508352139725969309079693
415756497339648181883882 + pi**1000)
sign(n-i).n(1)
1.

Still, n - i is not computed with precision...
(n-i).n()
0.e+372
_._prec
1

But the sign of it is...
sign(n-i).n()._prec
53

The other expression can have its sign correctly calculated, too:

e=-pi**1000*(sin(x)**2 + cos(x)**2) + pi**(-1500) + pi**1000
e.subs(x,1)
pi**(-1500) - pi**1000*(cos(1)**2 + sin(1)**2) + pi**1000
sign(_)
sign(pi**(-1500) - pi**1000*(cos(1)**2 + sin(1)**2) + pi**1000)
_.n()
1.00000000000000


It would still be nice if, when possible, sign would return -1, 0, 1 for expressions which are numbers.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy-issues+unsubscr...@googlegroups.com.
To post to this group, send email to sympy-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to