From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 29 22:46:29 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9046F16A41F for ; Thu, 29 Dec 2005 22:46:29 +0000 (GMT) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.FreeBSD.org (Postfix) with ESMTP id D271243D5F for ; Thu, 29 Dec 2005 22:46:27 +0000 (GMT) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.13.4/8.13.4) with ESMTP id jBTMkQYO004951 for ; Thu, 29 Dec 2005 14:46:26 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.13.4/8.13.1/Submit) id jBTMkQ8H004950 for freebsd-hackers@freebsd.org; Thu, 29 Dec 2005 14:46:26 -0800 (PST) (envelope-from sgk) Date: Thu, 29 Dec 2005 14:46:26 -0800 From: Steve Kargl To: freebsd-hackers@freebsd.org Message-ID: <20051229224626.GA4823@troutmask.apl.washington.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i Subject: Implementations of sqrtl and logl X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2005 22:46:29 -0000 I have implementations for sqrtl and logl, which can be added to libm. In limited testing on AMD64 , I find troutmask:kargl[208] ./test_sqrt float double long double MRE: 8.953800e-08 1.664855e-16 1.084202e-19 DDP: 7.05 15.78 18.96 BDP: 23.41 52.42 63.00 MRE: 1.084202e-19 DDP: 18.96 BDP: 63.00 troutmask:kargl[210] ./test_log float double long double MRE: 2.934316e-07 4.743044e-16 2.418119e-19 DDP: 6.53 15.32 18.62 BDP: 21.70 50.91 61.84 MRE: 1.777483e-19 DDP: 18.75 BDP: 62.29 MRE = maximum relative error between a value from my routine and a value computed using GMP/MPFR with 64-bits of precision. DDP = decimal digits of precision = - log10(MRE) BDP = binary digits of precision = - log2(MRE) In the first set of numbers for each test, I have exhaustively scanned the entire range of float values. In these tests, I have also implemented float and double routines as a sanity check on the algorithms used for long double. The second second of numbers are obtained from ten million values over the entire range of long double where these values are drawn from /dev/random. One may infer from the numbers above that sqrtl has <1/2 ULP and logl has about 1.2 ULP. It should be noted that the above assumes round-to-nearest FP, which is the default rounding mode for libm. I have not tested the other rounding modes. There is some minor cleanup I need to do in the code before its ready for inclusion in lib/msun. Namely, I've done my hacking outside of the lib/msun hierarchy, so I need to update Makefiles and the mapages. -- Steve