From: Peter Prymmer Date: Wed, 27 Jun 2001 19:25:49 +0000 (-0700) Subject: avoid overflow in numeric.c:S_mulexp10() on VAX X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a333faafe1ea79cc2ee6a8e7cd6170ab2dcba713;p=p5sagit%2Fp5-mst-13.2.git avoid overflow in numeric.c:S_mulexp10() on VAX Message-ID: p4raw-id: //depot/perl@10998 --- diff --git a/numeric.c b/numeric.c index 58b96d2..1aadce5 100644 --- a/numeric.c +++ b/numeric.c @@ -562,6 +562,14 @@ S_mulexp10(NV value, I32 exponent) negative = 1; exponent = -exponent; } +#ifdef __VAX /* avoid %SYSTEM-F-FLTOVF_F sans VAXC$ESTABLISH */ +# if defined(__DECC_VER) && __DECC_VER <= 50390006 + /* __F_FLT_MAX_10_EXP - 5 == 33 */ + if (!negative && + (log10(value) + exponent) >= (__F_FLT_MAX_10_EXP - 5)) + return NV_MAX; +# endif +#endif for (bit = 1; exponent; bit <<= 1) { if (exponent & bit) { exponent ^= bit;