From owner-freebsd-numerics@FreeBSD.ORG Tue Aug 14 16:08:46 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 8531A106566C for ; Tue, 14 Aug 2012 16:08:46 +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 2A5038FC12 for ; Tue, 14 Aug 2012 16:08:45 +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 q7EG8hF7027960; Tue, 14 Aug 2012 11:08:43 -0500 (CDT) (envelope-from stephen@missouri.edu) Message-ID: <502A780B.2010106@missouri.edu> Date: Tue, 14 Aug 2012 11:08:43 -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: Bruce Evans References: <5017111E.6060003@missouri.edu> <501C361D.4010807@missouri.edu> <20120804165555.X1231@besplex.bde.org> <501D51D7.1020101@missouri.edu> <20120805030609.R3101@besplex.bde.org> <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> In-Reply-To: <20120814201105.T934@besplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: Tue, 14 Aug 2012 16:08:46 -0000 On 08/14/2012 05:46 AM, Bruce Evans wrote: > On Mon, 13 Aug 2012, Stephen Montgomery-Smith wrote: > >> >> if (sqrt_huge+x>one && sqrt_huge+y>one) > > x and y can be DBL_MAX, giving overflow. Why? When x is DBL_MAX, sqrt_huge is so very much smaller than DBL_MAX that DBL_MAX+sqrt_huge should be DBL_MAX within floating point precision. So no overflow. >>>> @ if (ISFINITE(bx) && ISFINITE(by) && (x > RECIP_SQRT_EPSILON_100 >>>> || y > RECIP_SQRT_EPSILON_100)) { > > since if bx or by is NaN, then it isn't > RECIP_SQRT_EPSILON_100, and > if it is Inf then I think handling it the same as DBL_MAX gives the > correct result. My original code did this. But for some reason, it didn't work in all cases. I didn't take note of which cases failed. > NaNs and Infs now fall through to do_hard_work(). > Wouldn't it be easier to never pass them to do_hard_work()? It seemed to me that there is a logic behind why the the infs and nans produce the results they do. I noticed that do_the_hard_work() already got the answers correct for the real part *rx. Getting the imaginary part to work as well seemed to me to be the cleanest way to make it work. (I added all the nan and inf checking after writing the rest of the code.) > > For just setting inexact, try an expression using `tiny'. There are > many examples to choose from. According to $(grep tiny.*inex *.c): If you still judge my solution incorrect, then I will look into these different solutions.