From owner-freebsd-numerics@FreeBSD.ORG Sun Sep 16 21:00:19 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 9A7E7106564A for ; Sun, 16 Sep 2012 21:00: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 F33068FC0A for ; Sun, 16 Sep 2012 21:00:06 +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 q8GL05St065122; Sun, 16 Sep 2012 16:00:05 -0500 (CDT) (envelope-from stephen@missouri.edu) Message-ID: <50563DD5.4060303@missouri.edu> Date: Sun, 16 Sep 2012 16:00:05 -0500 From: Stephen Montgomery-Smith User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: Bruce Evans References: <5017111E.6060003@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> <5051F59C.6000603@missouri.edu> <20120914014208.I2862@besplex.bde.org> <50526050.2070303@missouri.edu> <20120914212403.H1983@besplex.bde.org> <50538E28.6050400@missouri.edu> <20120915231032.C2669@besplex.bde.org> <50548E15.3010405@missouri.edu> <5054C027.2040008@missouri.edu> <5054C200.7090307@missouri.edu> <20120916041132.D6344@besplex.bde.org> <50553424.2080902@missouri.edu> <20120916134730.Y957@besplex.bde.org> <5055ECA8.2080008@missouri.edu> <20120917022614.R2943@besplex.bde.org> <20120917041848.F3504@besplex.b! de.org> In-Reply-To: <20120917041848.F3504@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: Sun, 16 Sep 2012 21:00:19 -0000 On 09/16/2012 02:53 PM, Bruce Evans wrote: > On Mon, 17 Sep 2012, Bruce Evans wrote: > >> On Sun, 16 Sep 2012, Stephen Montgomery-Smith wrote: >> >>> On 09/16/2012 12:14 AM, Bruce Evans wrote: >>>> On Sat, 15 Sep 2012, Stephen Montgomery-Smith wrote: >>>> >>>>> One more thing I would like an opinion on. >>>>> >>>>> In my code I check for |z| being small, and then use the >>>>> approximations: >>>>> casinh(z) = z >>>>> cacos(z) = Pi - z >>>> >>>> Actually Pi/2 - z. >>>> >>>>> catanh(z) = z >>> So all things being said and done, I am going to remove the use of >>> these approximations. > > It gives the expected pessimizations, and unexpected accuracy improvements > and unimprovements. On amd64: I got unexpected accuracy improvements as well! I thought it might just be a coincidence, so I ignored it. > @ @@ -313,5 +323,6 @@ > @ return (cpackf(copysignf(0, x), y+y)); > @ if (isinf(y)) > @ - return (cpackf(copysignf(0, x), copysignf(m_pi_2, y))); > @ + return (cpackf(copysignf(0, x), > @ + copysignf(m_pi_2 + tiny, y))); > @ if (x == 0) > @ return (cpackf(x, y+y)); > @ @@ -320,9 +331,16 @@ > @ @ if (isinf(x) || isinf(y)) > @ - return (cpackf(copysignf(0, x), copysignf(m_pi_2, y))); > @ + return (cpackf(copysignf(0, x), copysignf(m_pi_2 + tiny, y))); > @ @ if (ax > RECIP_EPSILON || ay > RECIP_EPSILON) > @ if ((int)(1+tiny)==1) > @ - return (cpackf(copysignf(real_part_reciprocal(ax, ay), > x), copysignf(m_pi_2, y))); > @ + return (cpackf( > @ + copysignf(real_part_reciprocal(ax, ay), x), > @ + copysignf(m_pi_2 + tiny, y))); > @ + > @ + /* XXX the numbers are related to sqrt(6 * FLT_EPSILON). */ > @ + if (ax < 2048 * FLT_EPSILON && ay < 2048 * FLT_EPSILON) > @ + if ((int)ax==0 && (int)ay==0) > @ + return (z); > @ @ if (ax == 1 && ay < FLT_EPSILON) { I implemented all the m_pi_2 + tiny changes. Let me still ponder the |z| being small issue. Or you can put that code back in when it is committed.