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 mark.dickinson
Recipients facundobatista, mark.dickinson
Date 2008-10-09.08:43:14
SpamBayes Score 3.5349524e-07
Marked as misclassified No
Message-id <1223541797.81.0.999567661015.issue4084@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2008-10-09 08:43:17mark.dickinsonsetrecipients: + mark.dickinson, facundobatista
2008-10-09 08:43:17mark.dickinsonsetmessageid: <1223541797.81.0.999567661015.issue4084@psf.upfronthosting.co.za>
2008-10-09 08:43:16mark.dickinsonlinkissue4084 messages
2008-10-09 08:43:16mark.dickinsoncreate