Against PEP 240

Robin Becker robin at jessikat.fsnet.co.uk
Tue May 29 19:31:29 EDT 2001


In article <mailman.991165483.26639.python-list at python.org>, Paul
Prescod <paulp at ActiveState.com> writes
>Robin Becker wrote:
....
>
>Wait a second. Are you saying that you don't mind if a 5.3 literal is
>interpreteted as rational as long as there is an easy way to get floats
>with 5.3f? I think everyone would agree that there should be an easy way
>to get at floats.
...
I prefer float literals as the default, but I fear this argument is
going against me. If that is the case I would prefer that a simple
notation be available. The pep proposes d.dddde[sign]ddd ie exponential
notation to indicate fp. If we're being sensible we ought to generalise
exponential notation to allow very large rationals to be as easily
available as floats are today. Then I can wait around for the result of
rat(1+1e999999999,1)/rat(3e-999999999,1) to be computed. 

>> Are complex numbers, floats and rationals and ints to be freely mixable?
>
>As far as I know. A float is an inexact (and high performance) rational
>and a  rational is a complex number without an imaginary part. 
>
The normalised IEEE values are exact. Loss of precision is a consequence
of the finite nature of the result space. Whatever the algorithm the
result is exact although it may be wrong! :) Loss of precision may lead
to a so called 'inexact' result ie some indication that precision has
been lost. In really bad cases infinities may result although these are
still part of a finite set and should normally be regarded as exact :)
-- 
Robin Becker



More information about the Python-list mailing list