Floating point failures on x64
Daniel Murphy
yebblies at nospamgmail.com
Thu Feb 23 21:57:22 PST 2012
I've been trying to fix issue 4155, but it's a little difficult without the
ability to test on x64 (I'm on win32). Could anybody compile the following
code for me with 'dmd -m64' with this patch
https://github.com/D-Programming-Language/dmd/pull/760 and send me the
disassembly?
Thanks.
template TT4155(T...) { alias T TT4155; }
void test4155()
{
static int test4155a()
{
T getnan(T)() { return T.nan; } // OPcall
static T getnanu(T)() { return T.nan; } // OPucall
foreach(T; TT4155!(float, double, real, ifloat, idouble, ireal,
cfloat, cdouble, creal))
{
auto f = getnan!T();
if (!__ctfe) // force f into memory
asm { nop; };
assert(!(T.nan == 0), T.stringof);
assert(!(f == 0), T.stringof);
assert(!(getnan!T == 0), T.stringof);
assert(!(getnanu!T == 0), T.stringof);
assert((T.nan != 0), T.stringof);
assert((f != 0), T.stringof);
assert((getnan!T != 0), T.stringof);
assert((getnanu!T != 0), T.stringof);
}
return 1;
}
auto a = test4155a();
enum b = test4155a();
}
void main()
{
test4155();
}
More information about the Digitalmars-d
mailing list