On Mon, 07 Sep 2009 08:23:58 -0700, Mark Dickinson wrote: > On Sep 7, 3:47 pm, kj <no.em...@please.post> wrote: >> Is there some standardized way (e.g. some "official" module of such >> limit constants) to get the smallest positive float that Python will >> regard as distinct from 0.0? >> >> TIA! >> >> kj > > There's sys.float_info.min: ... > But that only gives you the smallest *normal* positive float, which is > 2**-1022 on most systems.
The IEEE standard mandates a "nextafter" function which takes a float as an argument, and returns the next greater float. Tim Peters gave an implementation here: http://mail.python.org/pipermail/python-list/2001-August/099152.html Unfortunately, it doesn't work for negative floats, zero or denormalised floats. -- Steven -- http://mail.python.org/mailman/listinfo/python-list