diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-08-15 12:48:32 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-08-15 12:48:32 +0000 |
commit | 67597c89125e7e144f9ba60f5b1fe23b951286d8 (patch) | |
tree | 87ab31d4aff4c750eb8fe6d847d541ecbf9d7190 /numeric.c | |
parent | ba674f84c290c80e30477a6ed1e822a828ce2e1e (diff) | |
download | perl-67597c89125e7e144f9ba60f5b1fe23b951286d8.tar.gz |
Re-establish the fp overflow detection for VAX VMS; there
is no easy way to have the IEEE fp silent overflow semantics.
(in Alpha VMS we still will use IEEE fp by default-- but it
is still possible to configure Perl to use G_FLOAT)
p4raw-id: //depot/perl@11679
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -572,6 +572,25 @@ S_mulexp10(NV value, I32 exponent) negative = 1; exponent = -exponent; } + /* Avoid %SYSTEM-F-FLTOVF_F sans VAXC$ESTABLISH. + * In VAX VMS we by default use the D_FLOAT double format, + * and that format does not have *easy* capabilities [1] for + * overflowing doubles 'silently' as IEEE fp does. Therefore we + * need to detect early whether we would overflow (this is + * the behaviour of the native string-to-float conversion routines, + * and therefore the behaviour of native applications, too.) + * + * [1] VAXC$EXTABLISH is the capability but it is basically a signal + * handler setup routine, and one cannot return from a fp exception + * handler and except much anything useful. */ +#if defined(VMS) && !defined(__IEEE_FP) +# 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; |