# Revision history [back]

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