From owner-freebsd-numerics@FreeBSD.ORG Tue Aug 14 17:52:58 2012 Return-Path: Delivered-To: freebsd-numerics@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E3380106566C for ; Tue, 14 Aug 2012 17:52:58 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by mx1.freebsd.org (Postfix) with ESMTP id C0BE38FC08 for ; Tue, 14 Aug 2012 17:52:58 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.5/8.14.5) with ESMTP id q7EHqwAW069960; Tue, 14 Aug 2012 10:52:58 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.5/8.14.5/Submit) id q7EHqvGl069959; Tue, 14 Aug 2012 10:52:57 -0700 (PDT) (envelope-from sgk) Date: Tue, 14 Aug 2012 10:52:57 -0700 From: Steve Kargl To: Stephen Montgomery-Smith Message-ID: <20120814175257.GA69865@troutmask.apl.washington.edu> References: <502A8CCC.5080606@missouri.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <502A8CCC.5080606@missouri.edu> User-Agent: Mutt/1.4.2.3i Cc: freebsd-numerics@freebsd.org Subject: Re: Status of expl logl X-BeenThere: freebsd-numerics@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussions of high quality implementation of libm functions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Aug 2012 17:52:59 -0000 On Tue, Aug 14, 2012 at 12:37:16PM -0500, Stephen Montgomery-Smith wrote: > Are people working on expl, logl and log1pl? > Yes. I have expl and expm1l written. Need to fix a few issues that Bruce pointed out, and need to write an ld128/expm1l. Bruce has multiple versions of logl and log1pl. I have a copy of one of his ld80/logl, which I've been testing/using for a a few years. > I was trying to brainstorm ideas. If one had an expl, one could create > a logl as follows: > > long double logl(long double x) > { > long double y; > > y = log(x); > y -= 1 - x*expl(-y); > } > > Of course you would need prechecks to make sure log(x) doesn't overflow, > etc. > > But my thinking is this. Use log(x) as a starting value for Newton's > Method. Since Newton's Method roughly doubles the number digits of > precision, only one iteration is needed. > > It doesn't work so well if 1/e < x < e. > > Anyway, just throwing out an idea. > It is much easier to read Tang's papers, and implement his algorithms. Then, you send the code to Bruce and watch the optimization machine churn over the code. :-) PTP Tang, "Table-Driven Implementation of the Expml Function In IEEE Floating-Point Arithmetic," ACM Trans. Math. Soft., 18, 1992, 211-222. PTP Tang, "Table-Driven Implementation of the Exponential Function in IEEE Floating-Point Arithmetic," ACM Trans. Math. Soft., 15, 1989, 144-157. PTP Tang, "Table-Driven Implementation of the Logarithm Function in IEEE Floating-Point Arithmetic," ACM Trans. Math. Soft., 16, 1990, 378-400. -- Steve