PEP0238 lament

Terry Reedy tjreedy at home.com
Wed Jul 25 00:55:07 EDT 2001


"Gareth McCaughan" <Gareth.McCaughan at pobox.com> wrote in message
news:slrn9ls1u2.2fm.Gareth.McCaughan at g.local...
> Guido van Rossum wrote:
>
> > Hm, IMO the problem is different.  Python's numerical model
*almost*
> > embeds the integers in the floats.  (They should've been called
reals,
> > but that mistake is too insignificant to want to fix. :-)

Not at all.  Python ints correspond to a subset of floats on 32-bit
machines but not on 64-bit machines (unless floats are also extended
sufficiently.  Python longs way outnumber floats, which is why
long/long->long is generally more accurate than long/long->float.

> I'm glad they weren't, because floats do not have the semantics
> of reals. More precisely, the class of floats is very different
> from the class of reals, and the operations defined on them
> differ considerably from the operations of the same names on
> the reals.

Indeed.  Floats are a peculiar and sharply-finite subset of rationals
(whereas longs are vaguely finite in number).  No wonder we have
trouble calculating with them.

Terry J. Reedy





More information about the Python-list mailing list