Smallest float different from 0.0?
steven at REMOVE.THIS.cybersource.com.au
Tue Sep 8 05:02:43 CEST 2009
On Mon, 07 Sep 2009 08:23:58 -0700, Mark Dickinson wrote:
> On Sep 7, 3:47 pm, kj <no.em... at 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?
> 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
Unfortunately, it doesn't work for negative floats, zero or denormalised
More information about the Python-list