develooper Front page | perl.perl5.porters | Postings from August 2001

[PATCH perl@11683] IEEE float tweak for VMS

Thread Next
From:
Craig A. Berry
Date:
August 16, 2001 20:52
Subject:
[PATCH perl@11683] IEEE float tweak for VMS
Message ID:
5.1.0.14.0.20010816204836.01ab4e58@exchi01
In configure.com, the new IEEE default was a bit ahead of the configuration 
question for Alpha.  In numeric.c, catching potential overflow has been 
simplified and better commented.  I don't know of any reason the compiler 
version would be relevant, so I've removed that from the ifdef.  The maximum 
exponent for single precision would be correct for the D_FLOAT double 
format, but not for G_FLOAT; I've replaced it with NV_MAX_10_EXP, which will 
reference DBL_MAX_10_EXP, which will be defined appropriately regardless of 
format in float.h.  The numeric tests have no complaints after this with a 
non-IEEE build on Alpha.

--- configure.com;-0    Tue Aug 14 23:27:12 2001
+++ configure.com       Thu Aug 16 18:21:44 2001
@@ -2352,9 +2352,10 @@
 $   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
--- numeric.c;-0        Wed Aug 15 09:14:09 2001
+++ numeric.c   Thu Aug 16 18:21:45 2001
@@ -573,24 +573,21 @@
        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
[end of patch]


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About