Mark Dickinson added the comment: For what it's worth, NumPy has exactly the same behaviour:
>>> np.array([-0.0, -0.0]).sum() 0.0 ... which is a bit surprising, given that this is a much easier problem to fix when you know the type of everything in the array in advance. The Decimal type has similar issues here, resulting from that implicit addition of 0: >>> from decimal import Decimal, getcontext >>> getcontext().prec = 5 >>> x = Decimal('3.1415926535893') >>> sum([x]) Decimal('3.1416') Fixing this would involve major changes to the way that sum works, or some horrible DWIM special-casing; I think it's best left as it is. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26324> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com