This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
numeric.c:S_mulexp10 -- quit when you can
authorCraig A. Berry <craigberry@mac.com>
Fri, 7 Jun 2002 18:29:31 +0000 (13:29 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 7 Jun 2002 22:33:29 +0000 (22:33 +0000)
From: "Craig A. Berry" <craigberry@mac.com>
Message-Id: <a05111b01b926db404884@[172.16.52.1]>

p4raw-id: //depot/perl@17074

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;