From owner-freebsd-numerics@FreeBSD.ORG Mon Aug 13 20:11:11 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 96145106567E for ; Mon, 13 Aug 2012 20:11:11 +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 568D38FC1B for ; Mon, 13 Aug 2012 20:11:10 +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 q7DKB8fL022786; Mon, 13 Aug 2012 15:11:09 -0500 (CDT) (envelope-from stephen@missouri.edu) Message-ID: <50295F5C.6010800@missouri.edu> Date: Mon, 13 Aug 2012 15:11:08 -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> In-Reply-To: <20120814003614.H3692@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: Mon, 13 Aug 2012 20:11:11 -0000 On 08/13/2012 11:57 AM, Bruce Evans wrote: > @ if (sy == 0) > @ ! return (cpack(cimag(w), -creal(w))); > @ ! return (cpack(-cimag(w), creal(w))); > > The sign of creal(cacos()) is always 1, but this makes it +- the sign > of atan2(x, y). Yes, but the sign of atan2(y,x) will always be the same as the sign of y. So the two negatives will cancel. But your code works just as well (and your code doesn't clobber the -0's in the imaginary part). > > @ } > @ } > @ --- 408,420 ---- > @ @ if (ISFINITE(bx) && ISFINITE(by) && (x > > RECIP_SQRT_EPSILON_100 || y > RECIP_SQRT_EPSILON_100)) { > @ ! /* XXX following can also raise overflow */ I don't see how the code could raise an overflow. The output of clog should always be very much less than DBL_MAX. (Originally I had clog(2*z), and that could raise an unwarranted overflow.)