Annotation of cci/usr/src/usr.lib/libF77/pow_ci.c, revision 1.1.1.1

1.1       root        1: #include "complex"
                      2: 
                      3: pow_ci(p, a, b)        /* p = a**b  */
                      4: complex *p, *a;
                      5: long int *b;
                      6: {
                      7: register long int n;
                      8: register float t;
                      9: complex x;
                     10: 
                     11: n = *b;
                     12: p->real = 1;
                     13: p->imag = 0;
                     14: 
                     15: if(n == 0)
                     16:        return;
                     17: if(n < 0)
                     18:        {
                     19:        n = -n;
                     20:        c_div(&x,p,a);
                     21:        }
                     22: else
                     23:        {
                     24:        x.real = a->real;
                     25:        x.imag = a->imag;
                     26:        }
                     27: 
                     28: for( ; ; )
                     29:        {
                     30:        if(n & 01)
                     31:                {
                     32:                t = p->real * x.real - p->imag * x.imag;
                     33:                p->imag = p->real * x.imag + p->imag * x.real;
                     34:                p->real = t;
                     35:                }
                     36:        if(n >>= 1)
                     37:                {
                     38:                t = x.real * x.real - x.imag * x.imag;
                     39:                x.imag = 2 * x.real * x.imag;
                     40:                x.real = t;
                     41:                }
                     42:        else
                     43:                break;
                     44:        }
                     45: }

unix.superglobalmegacorp.com

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