Sympy implements its own integer type with "math" division: sage: import sympy sage: type(sympy.factorial(int(12))) <class 'sympy.core.numbers.Integer'> sage: int(1) / sympy.factorial(int(12)) 1/479001600
On Sunday, December 28, 2014 2:58:55 PM UTC+1, Ralf Stephan wrote: > > On Sunday, December 28, 2014 11:42:57 AM UTC+1, Volker Braun wrote: >> >> In a Python file, (-1)**k and factorial(k) are Python ints, so the >> quotient is C division. >> > > That explains the wrong result and helps me with the ticket, many thanks! > > Presumably, not importing works because there is pyc optimization going on > when factorial is defined in the same file. But it is still mysterious why > importing sympy.factorial will give the correct result. > > Regards, > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.