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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 21 22:54:27 PDT 2009


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





--- Comment #1 from ZHOU Zhenyu <rinick at gmail.com>  2009-07-21 22:54:26 PDT ---
(In reply to comment #0)
> Maybe the while loop should be put into pow(F, uint) instead of pow(F, int)
> like the following:

what about:

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

pure nothrow F pow(F)(F x, uint n) // allow integer if n is uint
{
  ...
}

This also solve #2973

-- 
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