>>>>> Anjanesh Lekshminarayanan <m...@anjanesh.net> (AL) escribió:

>>>>> a = 1
>>>>> b = 25
>>>>> a / b
>AL> 0
>>>>> float(a) / b
>AL> 0.040000000000000001
>>>>> 

>>>>> from __future__ import division
>>>>> a = 1
>>>>> b = 25
>>>>> a / b
>AL> 0.040000000000000001
>>>>> 

>AL> In what simple way can I get just 0.04 ?

In addition to the answers others have given:

>>> 0.04
0.040000000000000001
>>> 

IIRC, Python 3.1 will give 0.04. But this doesn't mean the answer will
be mathematically equal to 0.04, just that it tries to make it less
painful. 
-- 
Piet van Oostrum <p...@cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to