summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2005-10-12 06:46:18 +0000
committerDanny Smith <dannysmith@users.sourceforge.net>2005-10-12 06:46:18 +0000
commit0efe737420bbd173d94b3444836b8c3495202a42 (patch)
tree058fd0743ca34ebc1573a040abb2455c7b7fce9e
parent1a5c68c8d93eedfbddd0d59c5a827abc96f46410 (diff)
downloadcygnal-0efe737420bbd173d94b3444836b8c3495202a42.tar.gz
cygnal-0efe737420bbd173d94b3444836b8c3495202a42.tar.bz2
cygnal-0efe737420bbd173d94b3444836b8c3495202a42.zip
* mingwex/complex/csqrt.c (csqrt): The sign of real part
of result is positive when real part of arg == 0; * mingwex/complex/csqrtf.c (csqrtf): Ditto. * mingwex/complex/csqrtl.c (csqrtl): Ditto.
-rw-r--r--winsup/mingw/ChangeLog7
-rw-r--r--winsup/mingw/mingwex/complex/csqrt.c9
-rwxr-xr-xwinsup/mingw/mingwex/complex/csqrtf.c4
-rwxr-xr-xwinsup/mingw/mingwex/complex/csqrtl.c4
4 files changed, 16 insertions, 8 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog
index 2cdd5c4d2..896c5b1d0 100644
--- a/winsup/mingw/ChangeLog
+++ b/winsup/mingw/ChangeLog
@@ -1,5 +1,12 @@
2005-10-12 Danny Smith <dannysmith@users.sourceforge.net>
+ * mingwex/complex/csqrt.c (csqrt): The sign of real part
+ of result is positive when real part of arg == 0;
+ * mingwex/complex/csqrtf.c (csqrtf): Ditto.
+ * mingwex/complex/csqrtl.c (csqrtl): Ditto.
+
+2005-10-12 Danny Smith <dannysmith@users.sourceforge.net>
+
* include/time.h (_time64): Correct prototype.
2005-10-08 Danny Smith <dannysmith@users.sourceforge.net>
diff --git a/winsup/mingw/mingwex/complex/csqrt.c b/winsup/mingw/mingwex/complex/csqrt.c
index 3717939f4..b5f8868e9 100644
--- a/winsup/mingw/mingwex/complex/csqrt.c
+++ b/winsup/mingw/mingwex/complex/csqrt.c
@@ -31,22 +31,23 @@ double complex csqrt (double complex Z)
else if (x == 0.0)
{
t = sqrt(0.5 * fabs (y));
- __real__ Res = y > 0 ? t : -t;
- __imag__ Res = t;
+ __real__ Res = t;
+ __imag__ Res = y > 0 ? t : -t;
}
else
{
t = sqrt (2.0 * (_hypot (x, y) + fabs (x)));
+ double u = t / 2.0;
if ( x > 0.0)
{
- __real__ Res = 0.5 * t;
+ __real__ Res = u;
__imag__ Res = y / t;
}
else
{
__real__ Res = fabs ( y / t);
- __imag__ Res = (y < 0.0 ? -0.5 : 0.5) * t;
+ __imag__ Res = y < 0.0 ? -u : u;
}
}
diff --git a/winsup/mingw/mingwex/complex/csqrtf.c b/winsup/mingw/mingwex/complex/csqrtf.c
index b39cbb468..7c37e99ce 100755
--- a/winsup/mingw/mingwex/complex/csqrtf.c
+++ b/winsup/mingw/mingwex/complex/csqrtf.c
@@ -25,8 +25,8 @@ float complex csqrtf (float complex Z)
else if (x == 0.0f)
{
r = sqrtf(0.5f * fabsf (y));
- __real__ Res = y > 0 ? r : -r;
- __imag__ Res = r;
+ __real__ Res = r;
+ __imag__ Res = y > 0 ? r : -r;
}
else
diff --git a/winsup/mingw/mingwex/complex/csqrtl.c b/winsup/mingw/mingwex/complex/csqrtl.c
index f058b216a..1b2ebbe5b 100755
--- a/winsup/mingw/mingwex/complex/csqrtl.c
+++ b/winsup/mingw/mingwex/complex/csqrtl.c
@@ -31,8 +31,8 @@ long double complex csqrtl (long double complex Z)
else if (x == 0.0L)
{
r = sqrtl(0.5L * fabsl (y));
- __real__ Res = y > 0 ? r : -r;
- __imag__ Res = r;
+ __real__ Res = r;
+ __imag__ Res = y > 0 ? r : -r;
}
else