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

1.1       root        1: #include "f2c.h"
                      2: 
                      3: #ifdef KR_headers
                      4: extern void sig_die();
                      5: VOID z_div(c, a, b) doublecomplex *a, *b, *c;
                      6: #else
                      7: extern void sig_die(char*, int);
                      8: void z_div(doublecomplex *c, doublecomplex *a, doublecomplex *b)
                      9: #endif
                     10: {
                     11: double ratio, den;
                     12: double abr, abi;
                     13: 
                     14: if( (abr = b->r) < 0.)
                     15:        abr = - abr;
                     16: if( (abi = b->i) < 0.)
                     17:        abi = - abi;
                     18: if( abr <= abi )
                     19:        {
                     20:        if(abi == 0)
                     21:                sig_die("complex division by zero", 1);
                     22:        ratio = b->r / b->i ;
                     23:        den = b->i * (1 + ratio*ratio);
                     24:        c->r = (a->r*ratio + a->i) / den;
                     25:        c->i = (a->i*ratio - a->r) / den;
                     26:        }
                     27: 
                     28: else
                     29:        {
                     30:        ratio = b->i / b->r ;
                     31:        den = b->r * (1 + ratio*ratio);
                     32:        c->r = (a->r + a->i*ratio) / den;
                     33:        c->i = (a->i - a->r*ratio) / den;
                     34:        }
                     35: 
                     36: }

unix.superglobalmegacorp.com

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