1 extern double fabs (double);
2 extern double sqrt (double);
3 
4 typedef struct complexm {
5   double re,im;
6 } complex;
7 
8 static complex
setCom(double r,double i)9 setCom (double r, double i)
10 {
11   complex ct;
12   ct.re=fabs(r)<1E-300?0.0:r;
13   ct.im=fabs(i)<1E-300?0.0:i;
14   return ct;
15 }
16 
17 static complex
csqrt_crash(double x)18 csqrt_crash (double x)
19 {
20   return (x>=0) ? setCom(sqrt(x),0) : setCom(0,sqrt(-x));
21 }
22