smallest float number

Geoff Gerrietts geoff at gerrietts.net
Wed Feb 12 18:53:59 EST 2003


Quoting gabor (gabor at z10n.net):
> hi,
> 
> is there an easy way to write the smallest float number?
> 
> i just don't want to use things like
> a = -100000000000000000000.0
> 

Floats are funny. They've got two parts, a mantissa and an exponent,
but they look like one number to the casual observer.

The mantissa is a number, and the exponent is its multiplier. This
combination can express a very wide range of numbers with varying
precision -- for example, it may be possible to accurately represent
1.0, but not 10000000000000000001.0; the latter number might be
truncated to 10000000000000000000.0.

You can talk about a largest and smallest, but it's generally going to
be more meaningful to talk about what kind of range you can cover
without losing any information you care about.

As I understand it, this is system-dependent, and not immediately
obvious in any way.

--G.

-- 
Geoff Gerrietts <geoff at gerrietts net>          http://www.gerrietts.net/
     "Now, now my good man, this is no time for making enemies." 
      --Voltaire, on his deathbed, when asked to renounce Satan





More information about the Python-list mailing list