Message74557
Here's a snippet from Python 2.6:
>>> from decimal import Decimal, getcontext
>>> getcontext().prec = 3
>>> Decimal('NaN').max(Decimal('1234'))
Decimal('sNaN234')
The result here should be Decimal('1.23E+3')---the specification says that
the result of comparing a quiet NaN with a finite value should be that
finite value, rounded according to the context.
This also affects min, max_mag and min_mag.
The cause is that non-NaNs are incorrectly being passed to the _fix_nan
method. The attached patch fixes this, and adds new testcases to
extra.decTest to stop it happening again.
It would be good to get this fix into 3.0, if possible. I think it should
also be backported to 2.5.3. |
|
Date |
User |
Action |
Args |
2008-10-09 08:43:17 | mark.dickinson | set | recipients:
+ mark.dickinson, facundobatista |
2008-10-09 08:43:17 | mark.dickinson | set | messageid: <1223541797.81.0.999567661015.issue4084@psf.upfronthosting.co.za> |
2008-10-09 08:43:16 | mark.dickinson | link | issue4084 messages |
2008-10-09 08:43:16 | mark.dickinson | create | |
|