Doxygen Source Code Documentation
        
Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search   
eis_csroot.c
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 #include "f2c.h"
00007 
00008  int csroot_(doublereal *xr, doublereal *xi, doublereal *yr, 
00009         doublereal *yi)
00010 {
00011     
00012     double sqrt(doublereal);
00013 
00014     
00015     static doublereal s, ti, tr;
00016     extern doublereal pythag_(doublereal *, doublereal *);
00017 
00018 
00019 
00020 
00021 
00022     tr = *xr;
00023     ti = *xi;
00024     s = sqrt((pythag_(&tr, &ti) + abs(tr)) * .5);
00025     if (tr >= 0.) {
00026         *yr = s;
00027     }
00028     if (ti < 0.) {
00029         s = -s;
00030     }
00031     if (tr <= 0.) {
00032         *yi = s;
00033     }
00034     if (tr < 0.) {
00035         *yr = ti / *yi * .5;
00036     }
00037     if (tr > 0.) {
00038         *yi = ti / *yr * .5;
00039     }
00040     return 0;
00041 } 
00042