[ python-Bugs-1481296 ] long(float('nan'))!=0L

SourceForge.net noreply at sourceforge.net
Wed May 3 21:09:29 CEST 2006

Bugs item #1481296, was opened at 2006-05-03 14:39
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Erik Dahl (edahl)
Assigned to: Nobody/Anonymous (nobody)
Summary: long(float('nan'))!=0L

Initial Comment:
on all platforms I can test long(float('nan'))=0L

But on maxos X intel long(float('nan'))!=0L

it returns:


This is a problem because:

>>> 344 - long(float('nan'))    
Objects/longobject.c:1645: failed assertion `borrow == 0'
Abort trap


>Comment By: Tim Peters (tim_one)
Date: 2006-05-03 15:09

Logged In: YES 

Try it on Windows and you'll get:

>>> long(float('nan'))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: invalid literal for float(): nan

Nothing about the behavior of NaNs, infinities, or signed
zeroes is defined or guaranteed by Python.  You use them at
your own risk, and their behavior does vary wildly in
practice (according to the HW, OS, C compiler, C library,
and even the C compiler flags specified when compiling Python).


You can respond by visiting: 

More information about the Python-bugs-list mailing list