New submission from Stefan Krah <stefan-use...@bytereef.org>: Another exciting corner case in plus/minus:
"The operations are evaluated using the same rules as add and subtract; the operations plus(a) and minus(a) (where a and b refer to any numbers) are calculated as the operations add(’0’, a) and subtract(’0’, b) respectively, where the ’0’ has the same exponent as the operand." But add and subtract have a special rule for the sign with ROUND_FLOOR: "Otherwise, the sign of a zero result is 0 unless either both operands were negative or the signs of the operands were different and the rounding is round-floor." So, +Decimal("-0") and -Decimal("0") should be a negative zero. I checked this against decNumber. Currently: >>> c = getcontext() >>> c.rounding = ROUND_FLOOR >>> +Decimal("-0") Decimal('0') >>> -Decimal("0") Decimal('0') ---------- components: Library (Lib) messages: 128007 nosy: mark.dickinson, skrah priority: normal severity: normal status: open title: decimal.py: plus/minus with ROUND_FLOOR type: behavior versions: Python 3.2, Python 3.3 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11131> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com