[Python-bugs-list] [ python-Bugs-737648 ] Error on handling nan

SourceForge.net noreply@sourceforge.net
Wed, 14 May 2003 18:48:52 -0700


Bugs item #737648, was opened at 2003-05-14 08:12
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=737648&group_id=5470

Category: Python Interpreter Core
>Group: Feature Request
>Status: Closed
>Resolution: Later
Priority: 5
Submitted By: Bernhard Seiwald (bseiwald)
Assigned to: Nobody/Anonymous (nobody)
Summary: Error on handling nan 

Initial Comment:
We found some strange behavior of the handling of "nan"
if "nan" is used in if-statements.

We use Python 2.2 (python2-2.2.2-11.7.3.src.rpm).
In the following i show the results of the
"experiments" with "nan", "inf" and usual floats:


$ python
Python 2.2.2 (#1, Jan 30 2003, 21:26:22) 
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> a=float(1.2345)
>>> b=float("inf")
>>> c=float("nan")
>>> if a==b:
...  print "equal"
... 
>>> if a==c:
...  print "equal"
... 
equal
>>> if b==c:
...  print "equal"
... 
equal


Bernhard Seiwald seiwald@itp.tugraz.at


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2003-05-14 21:48

Message:
Logged In: YES 
user_id=31435

Sorry, but all behavior in the presence of NaNs and infinities 
and signed zeroes is a platform- and release- dependent 
accident.  Even that float("inf") didn't raise an exception for 
you is an accident (e.g., in Python 2.2.2 on Windows, it 
does raise an exception).

I've added this to PEP 42's "non-accidental 754 support" 
feature request; you may also be interested in PEP 754 
(support for 754 special values).  Python has no 754 story 
now.  If you want it to have one, consider volunteering work 
toward that end.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=737648&group_id=5470