digitalmars.D.bugs - [Issue 3202] New: std.math.pow cause dead loop
- d-bugmail puremagic.com (28/28) Jul 21 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3202
 - d-bugmail puremagic.com (19/21) Jul 21 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3202
 - d-bugmail puremagic.com (10/10) Oct 11 2009 http://d.puremagic.com/issues/show_bug.cgi?id=3202
 - d-bugmail puremagic.com (11/11) Jun 22 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3202
 - d-bugmail puremagic.com (9/9) Aug 11 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3202
 - d-bugmail puremagic.com (6/6) Aug 11 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3202
 
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 puremagic.com
        ReportedBy: rinick 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: -------
 Jul 21 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3202Maybe 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 { ... } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
 Jul 21 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3202
Andrei Alexandrescu <andrei metalanguage.com> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |andrei metalanguage.com
-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
 Oct 11 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3202
Lars T. Kyllingstad <bugzilla kyllingen.net> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla kyllingen.net
         AssignedTo|andrei metalanguage.com     |bugzilla kyllingen.net
00:14:42 PDT ---
http://www.dsource.org/projects/phobos/changeset/1677
-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
 Jun 22 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3202
ZY Zhou <rinick gmail.com> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
 Aug 11 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3202 02:43:44 PDT --- Fixed DMD 2.048 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
 Aug 11 2010








 
 
 
 d-bugmail puremagic.com 