On Saturday, June 21, 2014 1:57:19 AM UTC+1, FraserL wrote:
> I'm not hugely accustomed to Python, but this seems crazy to me.

Floating points values use finite amount of memory, and  cannot accurately 
represent infinite amount of numbers, they are only approximations. This is 
limitation of float type and applies to any languages that uses types supported 
directly by cpu.
To deal with it you can either use decimal.Decimal type that operates using 
decimal system and saves you from such surprises (but it will be much slower 
and incompatible with c code that doesn't handle decimals or converts them to 
floats) or use epsilon for every comparison and rounding/formatting with 
limited   precision for displaying.

Few more details are here: http://floating-point-gui.de/errors/comparison/
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to