Annotation of 40BSD/lib/libF77/z_sqrt.c, revision 1.1

1.1     ! root        1: #include "complex"
        !             2: 
        !             3: z_sqrt(r, z)
        !             4: dcomplex *r, *z;
        !             5: {
        !             6: double mag, sqrt(), cabs();
        !             7: 
        !             8: if( (mag = cabs(z->dreal, z->dimag)) == 0.)
        !             9:        r->dreal = r->dimag = 0.;
        !            10: else if(z->dreal > 0)
        !            11:        {
        !            12:        r->dreal = sqrt(0.5 * (mag + z->dreal) );
        !            13:        r->dimag = z->dimag / r->dreal / 2;
        !            14:        }
        !            15: else
        !            16:        {
        !            17:        r->dimag = sqrt(0.5 * (mag - z->dreal) );
        !            18:        if(z->dimag < 0)
        !            19:                z->dimag = - z->dimag;
        !            20:        r->dreal = z->dimag / r->dimag / 2;
        !            21:        }
        !            22: }

unix.superglobalmegacorp.com

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