diff options
author | peter <peter@FreeBSD.org> | 2008-06-01 00:03:21 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2008-06-01 00:03:21 +0000 |
commit | a2be5f0c15218b0177d73b17d9bcb7589965d685 (patch) | |
tree | c9f0cd9c22378356a1716d32e13e70bc90f98b9c /libf2c/libF77/c_sqrt.c | |
parent | 9e0f3cc19c9df1594c9cc36cfd8fddc83c52ad12 (diff) | |
download | FreeBSD-src-a2be5f0c15218b0177d73b17d9bcb7589965d685.zip FreeBSD-src-a2be5f0c15218b0177d73b17d9bcb7589965d685.tar.gz |
Reorganize the gcc vendor import work area. This flattens out a bunch
of unnecessary path components that are relics of cvs2svn.
(These are directory moves)
Diffstat (limited to 'libf2c/libF77/c_sqrt.c')
-rw-r--r-- | libf2c/libF77/c_sqrt.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libf2c/libF77/c_sqrt.c b/libf2c/libF77/c_sqrt.c new file mode 100644 index 0000000..81b72fc --- /dev/null +++ b/libf2c/libF77/c_sqrt.c @@ -0,0 +1,30 @@ +#include "f2c.h" + +#undef abs +#include "math.h" +extern double f__cabs (double, double); + +void +c_sqrt (complex * r, complex * z) +{ + double mag, t; + double zi = z->i, zr = z->r; + + if ((mag = f__cabs (zr, zi)) == 0.) + r->r = r->i = 0.; + else if (zr > 0) + { + r->r = t = sqrt (0.5 * (mag + zr)); + t = zi / t; + r->i = 0.5 * t; + } + else + { + t = sqrt (0.5 * (mag - zr)); + if (zi < 0) + t = -t; + r->i = t; + t = zi / t; + r->r = 0.5 * t; + } +} |