[Issue 3202] New: std.math.pow cause dead loop

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 21 21:28:36 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3202

           Summary: std.math.pow cause dead loop
           Product: D
           Version: 2.031
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: rinick at gmail.com


the case is:

   pow(1.01, int.min); 

because int.min == -int.min


Maybe the while loop should be put into pow(F, uint) instead of pow(F, int)
like the following:

pure nothrow F pow(F)(F x, int n)
{
   if (n < 0)
   {
      return 1 / pow(x, cast(uint)(-n));
   }
   return pow(x, cast(uint)n);
}

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


More information about the Digitalmars-d-bugs mailing list