[ python-Bugs-1492293 ] Wierd Floating Point on FreeBSD4
SourceForge.net
noreply at sourceforge.net
Mon May 22 12:45:00 CEST 2006
Bugs item #1492293, was opened at 2006-05-21 01:34
Message generated for change (Comment added) made by mwh
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1492293&group_id=5470
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.4
Status: Closed
Resolution: Invalid
Priority: 5
Submitted By: David Abrahams (david_abrahams)
Assigned to: Nobody/Anonymous (nobody)
Summary: Wierd Floating Point on FreeBSD4
Initial Comment:
This is just about the weirdest thing I've ever seen.
Python 2.4.2 (#1, Jan 17 2006, 09:30:19)
[GCC 2.95.2 19991024 (release)] on freebsd4
---- nan.py ----
inf = 1e300000
nan = inf/inf
print nan
---- nan.py ----
---- tst.py ----
import nan
---- tst.py ----
% python -c "import nan"
NaN
% python -c "import tst"
NaN
Now I edit tst.py
---- tst.py ----
#
import nan
---- tst.py ----
% python -c "import nan"
Traceback (most recent call last):
File "<string>", line 1, in ?
File "nan.py", line 2, in ?
nan = inf/inf
ZeroDivisionError: float division
% python -c "import tst"
Traceback (most recent call last):
File "<string>", line 1, in ?
File "tst.py", line 1, in ?
import nan
File "nan.py", line 2, in ?
nan = inf/inf
ZeroDivisionError: float division
% rm *.pyc
% python -c "import tst"
NaN
% python -c "import nan"
Traceback (most recent call last):
File "<string>", line 1, in ?
File "nan.py", line 2, in ?
nan = inf/inf
ZeroDivisionError: float division
% python -c "import tst"
Traceback (most recent call last):
File "<string>", line 1, in ?
File "tst.py", line 1, in ?
import nan
File "nan.py", line 2, in ?
nan = inf/inf
ZeroDivisionError: float division
----------------------------------------------------------------------
>Comment By: Michael Hudson (mwh)
Date: 2006-05-22 11:45
Message:
Logged In: YES
user_id=6656
Huh what? That code is supposed to be dead on real systems now. What does
this say for you:
>>> float.__getformat__('double')
'IEEE, big-endian'
? I take it test_float still passes.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2006-05-22 11:28
Message:
Logged In: YES
user_id=31435
mwh: Heh. It's sure not better under Windows on current trunk:
C:\Code\python\PCbuild>python -c "import nan"
-1.#IND
Exception exceptions.SystemError: 'frexp() result out of
range' in 'garbage collection' ignored
Fatal Python error: unexpected exception during garbage
collection
And now that the .pyc file exists:
C:\Code\python\PCbuild>python -c "import nan"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ValueError: bad marshal data
This is nan.py, BTW:
"""
inf = 1e300000
nan = inf/inf
print nan
"""
Changing that to "inf = 1e300*1e300" doesn't help in the
trunk, because of its more ambitious constant folding.
----------------------------------------------------------------------
Comment By: Michael Hudson (mwh)
Date: 2006-05-22 11:00
Message:
Logged In: YES
user_id=6656
Also, this probably won't be a problem in 2.5.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2006-05-22 10:32
Message:
Logged In: YES
user_id=21627
Closing this as "not a bug". Notice that this judgement is
difficult to make, as the report is incomplete: you report
what you did (good), what happened (good), but not what you
expected to happen, or why you think the behaviour is
incorrect - only that it is "weird". As Tim mentioned
indirectly, this is intentional.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2006-05-21 16:09
Message:
Logged In: YES
user_id=31435
Python doesn't know anything about IEEE special values, and
in particular what the marshal format (used for code
objects) does with infinities and NaNs is a
platform-dependent accident.
Try changing
inf = 1e300000
to
inf = 1e300 * 1e300
to stop Python from _trying_ to marshal/unmarshal a floating
infinity on that box. I bet your problems will go away then.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1492293&group_id=5470
More information about the Python-bugs-list
mailing list