ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 11 Apr 2016 12:15:50 -0500Possible bug of sum functionhttp://ask.sagemath.org/question/33068/possible-bug-of-sum-function/Consider the following code:
def s(n):
return sum(k/n for k in range(n + 1))
L0 = s(2)
for n in range(2, 3):
L1 = s(n)
The answers are (using sage 7.1):
print L0, L1
(3/2, 1)
In the second case sage is using the usual integer division of python 2.x while in the first one it is using the exact representation of rationals. Is this a known bug?
jllbMon, 11 Apr 2016 12:15:50 -0500http://ask.sagemath.org/question/33068/