From owner-cvs-all@FreeBSD.ORG Tue Oct 25 12:16:07 2005 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2AC2916A41F; Tue, 25 Oct 2005 12:16:07 +0000 (GMT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id C193843D45; Tue, 25 Oct 2005 12:16:06 +0000 (GMT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.11/8.12.11) with ESMTP id j9PCG6jx049190; Tue, 25 Oct 2005 05:16:06 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.11/8.12.3/Submit) id j9PCG6fB049189; Tue, 25 Oct 2005 05:16:06 -0700 (PDT) (envelope-from rizzo) Date: Tue, 25 Oct 2005 05:16:06 -0700 From: Luigi Rizzo To: Bruce Evans Message-ID: <20051025051606.A49155@xorpc.icir.org> References: <200510251213.j9PCDbBp010108@repoman.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <200510251213.j9PCDbBp010108@repoman.freebsd.org>; from bde@FreeBSD.org on Tue, Oct 25, 2005 at 12:13:37PM +0000 Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/lib/msun/src e_rem_pio2f.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Oct 2005 12:16:07 -0000 wow now this is a commit message!!! On Tue, Oct 25, 2005 at 12:13:37PM +0000, Bruce Evans wrote: > bde 2005-10-25 12:13:37 UTC > > FreeBSD src repository > > Modified files: > lib/msun/src e_rem_pio2f.c > Log: > More fixes for arg reduction near pi/2 on systems with broken assignment > to floats (mainly i386's). All errors of more than 1 ulp for float > precision trig functions were supposed to have been fixed; however, > compiling with gcc -O2 uncovered 18250 more such errors for cosf(), > with a maximum error of 1.409 ulps. > > Use essentially the same fix as in rev.1.8 of k_rem_pio2f.c (access a > non-volatile variable as a volatile). Here the -O1 case apparently > worked because the variable is in a 2-element array and it takes -O2 > to mess up such a variable by putting it in a register. > > The maximum error for cosf() on i386 with gcc -O2 is now 0.5467 (it > is still 0.5650 with gcc -O1). This shows that -O2 still causes some > extra precision, but the extra precision is now good. > > Extra precision is harmful mainly for implementing extra precision in > software. We want to represent x+y as w+r where both "+" operations > are in infinite precision and r is tiny compared with w. There is a > standard algorithm for this (Knuth (1981) 4.2.2 Theorem C), and fdlibm > uses this routinely, but the algorithm requires w and r to have the > same precision as x and y. w is just x+y (calculated in the same > finite precision as x and y), and r is a tiny correction term. The > i386 gcc bugs tend to give extra precision in w, and then using this > extra precision in the calculation of r results in the correction > mostly staying in w and being missing from r. There still tends to > be no problem if the result is a simple expression involving w and r > -- modulo spills, w keeps its extra precision and r remains the right > correction for this wrong w. However, here we want to pass w and r > to extern functions. Extra precision is not retained in function args, > so w gets fixed up, but the change to the tiny r is tinier, so r almost > remains as a wrong correction for the right w. > > Revision Changes Path > 1.12 +8 -5 src/lib/msun/src/e_rem_pio2f.c