off topic but please forgive me me and answer
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Fri Apr 2 01:40:45 EDT 2010
On Thu, 01 Apr 2010 22:34:46 -0500, Tim Chase wrote:
>> Tim, I'm sure you know the answer to this, but for the benefit of the
>> Original Poster, the problem is that you need to promote *both*
>> divisions to floating point. Otherwise one of them will give int 0,
>> which gives 0.0 when multiplied by 0.5.
>>
>>>>> 1.0/2 * 1/2.0
>> 0.25
>
> You can get away with just promoting one of them...you just have to
> promote the _correct_ one
Doh!
Of course you do. I knew that!
--
Steven
More information about the Python-list
mailing list