[phobos] phobos commit, revision 2186

Dmitry Olshansky dmitry.olsh at gmail.com
Fri Nov 26 05:29:38 PST 2010


On 26.11.2010 7:25, Don Clugston wrote:
> 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

On my AMD desktop, this produces:
> 0x1.bba4a9f774f49d0cp+4 0x1.543ef272830d3ed4p+67 -0x1.5a8e8efc9cec0dbp-35 -0x1.116d582237016688p+2
> 0x1.bba4a9f774f4c37ap+4 -0x1.5b2fa254744c96d8p+5 -0x1.bba4a9f774fdd508p+4 0x1.57e75c552cc1d47ep+5
> core.exception.AssertError at test_amd(16): Assertion failure
replacing the first assert with the second one make it pass, of course.

> 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.
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos



More information about the phobos mailing list