summaryrefslogtreecommitdiff
path: root/math
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 /math
parent1676aaeffd2e156e6d15d3aa59c35214e6a6a2b1 (diff)
downloadglibc-72c7a71de49af5e025f5c064079b25631af6c457.tar.gz
[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 'math')
-rw-r--r--math/libm-test.inc6
1 files changed, 5 insertions, 1 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc
index be05222629..15509019c9 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1997.
@@ -153,6 +153,7 @@
#define M_PI2_LOG10El M_PI_2l * M_LOG10El
#define M_PI4_LOG10El M_PI_4l * M_LOG10El
#define M_PI_LOG10El M_PIl * M_LOG10El
+#define M_SQRT_2_2 0.70710678118654752440084436210484903L /* sqrt (2) / 2 */
static FILE *ulps_file; /* File to document difference. */
static int output_ulps; /* Should ulps printed? */
@@ -2212,6 +2213,9 @@ csqrt_test (void)
TEST_c_c (csqrt, 0.75L, 1.25L, 1.05065169626078392338656675760808326L, 0.594868882070379067881984030639932657L);
TEST_c_c (csqrt, -2, -3, 0.89597747612983812471573375529004348L, -1.6741492280355400404480393008490519L);
TEST_c_c (csqrt, -2, 3, 0.89597747612983812471573375529004348L, 1.6741492280355400404480393008490519L);
+ /* Principal square root should be returned (i.e., non-negative real
+ part). */
+ TEST_c_c (csqrt, 0, -1, M_SQRT_2_2, -M_SQRT_2_2);
END (csqrt, complex);
}