about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-10-13 19:08:37 +0000
committerUlrich Drepper <drepper@redhat.com>2005-10-13 19:08:37 +0000
commit72c7a71de49af5e025f5c064079b25631af6c457 (patch)
treef23a04f2d44106152e2efef0f9da08e38dd2090e /sysdeps
parent1676aaeffd2e156e6d15d3aa59c35214e6a6a2b1 (diff)
downloadglibc-72c7a71de49af5e025f5c064079b25631af6c457.tar.gz
glibc-72c7a71de49af5e025f5c064079b25631af6c457.tar.xz
glibc-72c7a71de49af5e025f5c064079b25631af6c457.zip
[BZ #1466]
	* sysdeps/generic/s_csqrt.c (__csqrt): For zero real part, return
	principal square root.
	* sysdeps/generic/s_csqrtf.c (__csqrtf): Likewise.
	* sysdeps/generic/s_csqrtl.c (__csqrtl): Likewise.
	* math/libm-test.inc (csqrt_test): Add test for returning
	principal value.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/s_csqrt.c6
-rw-r--r--sysdeps/generic/s_csqrtf.c6
-rw-r--r--sysdeps/generic/s_csqrtl.c6
3 files changed, 9 insertions, 9 deletions
diff --git a/sysdeps/generic/s_csqrt.c b/sysdeps/generic/s_csqrt.c
index 0bb6690b17..04ed410a16 100644
--- a/sysdeps/generic/s_csqrt.c
+++ b/sysdeps/generic/s_csqrt.c
@@ -1,5 +1,5 @@
 /* Complex square root of double value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -79,8 +79,8 @@ __csqrt (__complex__ double x)
 	{
 	  double r = __ieee754_sqrt (0.5 * fabs (__imag__ x));
 
-	  __real__ res = __copysign (r, __imag__ x);
-	  __imag__ res = r;
+	  __real__ res = r;
+	  __imag__ res = __copysign (r, __imag__ x);
 	}
       else
 	{
diff --git a/sysdeps/generic/s_csqrtf.c b/sysdeps/generic/s_csqrtf.c
index b02c605a37..2fba69ce1b 100644
--- a/sysdeps/generic/s_csqrtf.c
+++ b/sysdeps/generic/s_csqrtf.c
@@ -1,5 +1,5 @@
 /* Complex square root of float value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -79,8 +79,8 @@ __csqrtf (__complex__ float x)
 	{
 	  float r = __ieee754_sqrtf (0.5 * fabsf (__imag__ x));
 
-	  __real__ res = __copysignf (r, __imag__ x);
-	  __imag__ res = r;
+	  __real__ res = r;
+	  __imag__ res = __copysignf (r, __imag__ x);
 	}
       else
 	{
diff --git a/sysdeps/generic/s_csqrtl.c b/sysdeps/generic/s_csqrtl.c
index 8e27750a04..9d00946c51 100644
--- a/sysdeps/generic/s_csqrtl.c
+++ b/sysdeps/generic/s_csqrtl.c
@@ -1,5 +1,5 @@
 /* Complex square root of long double value.
-   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -79,8 +79,8 @@ __csqrtl (__complex__ long double x)
 	{
 	  long double r = __ieee754_sqrtl (0.5 * fabsl (__imag__ x));
 
-	  __real__ res = __copysignl (r, __imag__ x);
-	  __imag__ res = r;
+	  __real__ res = r;
+	  __imag__ res = __copysignl (r, __imag__ x);
 	}
       else
 	{