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 mark.dickinson, rhettinger, steven.daprano
Date 2009-01-02.14:09:34
SpamBayes Score 0.003577005
Marked as misclassified No
Message-id <1230905376.02.0.82600617505.issue4796@psf.upfronthosting.co.za>
In-reply-to
Content
> Just for the avoidance of all doubt, do you mean the largest exponent 
> with the number normalised to one digit to the right of the decimal 
> place?

No.  I'm using 'exponent' in the sense described in the standard.  See:

http://speleotrove.com/decimal/dbover.html

Equivalently, it's the value of the _exp attribute for a Decimal 
instance.  (For the purposes of disambiguation, the alternative exponent 
that you describe above is often referred to as the 'adjusted exponent' 
in the documentation and code.)

Briefly, every finite Decimal can be thought of as a triple (sign, 
coefficient, exponent), representing the value (-1)**sign * coefficient 
* 10**exponent, with the coefficient an integer.  It's this exponent 
that should be maximized.

> Because 1e1 = 0.1e2 = 0.01e3 = ... and there is no "largest 
> exponent possible"

All these have exponent 1:

>>> Decimal('1e1')._exp
1
>>> Decimal('0.1e2')._exp
1
>>> Decimal('0.01e3')._exp
1

IOW, leading zeros have no significance;  only trailing zeros do.

> Also, why not just extend the Decimal() constructor to accept a float 
> as the argument? Why have a separate from_float() method at all?

This was discussed extensively when the decimal module was being 
proposed;  see the Decimal PEP for arguments against this.
History
Date User Action Args
2009-01-02 14:09:36mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, steven.daprano
2009-01-02 14:09:36mark.dickinsonsetmessageid: <1230905376.02.0.82600617505.issue4796@psf.upfronthosting.co.za>
2009-01-02 14:09:35mark.dickinsonlinkissue4796 messages
2009-01-02 14:09:34mark.dickinsoncreate