Author skrah
Recipients mark.dickinson, skrah
Date 2009-11-08.13:49:10
SpamBayes Score 1.22125e-15
Marked as misclassified No
Message-id <>
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:

#include <stdio.h>
#include <math.h>

int main(void)
        double x = NAN;
        printf("%f  %f\n", x, copysign(1.0, x));
        return 0;

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:

#include <stdio.h>
#include <stdio.h>
#include <fenv.h>
#include <assert.h>

int main(void)
        #pragma STDC FENV_ACCESS ON
        int save_round;
        int setround_ok;

        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.
Date User Action Args
2009-11-08 13:49:14skrahsetrecipients: + skrah, mark.dickinson
2009-11-08 13:49:13skrahsetmessageid: <>
2009-11-08 13:49:12skrahlinkissue7281 messages
2009-11-08 13:49:11skrahcreate