projects
/
dragonfly.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Mention KTR_IFQ and KTR_IF_START
[dragonfly.git]
/
contrib
/
gcc-3.4
/
libf2c
/
libF77
/
z_sqrt.c
1
#include "f2c.h"
2
3
#undef abs
4
#include "math.h"
5
extern double f__cabs (double, double);
6
void
7
z_sqrt (doublecomplex * r, doublecomplex * z)
8
{
9
double mag, zi = z->i, zr = z->r;
10
11
if ((mag = f__cabs (zr, zi)) == 0.)
12
r->r = r->i = 0.;
13
else if (zr > 0)
14
{
15
r->r = sqrt (0.5 * (mag + zr));
16
r->i = zi / r->r / 2;
17
}
18
else
19
{
20
r->i = sqrt (0.5 * (mag - zr));
21
if (zi < 0)
22
r->i = -r->i;
23
r->r = zi / r->i / 2;
24
}
25
}