This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.26.9000-950-gd15e83c


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  d15e83c5f5231d971472b5ffc9219d54056ca0f1 (commit)
      from  d89756ebe1905c1989179c2f1c2b10ef2fb3354e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d15e83c5f5231d971472b5ffc9219d54056ca0f1

commit d15e83c5f5231d971472b5ffc9219d54056ca0f1
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu Dec 7 16:21:00 2017 +0000

    Fix ctanh (0 + i NaN), ctanh (0 + i Inf) (bug 22568, DR#471).
    
    As per C11 DR#471, ctanh (0 + i NaN) and ctanh (0 + i Inf) should
    return 0 + i NaN (with "invalid" exception in the second case but not
    the first), not NaN + i NaN.  This has corresponding implications for
    ctan since its special cases are defined by ctan (z) = -i ctanh (iz).
    This patch implements these cases for ctanh and ctan, updating
    tests accordingly.
    
    Tested for x86_64.
    
    	[BZ #22568]
    	* math/s_ctan_template.c (M_DECL_FUNC (__ctan)): Set imaginary
    	part of result to imaginary part of argument if it is zero and the
    	real part of the argument is not finite.
    	* math/s_ctanh_template.c (M_DECL_FUNC (__ctanh)): Set real part
    	of result to real part of argument if it is zero and the imaginary
    	part of the argument is not finite.

diff --git a/ChangeLog b/ChangeLog
index c48925a..309ae53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2017-12-07  Joseph Myers  <joseph@codesourcery.com>
+
+	[BZ #22568]
+	* math/s_ctan_template.c (M_DECL_FUNC (__ctan)): Set imaginary
+	part of result to imaginary part of argument if it is zero and the
+	real part of the argument is not finite.
+	* math/s_ctanh_template.c (M_DECL_FUNC (__ctanh)): Set real part
+	of result to real part of argument if it is zero and the imaginary
+	part of the argument is not finite.
+
 2017-12-07  Mike FABIAN  <mfabian@redhat.com>
 
 	[BZ #22524]
diff --git a/math/libm-test-ctan.inc b/math/libm-test-ctan.inc
index e485828..0c2c584 100644
--- a/math/libm-test-ctan.inc
+++ b/math/libm-test-ctan.inc
@@ -90,13 +90,13 @@ static const struct test_c_c_data ctan_test_data[] =
     TEST_c_c (ctan, -0x1.2p16383L, minus_infty, 0.0, -1.0),
 #endif
 
-    TEST_c_c (ctan, plus_infty, 0, qnan_value, qnan_value, INVALID_EXCEPTION),
+    TEST_c_c (ctan, plus_infty, 0, qnan_value, 0, INVALID_EXCEPTION),
     TEST_c_c (ctan, plus_infty, 2, qnan_value, qnan_value, INVALID_EXCEPTION),
-    TEST_c_c (ctan, minus_infty, 0, qnan_value, qnan_value, INVALID_EXCEPTION),
+    TEST_c_c (ctan, minus_infty, 0, qnan_value, 0, INVALID_EXCEPTION),
     TEST_c_c (ctan, minus_infty, 2, qnan_value, qnan_value, INVALID_EXCEPTION),
-    TEST_c_c (ctan, plus_infty, minus_zero, qnan_value, qnan_value, INVALID_EXCEPTION),
+    TEST_c_c (ctan, plus_infty, minus_zero, qnan_value, minus_zero, INVALID_EXCEPTION),
     TEST_c_c (ctan, plus_infty, -2, qnan_value, qnan_value, INVALID_EXCEPTION),
-    TEST_c_c (ctan, minus_infty, minus_zero, qnan_value, qnan_value, INVALID_EXCEPTION),
+    TEST_c_c (ctan, minus_infty, minus_zero, qnan_value, minus_zero, INVALID_EXCEPTION),
     TEST_c_c (ctan, minus_infty, -2, qnan_value, qnan_value, INVALID_EXCEPTION),
 
     TEST_c_c (ctan, qnan_value, plus_infty, 0.0, 1.0, IGNORE_ZERO_INF_SIGN),
@@ -112,9 +112,9 @@ static const struct test_c_c_data ctan_test_data[] =
     TEST_c_c (ctan, 0.5, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
     TEST_c_c (ctan, -4.5, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
 
-    TEST_c_c (ctan, qnan_value, 0, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
+    TEST_c_c (ctan, qnan_value, 0, qnan_value, 0),
     TEST_c_c (ctan, qnan_value, 5, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
-    TEST_c_c (ctan, qnan_value, minus_zero, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
+    TEST_c_c (ctan, qnan_value, minus_zero, qnan_value, minus_zero),
     TEST_c_c (ctan, qnan_value, -0.25, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
 
     TEST_c_c (ctan, qnan_value, qnan_value, qnan_value, qnan_value),
diff --git a/math/libm-test-ctanh.inc b/math/libm-test-ctanh.inc
index 6ddeb0d..8a81482 100644
--- a/math/libm-test-ctanh.inc
+++ b/math/libm-test-ctanh.inc
@@ -89,13 +89,13 @@ static const struct test_c_c_data ctanh_test_data[] =
     TEST_c_c (ctanh, minus_infty, -0x1.2p16383L, -1.0, 0.0),
 #endif
 
-    TEST_c_c (ctanh, 0, plus_infty, qnan_value, qnan_value, INVALID_EXCEPTION),
+    TEST_c_c (ctanh, 0, plus_infty, 0, qnan_value, INVALID_EXCEPTION),
     TEST_c_c (ctanh, 2, plus_infty, qnan_value, qnan_value, INVALID_EXCEPTION),
-    TEST_c_c (ctanh, 0, minus_infty, qnan_value, qnan_value, INVALID_EXCEPTION),
+    TEST_c_c (ctanh, 0, minus_infty, 0, qnan_value, INVALID_EXCEPTION),
     TEST_c_c (ctanh, 2, minus_infty, qnan_value, qnan_value, INVALID_EXCEPTION),
-    TEST_c_c (ctanh, minus_zero, plus_infty, qnan_value, qnan_value, INVALID_EXCEPTION),
+    TEST_c_c (ctanh, minus_zero, plus_infty, minus_zero, qnan_value, INVALID_EXCEPTION),
     TEST_c_c (ctanh, -2, plus_infty, qnan_value, qnan_value, INVALID_EXCEPTION),
-    TEST_c_c (ctanh, minus_zero, minus_infty, qnan_value, qnan_value, INVALID_EXCEPTION),
+    TEST_c_c (ctanh, minus_zero, minus_infty, minus_zero, qnan_value, INVALID_EXCEPTION),
     TEST_c_c (ctanh, -2, minus_infty, qnan_value, qnan_value, INVALID_EXCEPTION),
 
     TEST_c_c (ctanh, plus_infty, qnan_value, 1.0, 0.0, IGNORE_ZERO_INF_SIGN),
@@ -111,9 +111,9 @@ static const struct test_c_c_data ctanh_test_data[] =
     TEST_c_c (ctanh, qnan_value, 0.5, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
     TEST_c_c (ctanh, qnan_value, -4.5, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
 
-    TEST_c_c (ctanh, 0, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
+    TEST_c_c (ctanh, 0, qnan_value, 0, qnan_value),
     TEST_c_c (ctanh, 5, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
-    TEST_c_c (ctanh, minus_zero, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
+    TEST_c_c (ctanh, minus_zero, qnan_value, minus_zero, qnan_value),
     TEST_c_c (ctanh, -0.25, qnan_value, qnan_value, qnan_value, INVALID_EXCEPTION_OK),
 
     TEST_c_c (ctanh, qnan_value, qnan_value, qnan_value, qnan_value),
diff --git a/math/s_ctan_template.c b/math/s_ctan_template.c
index 723156e..644d7e6 100644
--- a/math/s_ctan_template.c
+++ b/math/s_ctan_template.c
@@ -49,7 +49,10 @@ M_DECL_FUNC (__ctan) (CFLOAT x)
       else
 	{
 	  __real__ res = M_NAN;
-	  __imag__ res = M_NAN;
+	  if (__imag__ x == 0)
+	    __imag__ res = __imag__ x;
+	  else
+	    __imag__ res = M_NAN;
 
 	  if (isinf (__real__ x))
 	    feraiseexcept (FE_INVALID);
diff --git a/math/s_ctanh_template.c b/math/s_ctanh_template.c
index 96873dd..f237e81 100644
--- a/math/s_ctanh_template.c
+++ b/math/s_ctanh_template.c
@@ -48,7 +48,10 @@ M_DECL_FUNC (__ctanh) (CFLOAT x)
 	}
       else
 	{
-	  __real__ res = M_NAN;
+	  if (__real__ x == 0)
+	    __real__ res = __real__ x;
+	  else
+	    __real__ res = M_NAN;
 	  __imag__ res = M_NAN;
 
 	  if (isinf (__imag__ x))

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                |   10 ++++++++++
 math/libm-test-ctan.inc  |   12 ++++++------
 math/libm-test-ctanh.inc |   12 ++++++------
 math/s_ctan_template.c   |    5 ++++-
 math/s_ctanh_template.c  |    5 ++++-
 5 files changed, 30 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]