numeric.c:S_mulexp10 -- quit when you can
[p5sagit/p5-mst-13.2.git] / numeric.c
index d214416..1cb24d2 100644 (file)
--- a/numeric.c
+++ b/numeric.c
@@ -766,8 +766,11 @@ S_mulexp10(NV value, I32 exponent)
        if (exponent & bit) {
            exponent ^= bit;
            result *= power;
+           /* Floating point exceptions are supposed to be turned off,
+            *  but if we're obviously done, don't risk another iteration.  
+            */
+            if (exponent == 0) break;
        }
-       /* Floating point exceptions are supposed to be turned off. */
        power *= power;
     }
     return negative ? value / result : value * result;