summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2002-06-07 13:29:31 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2002-06-07 22:33:29 +0000
commit236f00125b5b7de76a7c2be98074844ba71dcf34 (patch)
treed6ef0572c66b8ec2c4669cdd76b72ed76d5a3c7a
parentb2c077745916e1f642ef89dd7c457ec57893a358 (diff)
downloadperl-236f00125b5b7de76a7c2be98074844ba71dcf34.tar.gz
numeric.c:S_mulexp10 -- quit when you can
From: "Craig A. Berry" <craigberry@mac.com> Message-Id: <a05111b01b926db404884@[172.16.52.1]> p4raw-id: //depot/perl@17074
-rw-r--r--numeric.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index d2144164cd..1cb24d2273 100644
--- 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;