Doxygen Source Code Documentation
eis_csroot.c File Reference
#include "f2c.h"Go to the source code of this file.
| Functions | |
| int | csroot_ (doublereal *xr, doublereal *xi, doublereal *yr, doublereal *yi) | 
Function Documentation
| 
 | ||||||||||||||||||||
| 
 Definition at line 8 of file eis_csroot.c. References abs, and pythag_(). Referenced by comlr2_(), comlr_(), comqr2_(), and comqr_(). 
 00010 {
00011     /* Builtin functions */
00012     double sqrt(doublereal);
00013 
00014     /* Local variables */
00015     static doublereal s, ti, tr;
00016     extern doublereal pythag_(doublereal *, doublereal *);
00017 
00018 
00019 /*     (YR,YI) = COMPLEX DSQRT(XR,XI) */
00020 /*     BRANCH CHOSEN SO THAT YR .GE. 0.0 AND SIGN(YI) .EQ. SIGN(XI) */
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 } /* csroot_ */
 | 
 
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
                             
 
 
 
 
       
	   
	   
	   
	  