On 2007-02-28, jeff <[EMAIL PROTECTED]> wrote:
> On Feb 27, 7:05 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>> Hi, I have the following functions,  but ' dx = abs(i2 - i1)/min(i2,
>> i1)' always return 0, can you please tell me how can i convert it from
>> an integer to float?
>>
>> def compareValue(n1, n2):
>>     i1 = int(n1)
>>     i2 = int(n2)
>>
>>     dx = abs(i2 - i1)/min(i2, i1)
>>     print dx
>>     return dx < 0.05
>
> x = x + 0.0

How, um, perlesque.

I rather think that this is a bit more pythonic:

x = float(x)

-- 
Grant Edwards                   grante             Yow!  I'm a fuschia bowling
                                  at               ball somewhere in Brittany
                               visi.com            
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to