From owner-freebsd-bugs@FreeBSD.ORG Sat Jul 28 08:17:06 2012 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B9694106566B for ; Sat, 28 Jul 2012 08:17:06 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 355C78FC08 for ; Sat, 28 Jul 2012 08:17:05 +0000 (UTC) Received: from c122-106-171-246.carlnfd1.nsw.optusnet.com.au (c122-106-171-246.carlnfd1.nsw.optusnet.com.au [122.106.171.246]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q6S8Gu89024166 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 28 Jul 2012 18:16:57 +1000 Date: Sat, 28 Jul 2012 18:16:56 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Stephen Montgomery-Smith In-Reply-To: <201207280540.q6S5eAh2074533@freefall.freebsd.org> Message-ID: <20120728173811.Y1960@besplex.bde.org> References: <201207280540.q6S5eAh2074533@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-bugs@freebsd.org Subject: Re: bin/170206: complex arcsinh, log, etc. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Jul 2012 08:17:06 -0000 On Sat, 28 Jul 2012, Stephen Montgomery-Smith wrote: > Yes, everywhere I said "double precision" I meant "doubled precision." > > I think the papers by Hull et al were perfectly happy with a ULP of > around 4. > > I have been trying to do a little better, but like you I am noticing > that log1p isn't that good either. Mine is :-). It has 6-10 extra bits of precision internally. Someday the internals should be exposed. There is also the old BSD libm __log__D() which already does this. Old BSD libm pow() uses this internally to get much better accuracy 20 years ago than now. Unfortunately, neither of these takes an extra-precision arg. log1p() sort of does, and clog() already uses it for other reasons and gets some accuracy benefits from this. Old BSD libm __exp__() has the opposite limiation of taking an extra-precision arg but only returning float precision. > I have tried some other things. I am attaching this example which gets > a ULP a little over 2. I simulate high precision arithmetic by > expanding everything out into integers. I certainly didn't aim for a > speedy program. In pari, I did sort of the opposite -- cut down its large decimal precision to produce all the precisions used in clog(), using function calls for all operations, and the doubled precision faked as in C. This is painful to use, but easier than reimplementing a specialized Dekkers algorithm every time you need one. fdlibm is full of uncommented specialized Dekkers algorithms, optimized so that they are barely recognizable and probably known before Dekkers. Bruce