]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
revert back to netlib versions as of f2c-19990501
authorCraig Burley <craig@jcb-sc.com>
Mon, 3 May 1999 08:33:21 +0000 (08:33 +0000)
committerCraig Burley <burley@gcc.gnu.org>
Mon, 3 May 1999 08:33:21 +0000 (04:33 -0400)
From-SVN: r26739

16 files changed:
libf2c/ChangeLog
libf2c/libF77/c_cos.c
libf2c/libF77/c_div.c
libf2c/libF77/c_exp.c
libf2c/libF77/c_log.c
libf2c/libF77/c_sin.c
libf2c/libF77/c_sqrt.c
libf2c/libF77/d_cnjg.c
libf2c/libF77/pow_zi.c
libf2c/libF77/r_cnjg.c
libf2c/libF77/z_cos.c
libf2c/libF77/z_div.c
libf2c/libF77/z_exp.c
libf2c/libF77/z_log.c
libf2c/libF77/z_sin.c
libf2c/libF77/z_sqrt.c

index 72875885c2c6df6ef636b830e96738f48019462b..7d88fa40e3fb637e54044c1ee836952f6017f994 100644 (file)
@@ -1,3 +1,11 @@
+Mon May  3 10:52:53 1999  Craig Burley  <craig@jcb-sc.com>
+
+       * libF77/c_cos.c, libF77/c_div.c, libF77/c_exp.c, libF77/c_log.c,
+       libF77/c_sin.c, libF77/c_sqrt.c, libF77/d_cnjg.c, libF77/pow_zi.c,
+       libF77/r_cnjg.c, libF77/z_cos.c, libF77/z_div.c, libF77/z_exp.c,
+       libF77/z_log.c, libF77/z_sin.c, libF77/z_sqrt.c: Revert back to
+       netlib versions as of f2c-19990501.
+
 Sun May  2 01:38:50 1999  Craig Burley  <craig@jcb-sc.com>
 
        * libU77/u77-test.f (main): Declare FTELL as intrinsic.
index 9e833c168b3bb900a03b0a02718b3fb44e43cfe3..4aea0c3cf6995539311acbbd8172e2a7742bc113 100644 (file)
@@ -3,19 +3,15 @@
 #ifdef KR_headers
 extern double sin(), cos(), sinh(), cosh();
 
-VOID c_cos(resx, z) complex *resx, *z;
+VOID c_cos(r, z) complex *r, *z;
 #else
 #undef abs
-#include <math.h>
+#include "math.h"
 
-void c_cos(complex *resx, complex *z)
+void c_cos(complex *r, complex *z)
 #endif
 {
-complex res;
-
-res.r = cos(z->r) * cosh(z->i);
-res.i = - sin(z->r) * sinh(z->i);
-
-resx->r = res.r;
-resx->i = res.i;
-}
+       double zr = z->r;
+       r->r =   cos(zr) * cosh(z->i);
+       r->i = - sin(zr) * sinh(z->i);
+       }
index 9568354bd53bf1d79ac9aaa2ba03ea9771c44532..ac963079ba29f616abc44b93a666401cd0028121 100644 (file)
@@ -2,39 +2,36 @@
 
 #ifdef KR_headers
 extern VOID sig_die();
-VOID c_div(resx, a, b)
-complex *a, *b, *resx;
+VOID c_div(c, a, b)
+complex *a, *b, *c;
 #else
 extern void sig_die(char*,int);
-void c_div(complex *resx, complex *a, complex *b)
+void c_div(complex *c, complex *a, complex *b)
 #endif
 {
-double ratio, den;
-double abr, abi;
-complex res;
+       double ratio, den;
+       double abr, abi, cr;
 
-if( (abr = b->r) < 0.)
-       abr = - abr;
-if( (abi = b->i) < 0.)
-       abi = - abi;
-if( abr <= abi )
-       {
-       if(abi == 0)
-               sig_die("complex division by zero", 1);
-       ratio = (double)b->r / b->i ;
-       den = b->i * (1 + ratio*ratio);
-       res.r = (a->r*ratio + a->i) / den;
-       res.i = (a->i*ratio - a->r) / den;
-       }
+       if( (abr = b->r) < 0.)
+               abr = - abr;
+       if( (abi = b->i) < 0.)
+               abi = - abi;
+       if( abr <= abi )
+               {
+               if(abi == 0)
+                       sig_die("complex division by zero", 1);
+               ratio = (double)b->r / b->i ;
+               den = b->i * (1 + ratio*ratio);
+               cr = (a->r*ratio + a->i) / den;
+               c->i = (a->i*ratio - a->r) / den;
+               }
 
-else
-       {
-       ratio = (double)b->i / b->r ;
-       den = b->r * (1 + ratio*ratio);
-       res.r = (a->r + a->i*ratio) / den;
-       res.i = (a->i - a->r*ratio) / den;
+       else
+               {
+               ratio = (double)b->i / b->r ;
+               den = b->r * (1 + ratio*ratio);
+               cr = (a->r + a->i*ratio) / den;
+               c->i = (a->i - a->r*ratio) / den;
+               }
+       c->r = cr;
        }
-
-resx->r = res.r;
-resx->i = res.i;
-}
index 8d3d33d0fe356cf271879ebba9ed849a3dd703ff..8252c7f7012bbc3f0fda69e8df407c9d307d9964 100644 (file)
@@ -3,21 +3,17 @@
 #ifdef KR_headers
 extern double exp(), cos(), sin();
 
- VOID c_exp(resx, z) complex *resx, *z;
+ VOID c_exp(r, z) complex *r, *z;
 #else
 #undef abs
-#include <math.h>
+#include "math.h"
 
-void c_exp(complex *resx, complex *z)
+void c_exp(complex *r, complex *z)
 #endif
 {
 double expx;
-complex res;
 
 expx = exp(z->r);
-res.r = expx * cos(z->i);
-res.i = expx * sin(z->i);
-
-resx->r = res.r;
-resx->i = res.i;
+r->r = expx * cos(z->i);
+r->i = expx * sin(z->i);
 }
index 6715131ad1db35029ce118dc6c53a5ad502ad9d2..6ac990ca267589a0b303f0ee724f5eadcc0aeafa 100644 (file)
@@ -2,20 +2,16 @@
 
 #ifdef KR_headers
 extern double log(), f__cabs(), atan2();
-VOID c_log(resx, z) complex *resx, *z;
+VOID c_log(r, z) complex *r, *z;
 #else
 #undef abs
-#include <math.h>
+#include "math.h"
 extern double f__cabs(double, double);
 
-void c_log(complex *resx, complex *z)
+void c_log(complex *r, complex *z)
 #endif
 {
-complex res;
-
-res.i = atan2(z->i, z->r);
-res.r = log( f__cabs(z->r, z->i) );
-
-resx->r = res.r;
-resx->i = res.i;
-}
+       double zi;
+       r->i = atan2(zi = z->i, z->r);
+       r->r = log( f__cabs(z->r, zi) );
+       }
index 7bf3e392bed052a18c95bb02d12592649ef35603..15acccc59af84b2bc2ca17a4257984cb942281eb 100644 (file)
@@ -3,19 +3,15 @@
 #ifdef KR_headers
 extern double sin(), cos(), sinh(), cosh();
 
-VOID c_sin(resx, z) complex *resx, *z;
+VOID c_sin(r, z) complex *r, *z;
 #else
 #undef abs
-#include <math.h>
+#include "math.h"
 
-void c_sin(complex *resx, complex *z)
+void c_sin(complex *r, complex *z)
 #endif
 {
-complex res;
-
-res.r = sin(z->r) * cosh(z->i);
-res.i = cos(z->r) * sinh(z->i);
-
-resx->r = res.r;
-resx->i = res.i;
-}
+       double zr = z->r;
+       r->r = sin(zr) * cosh(z->i);
+       r->i = cos(zr) * sinh(z->i);
+       }
index 775977a87f7b336019c236ab53fceff83e159bbd..8481ee4857e00a8a80b3a4ad63f36effe5786c1f 100644 (file)
@@ -3,36 +3,33 @@
 #ifdef KR_headers
 extern double sqrt(), f__cabs();
 
-VOID c_sqrt(resx, z) complex *resx, *z;
+VOID c_sqrt(r, z) complex *r, *z;
 #else
 #undef abs
-#include <math.h>
+#include "math.h"
 extern double f__cabs(double, double);
 
-void c_sqrt(complex *resx, complex *z)
+void c_sqrt(complex *r, complex *z)
 #endif
 {
-double mag, t;
-complex res;
+       double mag, t;
+       double zi = z->i, zr = z->r;
 
-if( (mag = f__cabs(z->r, z->i)) == 0.)
-       res.r = res.i = 0.;
-else if(z->r > 0)
-       {
-       res.r = t = sqrt(0.5 * (mag + z->r) );
-       t = z->i / t;
-       res.i = 0.5 * t;
+       if( (mag = f__cabs(zr, zi)) == 0.)
+               r->r = r->i = 0.;
+       else if(zr > 0)
+               {
+               r->r = t = sqrt(0.5 * (mag + zr) );
+               t = zi / t;
+               r->i = 0.5 * t;
+               }
+       else
+               {
+               t = sqrt(0.5 * (mag - zr) );
+               if(zi < 0)
+                       t = -t;
+               r->i = t;
+               t = zi / t;
+               r->r = 0.5 * t;
+               }
        }
-else
-       {
-       t = sqrt(0.5 * (mag - z->r) );
-       if(z->i < 0)
-               t = -t;
-       res.i = t;
-       t = z->i / t;
-       res.r = 0.5 * t;
-       }
-
-resx->r = res.r;
-resx->i = res.i;
-}
index 1afa3bc4061e51673892ef467d1c4ba928dbc7c0..c778c38758cb841fad712b3561654f4b83bf212b 100644 (file)
@@ -2,16 +2,11 @@
 
  VOID
 #ifdef KR_headers
-d_cnjg(resx, z) doublecomplex *resx, *z;
+d_cnjg(r, z) doublecomplex *r, *z;
 #else
-d_cnjg(doublecomplex *resx, doublecomplex *z)
+d_cnjg(doublecomplex *r, doublecomplex *z)
 #endif
 {
-doublecomplex res;
-
-res.r = z->r;
-res.i = - z->i;
-
-resx->r = res.r;
-resx->i = res.i;
+r->r = z->r;
+r->i = - z->i;
 }
index 898ea6be917bc9307bf4f19df086f289e3479fcb..abb3cb2b5302962e0cb731c4b13daf03b2b10a23 100644 (file)
@@ -1,61 +1,54 @@
 #include "f2c.h"
 
 #ifdef KR_headers
-VOID pow_zi(resx, a, b)        /* p = a**b  */
- doublecomplex *resx, *a; integer *b;
+VOID pow_zi(p, a, b)   /* p = a**b  */
+ doublecomplex *p, *a; integer *b;
 #else
 extern void z_div(doublecomplex*, doublecomplex*, doublecomplex*);
-void pow_zi(doublecomplex *resx, doublecomplex *a, integer *b)         /* p = a**b  */
+void pow_zi(doublecomplex *p, doublecomplex *a, integer *b)    /* p = a**b  */
 #endif
 {
-integer n;
-unsigned long u;
-double t;
-doublecomplex x;
-doublecomplex res;
-static doublecomplex one = {1.0, 0.0};
+       integer n;
+       unsigned long u;
+       double t;
+       doublecomplex q, x;
+       static doublecomplex one = {1.0, 0.0};
 
-n = *b;
+       n = *b;
+       q.r = 1;
+       q.i = 0;
 
-if(n == 0)
-       {
-       resx->r = 1;
-       resx->i = 0;
-       return;
-       }
-
-res.r = 1;
-res.i = 0;
-
-if(n < 0)
-       {
-       n = -n;
-       z_div(&x, &one, a);
-       }
-else
-       {
-       x.r = a->r;
-       x.i = a->i;
-       }
-
-for(u = n; ; )
-       {
-       if(u & 01)
+       if(n == 0)
+               goto done;
+       if(n < 0)
                {
-               t = res.r * x.r - res.i * x.i;
-               res.i = res.r * x.i + res.i * x.r;
-               res.r = t;
+               n = -n;
+               z_div(&x, &one, a);
                }
-       if(u >>= 1)
+       else
                {
-               t = x.r * x.r - x.i * x.i;
-               x.i = 2 * x.r * x.i;
-               x.r = t;
+               x.r = a->r;
+               x.i = a->i;
                }
-       else
-               break;
-       }
 
-resx->r = res.r;
-resx->i = res.i;
-}
+       for(u = n; ; )
+               {
+               if(u & 01)
+                       {
+                       t = q.r * x.r - q.i * x.i;
+                       q.i = q.r * x.i + q.i * x.r;
+                       q.r = t;
+                       }
+               if(u >>= 1)
+                       {
+                       t = x.r * x.r - x.i * x.i;
+                       x.i = 2 * x.r * x.i;
+                       x.r = t;
+                       }
+               else
+                       break;
+               }
+ done:
+       p->i = q.i;
+       p->r = q.r;
+       }
index b6175eedfd76ee155f8ff58eb8b50f4a81b7d0aa..e127ca969c4ff819484c039f5de4107ce0edde49 100644 (file)
@@ -1,16 +1,11 @@
 #include "f2c.h"
 
 #ifdef KR_headers
-VOID r_cnjg(resx, z) complex *resx, *z;
+VOID r_cnjg(r, z) complex *r, *z;
 #else
-VOID r_cnjg(complex *resx, complex *z)
+VOID r_cnjg(complex *r, complex *z)
 #endif
 {
-complex res;
-
-res.r = z->r;
-res.i = - z->i;
-
-resx->r = res.r;
-resx->i = res.i;
+r->r = z->r;
+r->i = - z->i;
 }
index a811bbecc65b795eda10727795f77333866b0379..fdd1510db48f7c8e57aa0b355d716337e2b8f918 100644 (file)
@@ -2,18 +2,14 @@
 
 #ifdef KR_headers
 double sin(), cos(), sinh(), cosh();
-VOID z_cos(resx, z) doublecomplex *resx, *z;
+VOID z_cos(r, z) doublecomplex *r, *z;
 #else
 #undef abs
-#include <math.h>
-void z_cos(doublecomplex *resx, doublecomplex *z)
+#include "math.h"
+void z_cos(doublecomplex *r, doublecomplex *z)
 #endif
 {
-doublecomplex res;
-
-res.r = cos(z->r) * cosh(z->i);
-res.i = - sin(z->r) * sinh(z->i);
-
-resx->r = res.r;
-resx->i = res.i;
-}
+       double zr = z->r;
+       r->r =   cos(zr) * cosh(z->i);
+       r->i = - sin(zr) * sinh(z->i);
+       }
index 4a987ab255a47ba165c61bee379b2c28fa3a3f02..22153fa4514a556683fd1d61c9bf840d772c832e 100644 (file)
@@ -2,38 +2,35 @@
 
 #ifdef KR_headers
 extern VOID sig_die();
-VOID z_div(resx, a, b) doublecomplex *a, *b, *resx;
+VOID z_div(c, a, b) doublecomplex *a, *b, *c;
 #else
 extern void sig_die(char*, int);
-void z_div(doublecomplex *resx, doublecomplex *a, doublecomplex *b)
+void z_div(doublecomplex *c, doublecomplex *a, doublecomplex *b)
 #endif
 {
-double ratio, den;
-double abr, abi;
-doublecomplex res;
+       double ratio, den;
+       double abr, abi, cr;
 
-if( (abr = b->r) < 0.)
-       abr = - abr;
-if( (abi = b->i) < 0.)
-       abi = - abi;
-if( abr <= abi )
-       {
-       if(abi == 0)
-               sig_die("complex division by zero", 1);
-       ratio = b->r / b->i ;
-       den = b->i * (1 + ratio*ratio);
-       res.r = (a->r*ratio + a->i) / den;
-       res.i = (a->i*ratio - a->r) / den;
-       }
+       if( (abr = b->r) < 0.)
+               abr = - abr;
+       if( (abi = b->i) < 0.)
+               abi = - abi;
+       if( abr <= abi )
+               {
+               if(abi == 0)
+                       sig_die("complex division by zero", 1);
+               ratio = b->r / b->i ;
+               den = b->i * (1 + ratio*ratio);
+               cr = (a->r*ratio + a->i) / den;
+               c->i = (a->i*ratio - a->r) / den;
+               }
 
-else
-       {
-       ratio = b->i / b->r ;
-       den = b->r * (1 + ratio*ratio);
-       res.r = (a->r + a->i*ratio) / den;
-       res.i = (a->i - a->r*ratio) / den;
+       else
+               {
+               ratio = b->i / b->r ;
+               den = b->r * (1 + ratio*ratio);
+               cr = (a->r + a->i*ratio) / den;
+               c->i = (a->i - a->r*ratio) / den;
+               }
+       c->r = cr;
        }
-
-resx->r = res.r;
-resx->i = res.i;
-}
index 85fb63e42095d984d8e2e677b81b49f3874e3b67..56138f3d34b44d9f88317c1b0a571f7928b40c94 100644 (file)
@@ -2,20 +2,16 @@
 
 #ifdef KR_headers
 double exp(), cos(), sin();
-VOID z_exp(resx, z) doublecomplex *resx, *z;
+VOID z_exp(r, z) doublecomplex *r, *z;
 #else
 #undef abs
-#include <math.h>
-void z_exp(doublecomplex *resx, doublecomplex *z)
+#include "math.h"
+void z_exp(doublecomplex *r, doublecomplex *z)
 #endif
 {
 double expx;
-doublecomplex res;
 
 expx = exp(z->r);
-res.r = expx * cos(z->i);
-res.i = expx * sin(z->i);
-
-resx->r = res.r;
-resx->i = res.i;
+r->r = expx * cos(z->i);
+r->i = expx * sin(z->i);
 }
index 48afca63d6d65acaebb2b383458d462b18a6eb83..2d52b941d68c739677bf45bee727baee65f44688 100644 (file)
@@ -2,19 +2,15 @@
 
 #ifdef KR_headers
 double log(), f__cabs(), atan2();
-VOID z_log(resx, z) doublecomplex *resx, *z;
+VOID z_log(r, z) doublecomplex *r, *z;
 #else
 #undef abs
-#include <math.h>
+#include "math.h"
 extern double f__cabs(double, double);
-void z_log(doublecomplex *resx, doublecomplex *z)
+void z_log(doublecomplex *r, doublecomplex *z)
 #endif
 {
-doublecomplex res;
-
-res.i = atan2(z->i, z->r);
-res.r = log( f__cabs( z->r, z->i ) );
-
-resx->r = res.r;
-resx->i = res.i;
-}
+       double zi = z->i;
+       r->i = atan2(zi, z->r);
+       r->r = log( f__cabs( z->r, zi ) );
+       }
index 94456c9c30a3346cec86d6ca5bfb12d5e22b7ea8..577be1d85f905170bff0e6440137f53b50c0327d 100644 (file)
@@ -2,18 +2,14 @@
 
 #ifdef KR_headers
 double sin(), cos(), sinh(), cosh();
-VOID z_sin(resx, z) doublecomplex *resx, *z;
+VOID z_sin(r, z) doublecomplex *r, *z;
 #else
 #undef abs
-#include <math.h>
-void z_sin(doublecomplex *resx, doublecomplex *z)
+#include "math.h"
+void z_sin(doublecomplex *r, doublecomplex *z)
 #endif
 {
-doublecomplex res;
-
-res.r = sin(z->r) * cosh(z->i);
-res.i = cos(z->r) * sinh(z->i);
-
-resx->r = res.r;
-resx->i = res.i;
-}
+       double zr = z->r;
+       r->r = sin(zr) * cosh(z->i);
+       r->i = cos(zr) * sinh(z->i);
+       }
index f5db56519911e8e8e047f24374f5ad14cdf6a388..c04e8f0a1a72324a1beae8bd3bd22b283dac5a98 100644 (file)
@@ -2,32 +2,28 @@
 
 #ifdef KR_headers
 double sqrt(), f__cabs();
-VOID z_sqrt(resx, z) doublecomplex *resx, *z;
+VOID z_sqrt(r, z) doublecomplex *r, *z;
 #else
 #undef abs
-#include <math.h>
+#include "math.h"
 extern double f__cabs(double, double);
-void z_sqrt(doublecomplex *resx, doublecomplex *z)
+void z_sqrt(doublecomplex *r, doublecomplex *z)
 #endif
 {
-double mag;
-doublecomplex res;
+       double mag, zi = z->i, zr = z->r;
 
-if( (mag = f__cabs(z->r, z->i)) == 0.)
-       res.r = res.i = 0.;
-else if(z->r > 0)
-       {
-       res.r = sqrt(0.5 * (mag + z->r) );
-       res.i = z->i / res.r / 2;
+       if( (mag = f__cabs(zr, zi)) == 0.)
+               r->r = r->i = 0.;
+       else if(zr > 0)
+               {
+               r->r = sqrt(0.5 * (mag + zr) );
+               r->i = zi / r->r / 2;
+               }
+       else
+               {
+               r->i = sqrt(0.5 * (mag - zr) );
+               if(zi < 0)
+                       r->i = - r->i;
+               r->r = zi / r->i / 2;
+               }
        }
-else
-       {
-       res.i = sqrt(0.5 * (mag - z->r) );
-       if(z->i < 0)
-               res.i = - res.i;
-       res.r = z->i / res.i / 2;
-       }
-
-resx->r = res.r;
-resx->i = res.i;
-}