Bug 3202 basically says that std.math.pow(someFloat, int.min) enters an
infinite loop because int.min == -int.min.  Here's my suggestion for a
fix:

--- std/math.d  (revision 1672)
+++ std/math.d  (working copy)
@@ -2904,6 +2904,12 @@
             return 1 / x;
         case -2:
             return 1 / (x * x);
+        static if (isSigned!G)
+        {
+        case G.min:
+            enum absGmin = cast(Unsigned!G)(-(G.min+1)) + 1;
+            return 1 / pow(x, absGmin);
+        }
         default:
         }

I'm wary of doing anything to std.math, since it's so fundamental and
performance-critical.  So please, speak up if you see a problem with
this patch.

-Lars

_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to