From: Craig A. Berry Date: Thu, 16 Aug 2001 22:46:15 +0000 (-0500) Subject: IEEE float tweak for VMS X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=24866caad75b79a9904db4da54bae384dd5e4357;p=p5sagit%2Fp5-mst-13.2.git IEEE float tweak for VMS Message-Id: <5.1.0.14.0.20010816204836.01ab4e58@exchi01> p4raw-id: //depot/perl@11700 --- diff --git a/configure.com b/configure.com index 04ed20c..7777baf 100644 --- a/configure.com +++ b/configure.com @@ -2352,9 +2352,10 @@ $ IF ans .EQS. "" THEN ans="''dflt'" $ be_case_sensitive = "''ans'" $! IEEE math? $ echo "" -$ echo "Perl normally uses G_FLOAT format floating point numbers" -$ echo "internally, as do most things on VMS. You can, however, build" -$ echo "with IEEE floating point numbers instead if you need to." +$ echo "Perl normally uses IEEE format (T_FLOAT) floating point numbers" +$ echo "internally on Alpha, but if you need G_FLOAT for binary compatibility" +$ echo "with an external library or existing data, you may wish to disable" +$ echo "the IEEE math option." $ dflt = use_ieee_math $ rp = "Use IEEE math? [''dflt'] " $ GOSUB myread diff --git a/numeric.c b/numeric.c index f12e9ba..d15fdbd 100644 --- a/numeric.c +++ b/numeric.c @@ -573,24 +573,21 @@ S_mulexp10(NV value, I32 exponent) exponent = -exponent; } - /* Avoid %SYSTEM-F-FLTOVF_F sans VAXC$ESTABLISH. - * In VAX VMS we by default use the D_FLOAT double format, + /* On OpenVMS VAX 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.) + * overflowing doubles 'silently' as IEEE fp does. We also need + * to support G_FLOAT on both VAX and Alpha, and though the exponent + * range is much larger than D_FLOAT it still doesn't do silent + * overflow. Therefore we need to detect early whether we would + * overflow (this is the behaviour of the native string-to-float + * conversion routines, and therefore 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 */ + * [1] Trying to establish a condition handler to trap floating point + * exceptions is not a good idea. */ +#if defined(VMS) && !defined(__IEEE_FP) && defined(NV_MAX_10_EXP) if (!negative && - (log10(value) + exponent) >= (__F_FLT_MAX_10_EXP - 5)) + (log10(value) + exponent) >= (NV_MAX_10_EXP)) return NV_MAX; -# endif #endif /* In UNICOS and in certain Cray models (such as T90) there is no