ARM testers, make note.

Iain Buclaw ibuclaw at ubuntu.com
Thu Aug 22 16:34:39 PDT 2013


On 22 August 2013 20:45, Johannes Pfau <nospam at example.com> wrote:
> Am Fri, 16 Aug 2013 18:33:14 +0200
> schrieb "Iain Buclaw" <ibuclaw at ubuntu.com>:
>
>> I've pushed in pure implementations of functions in std.math,
>> removing the workaround in core.stdc.math.
>>
>> This passes for x64/x32. Can any ARM testers please report any
>> problems causecd by this update?
>>
>> Thanks
>> Iain.
>
> I did a complete pass through the std.math unit tests. As soon as these
> issues are addressed, std.math unit tests should succeed on ARM:
>
> Some more small bugs:
> (see also
> https://github.com/jpf91/GDC/commit/63890f543f60d55bad3dc6bced4d14bc159128e6
> )
>
> ==========================
> In isInfinity we should check for 11 binary '1's, not 12 right?
>
>         return ((*cast(ulong *)&x) & 0x7FFF_FFFF_FFFF_FFFF)
>             == 0x7FF8_0000_0000_0000;
>
> =>
>
>         return ((*cast(ulong *)&x) & 0x7FFF_FFFF_FFFF_FFFF)
>             == 0x7FF0_0000_0000_0000;
> ==========================
> In frexp:
>
> vu[F.EXPPOS_SHORT] = cast(ushort)((0x8000 & vu[F.EXPPOS_SHORT]) |
> 0x3FE0);
>
> =>
>
> vu[F.EXPPOS_SHORT] = cast(ushort)((0x800F & vu[F.EXPPOS_SHORT]) |
> 0x3FE0);
> ==========================
> Why is ex in frexp unsigned? This line fails because of this:
> exp = (ex - 0x3FE0) >> 4;
> here ex is always zero so the subtraction doesn't work as ex is
> unsigned
> ==========================
>
>

Make Don aware of this. But looks ok to me.  Does it fail in the same
way for double on x86/x86_64?


>
>
> Failing unit tests:
> (see also
> https://github.com/jpf91/GDC/commit/0d7b3feafdb3629aeccb44b2a28d3344c7675d2f
> )
> ==========================
> assert(exp2(0.5L)== SQRT2); //Only 52 mantissa bits are equal
> ==========================
> real n = frexp(0x1p-16384L, x); //value is too small to fit in double
> ==========================
>
> real y = vals[i][1];
> real z = vals[i][2];
> real h = hypot(x, y);
> For some values only 52 mantissa bits are equal
> ==========================
> assert(pow(xf, neg8) == 1 / ((x * x) * (x * x) * (x * x) * (x * x)));
> //Only 52 mantissa bits are equal
> ==========================
> assert(pow(xf, neg8) == 1 / ((x * x) * (x * x) * (x * x) * (x * x)));
> Fails in exactly the same way on dpaste:
> http://dpaste.dzfl.pl/4c794ab8
> ==========================
> assert(pow(x, neg3) == 1 / (x * x * x));
> //Only 52 mantissa bits are equal
> ==========================
> assert(feqrel(real.min_normal / 8, real.min_normal / 17) == 3);
> //feqrel returns spectacular -732 equal bits. But it's the same on x86
> //with double so it's a bug in the test case. I can't fix it as I
> //don't know what it's supposed to do

These are problems that std/math does assume 80bit precision in most
of it's tests.


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the D.gnu mailing list