smallest float number

Jp Calderone exarkun at intarweb.us
Thu Feb 13 01:13:30 CET 2003


On Thu, Feb 13, 2003 at 12:51:19AM +0100, gabor wrote:
> On Thu, 2003-02-13 at 00:29, Mark McEahern wrote:
> > [gabor]
> > > is there an easy way to write the smallest float number?
> > > 
> > > i just don't want to use things like
> > > a = -100000000000000000000.0
> > 
> > does something like this help:
> > 
> > start = 10.0
> > divide_by = 10.0
> > 
> > while start != 0:
> >   start = start / divide_by
> >   print start
> :)
> 
> but:
> 
> sorry, maybe i wasn't clear:
> i want the negativest float.... something like minus-infinity
> 
> like the "largest*(-1.0)"...

ieee754 defines the largest negative single precision floating point value
to be -1.70141173e+38 and the largest negative double precision floating
point value to be -1.7976931348623157e+308.  In addition, some systems
define the largest negative quadruple precision floating point value to be
-1.18973149535723176502e+4932.  Python gives access to the second of these
types in all cases, I believe, unless built with special flags.

  Jp

-- 
#!/bin/bash
( LIST=(~/.netscape/sigs/*.sig)
  cat ${LIST[$(($RANDOM % ${#LIST[*]}))]}
  echo --$'\n' `uptime` ) > ~/.netscape/.signature
-- 
 up 4 days, 4:28, 5 users, load average: 0.00, 0.00, 0.00
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030212/ea4ddb17/attachment.pgp>


More information about the Python-list mailing list