From owner-svn-src-head@freebsd.org Tue Jul 24 11:50:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FBDA10490FA; Tue, 24 Jul 2018 11:50:06 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4810E8B8C8; Tue, 24 Jul 2018 11:50:06 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 260172DEE; Tue, 24 Jul 2018 11:50:06 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6OBo5M9082192; Tue, 24 Jul 2018 11:50:05 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6OBo5D9082191; Tue, 24 Jul 2018 11:50:05 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201807241150.w6OBo5D9082191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Tue, 24 Jul 2018 11:50:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336665 - head/lib/msun/src X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/lib/msun/src X-SVN-Commit-Revision: 336665 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jul 2018 11:50:06 -0000 Author: bde Date: Tue Jul 24 11:50:05 2018 New Revision: 336665 URL: https://svnweb.freebsd.org/changeset/base/336665 Log: In C remquol() and thus also in C remainderl(), don't clobber the sign bit of NaNs before possible returning a NaN. The remquo*() and remainder*() functions should now give bitwise identical results across arches and implementations, and bitwise consistent results (with lower precisions having truncated mantissas) across precisions. x86 already had consistency across amd64 and i386 and precisions by using the i387 consistently and normally not using the C versions. Inconsistencies for C reqmquol() were first detected on sparc64. Remove double second clearing of the sign bit and extra blank lines. Modified: head/lib/msun/src/s_remquol.c Modified: head/lib/msun/src/s_remquol.c ============================================================================== --- head/lib/msun/src/s_remquol.c Tue Jul 24 11:35:22 2018 (r336664) +++ head/lib/msun/src/s_remquol.c Tue Jul 24 11:50:05 2018 (r336665) @@ -79,7 +79,6 @@ remquol(long double x, long double y, int *quo) sxy = sx ^ uy.bits.sign; ux.bits.sign = 0; /* |x| */ uy.bits.sign = 0; /* |y| */ - x = ux.e; /* purge off exception values */ if((uy.bits.exp|uy.bits.manh|uy.bits.manl)==0 || /* y=0 */ @@ -126,7 +125,6 @@ remquol(long double x, long double y, int *quo) /* fix point fmod */ n = ix - iy; q = 0; - while(n--) { hz=hx-hy;lz=lx-ly; if(lx>MANL_SHIFT); lx = lx+lx;} @@ -154,9 +152,8 @@ remquol(long double x, long double y, int *quo) } else { ux.bits.exp = iy + BIAS; } - ux.bits.sign = 0; - x = ux.e; fixup: + x = ux.e; /* |x| */ y = fabsl(y); if (y < LDBL_MIN * 2) { if (x+x>y || (x+x==y && (q & 1))) { @@ -167,11 +164,9 @@ fixup: q++; x-=y; } - ux.e = x; ux.bits.sign ^= sx; x = ux.e; - q &= 0x7fffffff; *quo = (sxy ? -q : q); return x;