On Tue, 31 Jan 2012 18:13:29 +0100, Trass3r <u...@known.com> wrote:

Can anyone confirm this?
If yes, bug in clang, dmd or phobos?

Note that the dmd testsuite passes for me.

Clang behaves differently, but it's probably not a bug.

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

int main()
{
    long double foo = NAN;
    double a = foo;
    double b = NAN;
    double c = fabs(NAN);
    printf("%Lf %d\n", foo, (int)signbit(foo));
    printf("%f %d\n", a, (int)signbit(a));
    printf("%f %d\n", b, (int)signbit(b));
    printf("%f %d\n", c, (int)signbit(c));
}
----

double a = foo; // seems like "FSTP m64fp" doesn't preserve the sign bit

We need to fix the code in PortInitializer::PortInitializer() which relies on
sign preserving of NaN size conversions.

Reply via email to