python 3.44 float addition bug?

2014-06-20 Thread FraserL
I think I found a strange bug in python 3.4.1, 

fresh install of

 https://www.python.org/ftp/python/3.4.1/python-3.4.1.amd64.msi 

and a fresh install of 
https://www.python.org/ftp/python/2.7.7/python-2.7.7.amd64.msi
to compare it to.

#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.01
0.02
0.03
0.04
0.05
0.060005
0.07
0.08
0.09
0.0
0.10999
0.11998
0.12998
0.13999
0.15
0.16
0.17
0.18002
0.19003


2.7.7 output:

0.01
0.02
0.03
0.04
0.05
0.06
0.07
0.08
0.09
0.1
0.11
0.12
0.13
0.14
0.15
0.16
0.17
0.18
0.19


I'm not hugely accustomed to Python, but this seems crazy to me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python 3.44 float addition bug?

2014-06-20 Thread FraserL
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  wrote in 
news:[email protected]:

> 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.060005
> 0.07
...
> 
> 
> I'm not hugely accustomed to Python, but this seems crazy to me.
> 

-- 
https://mail.python.org/mailman/listinfo/python-list