From owner-freebsd-numerics@FreeBSD.ORG Thu Sep 13 14:01:05 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 AEC10106564A for ; Thu, 13 Sep 2012 14:01:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail18.syd.optusnet.com.au (mail18.syd.optusnet.com.au [211.29.132.199]) by mx1.freebsd.org (Postfix) with ESMTP id 3D4FF8FC18 for ; Thu, 13 Sep 2012 14:01:04 +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 mail18.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q8DE0tGw019094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 14 Sep 2012 00:00:57 +1000 Date: Fri, 14 Sep 2012 00:00:55 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Stephen Montgomery-Smith In-Reply-To: <5051DBD9.9080200@missouri.edu> Message-ID: <20120913232218.E2426@besplex.bde.org> References: <5017111E.6060003@missouri.edu> <501D9C36.2040207@missouri.edu> <20120805175106.X3574@besplex.bde.org> <501EC015.3000808@missouri.edu> <20120805191954.GA50379@troutmask.apl.washington.edu> <20120807205725.GA10572@server.rulingia.com> <20120809025220.N4114@besplex.bde.org> <5027F07E.9060409@missouri.edu> <20120814003614.H3692@besplex.bde.org> <50295F5C.6010800@missouri.edu> <20120814072946.S5260@besplex.bde.org> <50297CA5.5010900@missouri.edu> <50297E43.7090309@missouri.edu> <20120814201105.T934@besplex.bde.org> <502A780B.2010106@missouri.edu> <20120815223631.N1751@besplex.bde.org> <502C0CF8.8040003@missouri.edu> <20120906221028.O1542@besplex.bde.org> <5048D00B.8010401@missouri.edu> <504D3CCD.2050006@missouri.edu> <504FF726.9060001@missouri.edu> <20120912191556.F1078@besplex.bde.org> <20120912225847.J1771@besplex.bde.org> <50511B40.3070009@missouri.edu> <20120913204808.T1964@besplex.bde.org> <5051DBD9.9080200@missouri.edu> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-numerics@freebsd.org Subject: Re: Complex arg-trig functions 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: Thu, 13 Sep 2012 14:01:05 -0000 On Thu, 13 Sep 2012, Stephen Montgomery-Smith wrote: > I'll look over these changes. But let me say one thing. When the code is > committed, I am intending that clog_for_large_values will be replaced by clog > (or clogf or clogl), which will be your code. So I am not going to worry too > much about fixing up clog_for_large_values. I think it should be remain separate. It only needs very special subcases of clog(), and has already these cases, so it can be about twice as fast for the log(|z|) part by not repeating things and by taking advantage of the specialness. The atan2() part can't be simplified much. For the log(|z|) part, the best method is approximately to scale x and y down to near 1 and then just use x*x + y*y. I tried this in clog() too, but it didn't work so well there because it only handles 1 subcase and it gets in the way of other, more interesting cases. The scaling step may be too messy for clog_for_large_values() too. If so, I would copy the relevant part of the current algorithm from clog() to here. This would be slightly smaller than the current clog_for_large_values(). Bruce