floating point rounding

hg hg at nospam.org
Fri Mar 9 08:45:59 EST 2007


hg wrote:

> Hi,
> 
> Here is my issue:
> 
> f = 1.5 * 0.01
> f
>>> 0.014999999999999999
> '%f' % f
>>>'0.015000'
> 
> 
> But I really want to get 0.02 as a result ... is there a way out ?
> 
> Thanks,
> 
> hg

round




More information about the Python-list mailing list