Bizarre floating-point output

Nick Maclaren nmm1 at cus.cam.ac.uk
Mon Jan 8 14:39:55 CET 2007


x = (1.234567890125, 1.2345678901255)
print x
print x[0], x[1]

>>> (1.2345678901249999, 1.2345678901254999)
>>> 1.23456789012 1.23456789013

Is there a rational reason, or is that simply an artifact of the way
that the code has evolved?  It is clearly not a bug :-)


Regards,
Nick Maclaren.



More information about the Python-list mailing list