NAN

Gordon McMillan gmcm at hypernet.com
Fri Sep 3 10:19:14 EDT 1999


Ken Koller wrote:

> Is there a constant defined as NAN for floats?
> 
> I noticed that 1.0E500 returns the string '1.#INF' and -1.0E500
> returns '-1.#INF' I was just wondering if you could do something
> like:
> 
> f = math.NAN
> f = math.INF
> f = -math.INF
> 
> etc...
> 
> I realize that NAN is implementation dependent and that Python
> shouldn't care about the IEEE type implementations.
> 
> Seems like it could be useful to have a constant defined for these.

Some months ago the Timbot (aka Tim Peters) posted some truly 
esoteric code that tries to discover what these are for your platform 
and C library. Deja news or the search at python.org should find it.

- Gordon




More information about the Python-list mailing list