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

Michael Abbott michael.g.abbott at ntlworld.com
Tue Jul 24 13:55:14 EDT 2001


Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> wrote in
news:slrn.pl.9lrdbk.ae3.qrczak at qrnik.zagroda: 

> Tue, 24 Jul 2001 09:44:57 -0600, Bjorn Pettersen <BPettersen at NAREX.com>
> pisze: 
> 
>> I think perhaps an equally interesting example is something like:
>> 
>>   2L**128/2
>> 
>> which currently gives an exact result, but under the proposed new
>> semantics would give an approximation... 
> 
> That's why I propose rationals.
> 
>> If we're going to change basic behaviors it would be better if we had
>> a consistent semantic model first. 
> 
> In my model there are four builtin numeric types: int, rational,
> float, and complex. The intent is that floats approximate real numbers.

Unfortunately, this isn't really all that consistent.  Consider the 
calculation

    	sqrt(2)**2 == 2

By pretty much the same arguments as have been used elsewhere in this 
discussion, I'm sure that you would expect this to evaluate to true.

Hmm.  Think about it.



More information about the Python-list mailing list