This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients mark.dickinson, skrah
Date 2011-02-05.18:04:49
SpamBayes Score 0.0001461501
Marked as misclassified No
Message-id <1296929089.89.0.497503076821.issue11131@psf.upfronthosting.co.za>
In-reply-to
Content
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')
History
Date User Action Args
2011-02-05 18:04:49skrahsetrecipients: + skrah, mark.dickinson
2011-02-05 18:04:49skrahsetmessageid: <1296929089.89.0.497503076821.issue11131@psf.upfronthosting.co.za>
2011-02-05 18:04:49skrahlinkissue11131 messages
2011-02-05 18:04:49skrahcreate