[phobos] phobos commit, revision 2186

Don Clugston dclugston at googlemail.com
Thu Nov 25 20:25:20 PST 2010


Thanks! That's fantastic. It clearly shows we have a one-bit
difference at iteration 25.
This now looks very much like a CPU bug.
I think that if I'm correct, this should be a reduced test case.

import std.mathspecial;
import std.stdio;

void main()
{
    real a = 0x1.ff1275ae5b939bcap-41L;
    real b = 0x1.034f2a66cd21p+62L;
    real x = 0x1.4f5afe0ce690d95cp-63L;
    real s = 0x1.0076fc5cc795a06cp+40L;

    real u = a * log(x);
    real t = logGamma(b) - logGamma(a) - logGamma(b) + u + log(s);
    real y = exp(t);
    writefln("%a %a %a %a", logGamma(a), logGamma(b), u, t);
    writefln("%a %a %a %a", log(s), log(x), log(a), log(b));
    assert(y==0x1.c91a61a8fc916338p-7L); // Intel
//    assert(y==0x1.c91a61a8fc91633ap-7L); // AMD
}

On my Intel box, this prints:

0x1.bba4a9f774f49d0ap+4 0x1.543ef272830d3ed4p+67 -0x1.5a8e8efc9cec0dbp-35 -0x1.1
16d582237016688p+2
0x1.bba4a9f774f4c37ap+4 -0x1.5b2fa254744c96d8p+5 -0x1.bba4a9f774fdd508p+4 0x1.57
e75c552cc1d47ep+5

I suspect that we'll ever see a difference in the last line, which
would indicate a one-bit error in log.
But if all the numbers are the same, and the assert still fails, it's
a one-bit error in exp.
If the values in the last line are the same, but the ones in the first
line are different, it's an error in poly.
Either way, if the assert fails on AMD, we're just about down the asm.


More information about the phobos mailing list