How to represent the infinite ?
Chris Barker
Chris.Barker at noaa.gov
Thu Jun 20 14:09:28 EDT 2002
Christophe Delord wrote:
> There is another simple solution. Just use a float that is bigger than any 64-bit float. For example 10^1000. This float has a special encoding meaning +oo !
this is part of the IEEE 754 standard for floating point computation
(http://cch.loria.fr/documentation/IEEE754/) It is not guaranteed to be
implimented by Python (someone please correct me if I'm wrong). whether
this works is a function of the machine, compiler and library used to
compile Python. I'm not sure how common it is, but if you want your code
portable, it may not be reliabel on all machines, which is too bad,
because IEEE 754 is pretty darn good standard.
BTW: I'd love to see literals for Inf, -Inf and NaN in Python.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the Python-list
mailing list