Looking for the greatest negative float value
Bengt Richter
bokr at oz.net
Wed Jun 11 16:36:38 EDT 2003
On Wed, 11 Jun 2003 18:52:17 +0200, "Gilles Lenfant" <glenfant at NOSPAM.bigfoot.com> wrote:
>Hi,
>
>I need the same as...
>
>import sys
>negmaxint = - sys.maxint -1
>
>... but for float data
>
>any hint ?
>
To get what you want (wyw) maybe you have to compute it. E.g.,
>>> fmin = -1.0
>>> while 1:
... fnext = fmin*2.0-1.0
... if fnext==fmin: break
... wyw = fmin
... fmin = fnext
...
>>> `wyw`
'-8.9884656743115795e+307'
I'm not sure how portable this is, but the actual value
can surely vary according to platform. I suppose you could set up a site-specific
initialization to put such a value as sys.minfloat if you wanted to.
The timbot will have the best info ;-)
Regards,
Bengt Richter
More information about the Python-list
mailing list