Does Python have "not a number" floating point values?

moron at Glue.umd.edu.bbs moron at Glue.umd.edu.bbs
Mon Jul 17 20:50:01 EDT 2000


(Huaiyu Zhu) said:
>On Mon, 17 Jul 2000 16:10:36 -0700, Russell E. Owen
><owen at astroNOJNK.washington.edu.invalid> wrote:
>>Does Python support any sort of floating point "not a number"
>>(e.g. IEEE infinity)?

Python floats inherit the behavior of your C platform's doubles, so on
an IEEE-754 system, they will act fairly IEEE-like, as Huaiyu
demonstrates:

>Inf = inf = 1e300**2
>NaN = nan = inf - inf

However, according to a recent post, the OpenVMS port of python uses
VAX-format math[1], which has less exponent range than IEEE.  I think
that that expression for Inf will not parse there.  I don't even know
if VAXen have Inf or NaN.

Warren Focke

[1] http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=640022415&fmt=text
--
If you feel that you have both feet planted on level ground, then the
university has failed you. -Robert Goheen, President, Princeton University



More information about the Python-list mailing list