[Python-Dev] Decimal data type issues
Tim Peters
tim.one at comcast.net
Mon Apr 19 10:57:52 EDT 2004
[Edward Loper]
> ...
> - 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.
You don't have a real use case, Edward (if you did, you would have given it
by now <wink>). YAGNI. Note that GNU GMP's arbitrary-precision float types
also have bounds on exponent magnitude (but not on precision) -- this is
conventional.
> - 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?
Overflow, and possibly underflow. Typical when a correct iterative
algorithm is fed an input outside its radius of convergence, or an incorrect
iterative algorithm is fed anything.
> If this is such a problem, then why doesn't long also have
> a max/min?
For the same reason Decimal doesn't have a bound on precision: exact
calculations can require any number of digits. Exponents kick in when the
calculation becomes approximate (when precision is exceeded).
More information about the Python-Dev
mailing list