From owner-freebsd-numerics@FreeBSD.ORG Tue Aug 14 17:37:19 2012 Return-Path: Delivered-To: freebsd-numerics@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C59B106566B for ; Tue, 14 Aug 2012 17:37:19 +0000 (UTC) (envelope-from stephen@missouri.edu) Received: from wilberforce.math.missouri.edu (wilberforce.math.missouri.edu [128.206.184.213]) by mx1.freebsd.org (Postfix) with ESMTP id 25A958FC08 for ; Tue, 14 Aug 2012 17:37:18 +0000 (UTC) Received: from [127.0.0.1] (wilberforce.math.missouri.edu [128.206.184.213]) by wilberforce.math.missouri.edu (8.14.5/8.14.5) with ESMTP id q7EHbGVp033674 for ; Tue, 14 Aug 2012 12:37:17 -0500 (CDT) (envelope-from stephen@missouri.edu) Message-ID: <502A8CCC.5080606@missouri.edu> Date: Tue, 14 Aug 2012 12:37:16 -0500 From: Stephen Montgomery-Smith User-Agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: freebsd-numerics@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: 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:37:19 -0000 Are people working on expl, logl and log1pl? 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. Also, I came across this algorithm: http://en.wikipedia.org/wiki/Logarithm#Arithmetic-geometric_mean_approximation It does need a few extra bits of precision than you want in the final answer. But it is used by mpfr, and it is surprisingly fast.