On 06/20/2014 05:57 PM, FraserL wrote:
I think I found a strange bug in python 3.4.1,
No, this is not a bug in Python. There is a limitation of floating point arithmetic in *all* languages, on *all* computers. Python 3 may be the first to let you see this limitation, but it's always been there.
See https://docs.python.org/2/tutorial/floatingpoint.html for more details. Gary Herron
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.060000000000000005 0.07 0.08 0.09 0.09999999999999999 0.10999999999999999 0.11999999999999998 0.12999999999999998 0.13999999999999999 0.15 0.16 0.17 0.18000000000000002 0.19000000000000003 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