[issue7281] copysign() with NaN arguments on OpenSolaris
report at bugs.python.org
Sun Nov 8 14:49:13 CET 2009
Stefan Krah <stefan-usenet at bytereef.org> added the comment:
I hope this won't be getting too complex. :)
Firstly, I agree that this is perhaps not a bug at all. I reported it
because I seemed possible that Python2.x had a deliberate workaround for
this issue which somehow got lost in 3.x.
Secondly, I didn't mention that I'm running OpenSolaris on KVM since I
can't get it to install on physical hardware. However, I don't think KVM
plays a role here since gcc produces 'normal' results.
So, the problem combination is:
Ubuntu64bit -> KVM -> OpenSolaris32bit/suncc/Py3k
On the C level, here's an example:
double x = NAN;
printf("%f %f\n", x, copysign(1.0, x));
This gives -NaN, -1.000000 with suncc and NaN, 1.000000 with gcc.
Back to Python:
sys.float_repr_style is 'legacy'.
It looks like the C99 fenv functions are pretty much supported, but I
don't know since when. I found man pages from 2003 for fenv and from
2006 for the fe*() functions.
This for example works:
#pragma STDC FENV_ACCESS ON
save_round = fegetround();
setround_ok = fesetround(FE_DOWNWARD);
assert(setround_ok == 0);
I could test changes that you make (preferably in p3k head, so I could
just pull them). But as I said: If the 'proper' behavior in 2.x was not
a deliberate workaround, there's really no need to change anything.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list