[Python-Dev] Decimal data type issues

Edward Loper edloper at gradient.cis.upenn.edu
Fri Apr 16 00:52:04 EDT 2004


Tim Peters wrote:
>>I can think of at least one real use for exponents outside this range:
>>probabilities.  E.g., if I'm using probabilistic models to estimate
>>P(author|text), I end up multiplying together a large number of very low
>>probabilities, and the total probability could easily get this small.
> 
> No, it couldn't -- and if you worked hard to contrive an example, a
> probability in the end smaller than the probability that the universe will
> spontaneously decide to run time backwards for a century is accurately
> enough represented by 0 (which your example will underflow to).

As long as the limits are soft (and can be changed), I won't object too 
strenuously, because someone who wanted extremely large/small numbers 
could use them.  But...

   - I do believe that there will be use cases for exponents outside this
     range.  Just because there's no physical quantities that are
     reasonably measured with these numbers, doesn't mean that there
     won't be abstract quantities that are reasonably measured with huge
     numbers.

   - I don't believe that signaling an error when a number goes outside
     this range will help catch any errors.  What type of error are we
     expecting to catch here?  If this is such a problem, then why
     doesn't long also have a max/min?

Basically, I don't see much loss from adding the constraints, but I also 
see very little gain.

-Edward



More information about the Python-Dev mailing list