[New-bugs-announce] [issue7281] copysign() with NaN arguments on OpenSolaris

Stefan Krah report at bugs.python.org
Sat Nov 7 21:41:39 CET 2009


New submission from Stefan Krah <stefan-usenet at bytereef.org>:

Sorry to report so many obscure corner cases. With the combination
Opensolaris/suncc/Python3.x copysign() gives reversed results when the
second argument is a NaN. The bug is in the C99 copysign() function
(OpenSolaris/suncc), but Python2.6 seems to have a workaround: 

Python 3.2a0 (py3k:76144, Nov  7 2009, 18:50:00) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from math import *
>>> copysign(1.0, float("nan"))
-1.0
>>> copysign(1.0, float("-nan"))
1.0

Python 2.6.2 (r262:71600, Nov  7 2009, 19:29:52) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from math import copysign
>>> copysign(1.0, float("nan"))
1.0
>>> copysign(1.0, float("-nan"))
-1.0
>>>

----------
messages: 95027
nosy: mark.dickinson, skrah
severity: normal
status: open
title: copysign() with NaN arguments on OpenSolaris
type: behavior
versions: Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7281>
_______________________________________


More information about the New-bugs-announce mailing list