python 3.44 float addition bug?

FraserL fraser.long+usenet at gmail.com
Fri Jun 20 21:11:43 EDT 2014


Ok I've seen https://docs.python.org/2/tutorial/floatingpoint.html now 
thanks to Yhg1s on #python

I bet you get this kind of thing a lot, sorry :-/


FraserL <fraser.long+usenet at NOSPAMgmail.com> wrote in 
news:XnsA35313E634BA0fraserlonggmailcom34 at 216.196.109.145:

> I think I found a strange bug in python 3.4.1, 
...
> 
> #test code
> z = 0.01
> p = 0.0
> for x, y in enumerate(range(1, 20)):
>     p += z
>     print(p)
> #end 
> 
> 
> 3.4.1 output:
> 
...
> 0.05
> 0.060000000000000005
> 0.07
...
> 
> 
> I'm not hugely accustomed to Python, but this seems crazy to me.
> 




More information about the Python-list mailing list