proposed language change to int/int==float (was: PEP0238 lament)

Paul Svensson paul at svensson.org
Thu Jul 26 11:32:55 EDT 2001


Skip Montanaro <skip at pobox.com> writes:

>    Paul> The most obvious problem is that it implies that every rational
>    Paul> can be represented as a float -- this is *severe* brokenness you
>    Paul> don't need.  [I think it also implies that floats with integral
>    Paul> values (1.0, etc.)  should turn into integers.]
>
>You can't do that.  Suppose that value you think is 1.0 really got truncated
>during a previous calculation because your fp hardware doesn't have enough
>bits and lost it?  If you convert that to the integer 1 you're screwed
>because you are pretending your inexact approximation of the real value is
>the real value.  You're better off admitting you have an inexact value and
>planning accordingly.  The only time the VM can convert from inexact to
>exact (e.g., float->rational, float->int) is when the programmer says you
>can with a cast.

In the long term, I think the only manageable solution would
be to separate the issue of exactness from the representation.

	/Paul (another one than the one above)



More information about the Python-list mailing list