"Smith" <[EMAIL PROTECTED]> wrote: > > I just ran into a curious behavior with small floating points, trying > to find the limits of them on my machine (XP). Does anyone know why the > '0.0' is showing up for one case below but not for the other? According > to my tests, the smallest representable float on my machine is much > smaller than 1e-308: it is
There are all sorts of ugly bits when working with all binary fp numbers (for the small ones, look for a reference on 'denormals'). I'm sure that Raymond has more than a few things to say about them (and fp in general), but I will speed up the discussion by saying that you should read the IEEE 754 standard for floating point, or alternatively ask on comp.lang.python where more users would get more out of the answers that you will recieve there. One thing to remember is that decimal is not the native representation of binary floating point, so 1e-100 differs from 1e-101 significantly in various bit positions. You can use struct.pack('d', flt) to see this, or you can try any one of the dozens of IEEE 754 javascript calculators out there. - Josiah _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com