Annotation of researchv10no/libF77/z_sqrt.c, revision 1.1.1.1

1.1       root        1: #include "f2c.h"
                      2: 
                      3: #ifdef KR_headers
                      4: double sqrt(), f__cabs();
                      5: VOID z_sqrt(r, z) doublecomplex *r, *z;
                      6: #else
                      7: #undef abs
                      8: #include "math.h"
                      9: extern double f__cabs(double, double);
                     10: void z_sqrt(doublecomplex *r, doublecomplex *z)
                     11: #endif
                     12: {
                     13: double mag;
                     14: 
                     15: if( (mag = f__cabs(z->r, z->i)) == 0.)
                     16:        r->r = r->i = 0.;
                     17: else if(z->r > 0)
                     18:        {
                     19:        r->r = sqrt(0.5 * (mag + z->r) );
                     20:        r->i = z->i / r->r / 2;
                     21:        }
                     22: else
                     23:        {
                     24:        r->i = sqrt(0.5 * (mag - z->r) );
                     25:        if(z->i < 0)
                     26:                r->i = - r->i;
                     27:        r->r = z->i / r->i / 2;
                     28:        }
                     29: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.