aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libf2c/changes13
-rw-r--r--libf2c/f2c.h4
-rw-r--r--libf2c/libF77/README8
-rw-r--r--libf2c/libF77/Version.c7
-rw-r--r--libf2c/libF77/c_div.c12
-rw-r--r--libf2c/libF77/z_div.c10
-rw-r--r--libf2c/readme12
7 files changed, 62 insertions, 4 deletions
diff --git a/libf2c/changes b/libf2c/changes
index 4ec0e7f5825..162b70be883 100644
--- a/libf2c/changes
+++ b/libf2c/changes
@@ -3024,3 +3024,16 @@ Sun Jun 27 22:05:47 EDT 1999
libf2c.zip, libi77: rsne.c: fix bug in namelist input: a misplaced
increment could cause wrong array elements to be assigned; e.g.,
"&input k(5)=10*1 &end" assigned k(5) and k(15 .. 23).
+
+Tue Sep 7 14:10:24 EDT 1999
+ f2c.h, libf2c/f2c.h0, libf2c/README: minor tweaks so a simple
+sed command converts f2c.h == libf2c/f2c.h0 to a form suitable for
+machines with 8-byte longs and doubles, 4-byte int's and floats,
+while working with a forthcoming (ill-advised) update to the C
+standard that outlaws plain "unsigned".
+ f2c.h, libf2c/f2c.h0: change "if 0" to "#ifdef INTEGER_STAR_8".
+ libf77, libf2c.zip: [cz]_div.c and README: arrange for compilation
+under -DIEEE_COMPLEX_DIVIDE to make these routines avoid calling sig_die
+when the denominator of a complex or double complex division vanishes;
+instead, they return pairs of NaNs or Infinities, depending whether the
+numerator also vanishes or not.
diff --git a/libf2c/f2c.h b/libf2c/f2c.h
index 6514cd913e8..b94ee7c8e12 100644
--- a/libf2c/f2c.h
+++ b/libf2c/f2c.h
@@ -8,7 +8,7 @@
#define F2C_INCLUDE
typedef long int integer;
-typedef unsigned long uinteger;
+typedef unsigned long int uinteger;
typedef char *address;
typedef short int shortint;
typedef float real;
@@ -19,7 +19,7 @@ typedef long int logical;
typedef short int shortlogical;
typedef char logical1;
typedef char integer1;
-#if 0 /* Adjust for integer*8. */
+#ifdef INTEGER_STAR_8 /* Adjust for integer*8. */
typedef long long longint; /* system-dependent */
typedef unsigned long long ulongint; /* system-dependent */
#define qbit_clear(a,b) ((a) & ~((ulongint)1 << (b)))
diff --git a/libf2c/libF77/README b/libf2c/libF77/README
index 5e532ee0990..dcf5928e121 100644
--- a/libf2c/libF77/README
+++ b/libf2c/libF77/README
@@ -110,3 +110,11 @@ or (on some systems)
If your compiler complains about the signal calls in main.c, s_paus.c,
and signal_.c, you may need to adjust signal1.h suitably. See the
comments in signal1.h.
+
+By default, the routines that implement complex and double complex
+division, c_div.c and z_div.c, call sig_die to print an error message
+and exit if they see a divisor of 0, as this is sometimes helpful for
+debugging. On systems with IEEE arithmetic, compiling c_div.c and
+z_div.c with -DIEEE_COMPLEX_DIVIDE causes them instead to set both
+the real and imaginary parts of the result to +INFINITY if the
+numerator is nonzero, or to NaN if it vanishes.
diff --git a/libf2c/libF77/Version.c b/libf2c/libF77/Version.c
index 3b2bbe64b92..a15b762e2c8 100644
--- a/libf2c/libF77/Version.c
+++ b/libf2c/libF77/Version.c
@@ -56,4 +56,11 @@ static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
overlapping arguments caused by equivalence.
3 May 1999: "invisible" tweaks to omit compiler warnings in
abort_.c, ef1asc_.c, s_rnge.c, s_stop.c.
+
+ 7 Sept. 1999: [cz]_div.c: arrange for compilation under
+ -DIEEE_COMPLEX_DIVIDE to make these routines
+ avoid calling sig_die when the denominator
+ vanishes; instead, they return pairs of NaNs
+ or Infinities, depending whether the numerator
+ also vanishes or not. VERSION not changed.
*/
diff --git a/libf2c/libF77/c_div.c b/libf2c/libF77/c_div.c
index ac963079ba2..4d153b4c4af 100644
--- a/libf2c/libF77/c_div.c
+++ b/libf2c/libF77/c_div.c
@@ -18,8 +18,18 @@ void c_div(complex *c, complex *a, complex *b)
abi = - abi;
if( abr <= abi )
{
- if(abi == 0)
+ if(abi == 0) {
+#ifdef IEEE_COMPLEX_DIVIDE
+ float af, bf;
+ af = bf = abr;
+ if (a->i != 0 || a->r != 0)
+ af = 1.;
+ c->i = c->r = af / bf;
+ return;
+#else
sig_die("complex division by zero", 1);
+#endif
+ }
ratio = (double)b->r / b->i ;
den = b->i * (1 + ratio*ratio);
cr = (a->r*ratio + a->i) / den;
diff --git a/libf2c/libF77/z_div.c b/libf2c/libF77/z_div.c
index 22153fa4514..e14df32a1f8 100644
--- a/libf2c/libF77/z_div.c
+++ b/libf2c/libF77/z_div.c
@@ -17,8 +17,16 @@ void z_div(doublecomplex *c, doublecomplex *a, doublecomplex *b)
abi = - abi;
if( abr <= abi )
{
- if(abi == 0)
+ if(abi == 0) {
+#ifdef IEEE_COMPLEX_DIVIDE
+ if (a->i != 0 || a->r != 0)
+ abi = 1.;
+ c->i = c->r = abi / abr;
+ return;
+#else
sig_die("complex division by zero", 1);
+#endif
+ }
ratio = b->r / b->i ;
den = b->i * (1 + ratio*ratio);
cr = (a->r*ratio + a->i) / den;
diff --git a/libf2c/readme b/libf2c/readme
index 1ec98865e5b..2eadbb9784f 100644
--- a/libf2c/readme
+++ b/libf2c/readme
@@ -724,6 +724,18 @@ Sun Jun 27 22:05:47 EDT 1999
increment could cause wrong array elements to be assigned; e.g.,
"&input k(5)=10*1 &end" assigned k(5) and k(15 .. 23).
+Tue Sep 7 14:10:24 EDT 1999
+ f2c.h, libf2c/f2c.h0, libf2c/README: minor tweaks so a simple
+sed command converts f2c.h == libf2c/f2c.h0 to a form suitable for
+machines with 8-byte longs and doubles, 4-byte int's and floats,
+while working with a forthcoming (ill-advised) update to the C
+standard that outlaws plain "unsigned".
+ f2c.h, libf2c/f2c.h0: change "if 0" to "#ifdef INTEGER_STAR_8".
+ libf77, libf2c.zip: [cz]_div.c and README: arrange for compilation
+under -DIEEE_COMPLEX_DIVIDE to make these routines avoid calling sig_die
+when the denominator of a complex or double complex division vanishes;
+instead, they return pairs of NaNs or Infinities, depending whether the
+numerator also vanishes or not.
Current timestamps of files in "all from f2c/src", sorted by time,
appear below (mm/dd/year hh:mm:ss). To bring your source up to date,