summaryrefslogtreecommitdiffstats
path: root/libf2c/libF77
diff options
context:
space:
mode:
Diffstat (limited to 'libf2c/libF77')
-rw-r--r--libf2c/libF77/Version.c10
-rw-r--r--libf2c/libF77/c_div.c12
-rw-r--r--libf2c/libF77/configure.in1
-rw-r--r--libf2c/libF77/s_rnge.c6
-rw-r--r--libf2c/libF77/z_div.c10
5 files changed, 34 insertions, 5 deletions
diff --git a/libf2c/libF77/Version.c b/libf2c/libF77/Version.c
index 9512a06985e..46372fc56e3 100644
--- a/libf2c/libF77/Version.c
+++ b/libf2c/libF77/Version.c
@@ -1,4 +1,4 @@
-static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
+static char junk[] = "\n@(#)LIBF77 VERSION 19991115\n";
/*
*/
@@ -61,6 +61,14 @@ char __G77_LIBF77_VERSION__[] = "0.5.25 20000312 (prerelease)";
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.
+ 15 Nov. 1999: s_rnge.c: add casts for the case of
+ sizeof(ftnint) == sizeof(int) < sizeof(long).
*/
#include <stdio.h>
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/configure.in b/libf2c/libF77/configure.in
index 5a3aa1a8d83..a9f282ee3f6 100644
--- a/libf2c/libF77/configure.in
+++ b/libf2c/libF77/configure.in
@@ -98,6 +98,7 @@ dnl Unfortunately, the message implies we're just checking for -lm...
AC_CHECK_LIB(m,drem,AC_DEFINE(IEEE_drem))
AC_DEFINE(Skip_f2c_Undefs)
+AC_DEFINE(IEEE_COMPLEX_DIVIDE)
AC_OUTPUT(Makefile)
diff --git a/libf2c/libF77/s_rnge.c b/libf2c/libF77/s_rnge.c
index fbe3219d580..766889bbfa5 100644
--- a/libf2c/libF77/s_rnge.c
+++ b/libf2c/libF77/s_rnge.c
@@ -13,10 +13,12 @@ integer s_rnge(char *varn, ftnint offset, char *procn, ftnint line)
{
register int i;
-fprintf(stderr, "Subscript out of range on file line %ld, procedure ", line);
+fprintf(stderr, "Subscript out of range on file line %ld, procedure ",
+ (long)line);
while((i = *procn) && i != '_' && i != ' ')
putc(*procn++, stderr);
-fprintf(stderr, ".\nAttempt to access the %ld-th element of variable ", offset+1);
+fprintf(stderr, ".\nAttempt to access the %ld-th element of variable ",
+ (long)offset+1);
while((i = *varn) && i != ' ')
putc(*varn++, stderr);
sig_die(".", 1);
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;
OpenPOWER on IntegriCloud