Message128007
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') |
|
Date |
User |
Action |
Args |
2011-02-05 18:04:49 | skrah | set | recipients:
+ skrah, mark.dickinson |
2011-02-05 18:04:49 | skrah | set | messageid: <1296929089.89.0.497503076821.issue11131@psf.upfronthosting.co.za> |
2011-02-05 18:04:49 | skrah | link | issue11131 messages |
2011-02-05 18:04:49 | skrah | create | |
|