Mark Dickinson added the comment:

I agree with Oscar about sum for decimal.Decimal.  The *ideal* sum for Decimal 
instances would return the correctly rounded result (i.e., the exact result, 
rounded to the current context just once using the current rounding mode).  It 
seems wrong to give a guarantee of behaviour that's in conflict with this ideal.

IEEE 754 recommends a 'sum' operation (in section 9.4, amongst other reduction 
operations), but doesn't go so far as to either require or recommend that the 
result be correctly rounded.  Instead, it says "Implementations may associate 
in any order or evaluate in any wider format.", and then later on, "Numerical 
results [...] may differ among implementations due to the precision of 
intermediates and the order of evaluation."  It certainly *doesn't* specify 
that the results should be as though the context precision and rounding mode 
were used for every individual addition.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18606>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to