www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5628] New: std.math unittest disabled

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5628

           Summary: std.math unittest disabled
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: braddr puremagic.com



---
The test either takes an enormous amount of time or it goes into an infinite
loop somewhere.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 20 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5628




---
Reduced test case:

Must be built with debugging turned on, otherwise it doesn't loop:
  dmd -m64 -gc  bug-pow.d

module bug;

real pow(real x, ubyte n)  trusted pure nothrow
{
    real p = 1.0;
    ubyte m = n;

    switch (n)
    {
    default:
    }

    while (1)
    {
        if (n & 1)
            p *= x;
        n >>= 1;
        if (!n)
            break;
        x *= x;
    }
    return p;
}

int main()
{
    immutable real x = 46;
    immutable ubyte three = 3;
    assert(pow(x,three) == x * x * x);

    return 0;
}

Extracted from std/math.d, function:

typeof(Unqual!(F).init * Unqual!(G).init) pow(F, G)(F x, G n)  trusted pure
nothrow
if (isIntegral!(F) && isIntegral!(G))

And it's following unittest.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 30 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5628




---
The bug in comment 1 is fixed.  There are 3 asserts left that fail w/in
std.math:

   assert(pow(xd, neg2) == 1 / (x * x));
   assert(pow(xf, neg8) == 1 / ((x * x) * (x * x) * (x * x) * (x * x)));

   assert(feqrel(real.min_normal/8,real.min_normal/17)==3);

They're currently versioned out for x86_64

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 01 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5628


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|DMD                         |Phobos
            Summary|std.math unittest disabled  |std.math unittest disabled
                   |                            |- roundoff error in pow()
                   |                            |on SSE2
         OS/Version|Linux                       |All
           Severity|critical                    |normal



The remaining bug in comment 2 is just a rounding error.
The last bit of 1/ x*x  is different when the intermediate values are 80 bit
reals, vs when they are 64 bit doubles.

It is a bug, but it's not a compiler bug, just a fairly minor Phobos one.

Dropping severity to normal, and changing to Phobos.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 09 2013