On Sun, 03 Aug 2008 16:50:22 +0200, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
> CNiall schrieb:
...
>>  >>> 0.2
>> 0.20000000000000001
...

> Welcome to the wonderful world of IEEE754. Just because other languages 
> shield you from the gory details they still are there. Python chose to 
> not do that, instead showing the rounding errors introduced and making 
> the developer decide how to deal with these.

Which other languages try to hide how floating-point numbers behave?

The correct way of dealing with this (you probably agree) is never to
expect infinite precision from floats, and design your code/algorithms
accordingly -- never use "if f1==f2:" and so on.

Floating-point is a tricky area. Lots of programmers (including me)
know too little about it.

/Jorgen

-- 
  // Jorgen Grahn <grahn@        Ph'nglui mglw'nafh Cthulhu
\X/     snipabacken.se>          R'lyeh wgah'nagl fhtagn!
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to