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, rhettinger, skrah
Date 2010-04-26.17:45:29
SpamBayes Score 1.5281069e-08
Marked as misclassified No
Message-id <1272303931.23.0.317497205721.issue8540@psf.upfronthosting.co.za>
In-reply-to
Content
The Context class in the decimal module has a hidden _clamp attribute, that controls whether to clamp values with large exponents.  (Clamping a Decimal value involves adding extra significant zeros to decrease its exponent, while not altering the numeric value;  it's sometimes necessary to get the exponent within a legal range).

I think we should consider making this attribute public (documenting it, having it appear in the __str__ or __repr__ of a Context), for a couple of reasons:

(1) It's necessary for full compliance with the specification:  Python's default behaviour is actually non-compliant with the spec;  it's only after doing getcontext()._clamp = 1 that it complies.

(2) Clamping is necessary for modeling the standard formats described in IEEE 754-2008 (decimal64, decimal128), etc.  These formats are coming into use in other languages (gcc already supports them and C201x may well include them).  To be able to communicate effectively with other languages using these formats, it would be useful to expose Context._clamp.
History
Date User Action Args
2010-04-26 17:45:31mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, facundobatista, skrah
2010-04-26 17:45:31mark.dickinsonsetmessageid: <1272303931.23.0.317497205721.issue8540@psf.upfronthosting.co.za>
2010-04-26 17:45:30mark.dickinsonlinkissue8540 messages
2010-04-26 17:45:29mark.dickinsoncreate