From owner-svn-src-stable@FreeBSD.ORG Mon Jan 9 04:58:02 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7E9610656D1; Mon, 9 Jan 2012 04:58:02 +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 9CD3E8FC0A; Mon, 9 Jan 2012 04:58:02 +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 q094w2gS023655; Mon, 9 Jan 2012 04:58:02 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q094w2fK023652; Mon, 9 Jan 2012 04:58:02 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201201090458.q094w2fK023652@svn.freebsd.org> From: David Schultz Date: Mon, 9 Jan 2012 04:58:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229844 - stable/8/lib/msun/src X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2012 04:58:02 -0000 Author: das Date: Mon Jan 9 04:58:02 2012 New Revision: 229844 URL: http://svn.freebsd.org/changeset/base/229844 Log: MFC r226595: Per IEEE754r, pow(1, y) is 1 even if y is NaN, and pow(-1, +-Inf) is 1. Modified: stable/8/lib/msun/src/e_pow.c stable/8/lib/msun/src/e_powf.c Directory Properties: stable/8/lib/msun/ (props changed) Modified: stable/8/lib/msun/src/e_pow.c ============================================================================== --- stable/8/lib/msun/src/e_pow.c Mon Jan 9 04:57:59 2012 (r229843) +++ stable/8/lib/msun/src/e_pow.c Mon Jan 9 04:58:02 2012 (r229844) @@ -109,6 +109,9 @@ __ieee754_pow(double x, double y) /* y==zero: x**0 = 1 */ if((iy|ly)==0) return one; + /* x==1: 1**y = 1, even if y is NaN */ + if (hx==0x3ff00000 && lx == 0) return one; + /* y!=zero: result is NaN if either arg is NaN */ if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) @@ -138,7 +141,7 @@ __ieee754_pow(double x, double y) if(ly==0) { if (iy==0x7ff00000) { /* y is +-inf */ if(((ix-0x3ff00000)|lx)==0) - return y - y; /* inf**+-1 is NaN */ + return one; /* (-1)**+-inf is NaN */ else if (ix >= 0x3ff00000)/* (|x|>1)**+-inf = inf,0 */ return (hy>=0)? y: zero; else /* (|x|<1)**-,+inf = inf,0 */ Modified: stable/8/lib/msun/src/e_powf.c ============================================================================== --- stable/8/lib/msun/src/e_powf.c Mon Jan 9 04:57:59 2012 (r229843) +++ stable/8/lib/msun/src/e_powf.c Mon Jan 9 04:58:02 2012 (r229844) @@ -67,6 +67,9 @@ __ieee754_powf(float x, float y) /* y==zero: x**0 = 1 */ if(iy==0) return one; + /* x==1: 1**y = 1, even if y is NaN */ + if (hx==0x3f800000) return one; + /* y!=zero: result is NaN if either arg is NaN */ if(ix > 0x7f800000 || iy > 0x7f800000) @@ -90,7 +93,7 @@ __ieee754_powf(float x, float y) /* special value of y */ if (iy==0x7f800000) { /* y is +-inf */ if (ix==0x3f800000) - return y - y; /* inf**+-1 is NaN */ + return one; /* (-1)**+-inf is NaN */ else if (ix > 0x3f800000)/* (|x|>1)**+-inf = inf,0 */ return (hy>=0)? y: zero; else /* (|x|<1)**-,+inf = inf,0 */