From owner-svn-src-all@FreeBSD.ORG Fri Oct 21 06:30:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F0DC1065670; Fri, 21 Oct 2011 06:30:17 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F29708FC1D; Fri, 21 Oct 2011 06:30:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9L6UGwr009981; Fri, 21 Oct 2011 06:30:16 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9L6UGFv009978; Fri, 21 Oct 2011 06:30:16 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201110210630.p9L6UGFv009978@svn.freebsd.org> From: David Schultz Date: Fri, 21 Oct 2011 06:30:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226600 - head/lib/msun/src X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 06:30:17 -0000 Author: das Date: Fri Oct 21 06:30:16 2011 New Revision: 226600 URL: http://svn.freebsd.org/changeset/base/226600 Log: Fix a corner case: tan(large + Inf i) == NaN + NaN i. Modified: head/lib/msun/src/s_ctanh.c head/lib/msun/src/s_ctanhf.c Modified: head/lib/msun/src/s_ctanh.c ============================================================================== --- head/lib/msun/src/s_ctanh.c Fri Oct 21 06:29:32 2011 (r226599) +++ head/lib/msun/src/s_ctanh.c Fri Oct 21 06:30:16 2011 (r226600) @@ -108,6 +108,13 @@ ctanh(double complex z) } /* + * ctanh(x + i NAN) = NaN + i NaN + * ctanh(x +- i Inf) = NaN + i NaN + */ + if (!isfinite(y)) + return (cpack(y - y, y - y)); + + /* * ctanh(+-huge + i +-y) ~= +-1 +- i 2sin(2y)/exp(2x), using the * approximation sinh^2(huge) ~= exp(2*huge) / 4. * We use a modified formula to avoid spurious overflow. Modified: head/lib/msun/src/s_ctanhf.c ============================================================================== --- head/lib/msun/src/s_ctanhf.c Fri Oct 21 06:29:32 2011 (r226599) +++ head/lib/msun/src/s_ctanhf.c Fri Oct 21 06:30:16 2011 (r226600) @@ -57,6 +57,9 @@ ctanhf(float complex z) copysignf(0, isinf(y) ? y : sinf(y) * cosf(y)))); } + if (!isfinite(y)) + return (cpackf(y - y, y - y)); + if (ix >= 0x41300000) { /* x >= 11 */ float exp_mx = expf(-fabsf(x)); return (cpackf(copysignf(1, x),