From owner-freebsd-numerics@FreeBSD.ORG Wed Aug 15 17:13:32 2012 Return-Path: Delivered-To: freebsd-numerics@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D048D1065672 for ; Wed, 15 Aug 2012 17:13:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 605C58FC08 for ; Wed, 15 Aug 2012 17:13:31 +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 mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q7FHDSYo025257 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 16 Aug 2012 03:13:29 +1000 Date: Thu, 16 Aug 2012 03:13:28 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Stephen Montgomery-Smith In-Reply-To: <502B1817.5070401@missouri.edu> Message-ID: <20120816030731.A2899@besplex.bde.org> 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> <50295887.2010608@missouri.edu> <20120814055931.Q4897@besplex.bde.org> <50297468.20902@missouri.edu> <20120814173931.V934@besplex.bde.org> <502A820C.6060804@missouri.edu> <502A8494.2050707@missouri.edu> <502A9B99.7090309@missouri.edu> <502B1817.5070401@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: Wed, 15 Aug 2012 17:13:32 -0000 On Tue, 14 Aug 2012, Stephen Montgomery-Smith wrote: > I was looking through the code e_acosh.c, and it made me realize I could get > a small fraction more ULP in catrig.c by making the replacements: > > 216c216 > < *rx = log1p(Am1 + sqrt(Am1*(A+1))); > --- >> *rx = log1p(Am1 + sqrt(2*Am1 + Am1*Am1)); > 282c282 > < *sqrt_A2my2 = sqrt(Amy*(A+y)); > --- >> *sqrt_A2my2 = sqrt(2*y*Amy + Amy*Amy); > > I'm not quite sure if the second replacement makes much difference, but the > first replacement seemed quite effective. This seems to be slightly worse. In my tests, it makes little difference to the peak error, but unimproves the number of correctly rounded cases quite often. 1,5c1,4 < amd64 float prec, on 2**12 x 2**12 args: < rcacos:max_er = 0x58460841 2.7585, avg_er = 0.317, #>=1:0.5 = 29084:255712 < rcacosh:max_er = 0x5e1e45e6 2.9412, avg_er = 0.262, #>=1:0.5 = 85868:3413684 < rcasin:max_er = 0x631b8183 3.0971, avg_er = 0.209, #>=1:0.5 = 38388:382508 < rcasinh:max_er = 0x5e1e45e6 2.9412, avg_er = 0.262, #>=1:0.5 = 85868:3413684 --- > rcacos:max_er = 0x57352248 2.7252, avg_er = 0.317, #>=1:0.5 = 28694:256172 > rcacosh:max_er = 0x5e1e45e6 2.9412, avg_er = 0.265, #>=1:0.5 = 107904:3459300 > rcasin:max_er = 0x631b8183 3.0971, avg_er = 0.209, #>=1:0.5 = 38332:382056 > rcasinh:max_er = 0x5e1e45e6 2.9412, avg_er = 0.265, #>=1:0.5 = 107904:3459300 ['<' is the old version, '>' the bew version] 17,20c16,19 < icacos:max_er = 0x5e1e45e6 2.9412, avg_er = 0.262, #>=1:0.5 = 85868:3413684 < icacosh:max_er = 0x58460841 2.7585, avg_er = 0.317, #>=1:0.5 = 29084:255712 < icasin:max_er = 0x5e1e45e6 2.9412, avg_er = 0.262, #>=1:0.5 = 85868:3413684 < icasinh:max_er = 0x631b8183 3.0971, avg_er = 0.209, #>=1:0.5 = 38388:382508 --- > icacos:max_er = 0x5e1e45e6 2.9412, avg_er = 0.265, #>=1:0.5 = 107904:3459300 > icacosh:max_er = 0x57352248 2.7252, avg_er = 0.317, #>=1:0.5 = 28694:256172 > icasin:max_er = 0x5e1e45e6 2.9412, avg_er = 0.265, #>=1:0.5 = 107904:3459300 > icasinh:max_er = 0x631b8183 3.0971, avg_er = 0.209, #>=1:0.5 = 38332:382056 32,37c31,34 < < amd64 double prec, on 2**12 x 2**12 args: < rcacos:max_er = 0x1b5a 3.4189, avg_er = 0.228, #>=1:0.5 = 2394:125988 < rcacosh:max_er = 0xf7d 1.9360, avg_er = 0.257, #>=1:0.5 = 612:2741860 < rcasin:max_er = 0x15c5 2.7212, avg_er = 0.113, #>=1:0.5 = 33296:99152 < rcasinh:max_er = 0xf7d 1.9360, avg_er = 0.257, #>=1:0.5 = 612:2741796 --- > rcacos:max_er = 0x1b5a 3.4189, avg_er = 0.228, #>=1:0.5 = 2374:125954 > rcacosh:max_er = 0xf8a 1.9424, avg_er = 0.258, #>=1:0.5 = 8396:2741812 > rcasin:max_er = 0x15c5 2.7212, avg_er = 0.113, #>=1:0.5 = 33312:99184 > rcasinh:max_er = 0xf8a 1.9424, avg_er = 0.258, #>=1:0.5 = 8396:2741748 42,45c39,42 < icacos:max_er = 0xf7d 1.9360, avg_er = 0.257, #>=1:0.5 = 612:2741860 < icacosh:max_er = 0x1b5a 3.4189, avg_er = 0.228, #>=1:0.5 = 2394:125988 < icasin:max_er = 0xf7d 1.9360, avg_er = 0.257, #>=1:0.5 = 612:2741796 < icasinh:max_er = 0x15c5 2.7212, avg_er = 0.113, #>=1:0.5 = 33296:99152 --- > icacos:max_er = 0xf8a 1.9424, avg_er = 0.258, #>=1:0.5 = 8396:2741812 > icacosh:max_er = 0x1b5a 3.4189, avg_er = 0.228, #>=1:0.5 = 2374:125954 > icasin:max_er = 0xf8a 1.9424, avg_er = 0.258, #>=1:0.5 = 8396:2741748 > icasinh:max_er = 0x15c5 2.7212, avg_er = 0.113, #>=1:0.5 = 33312:99184 The unimprovement on i386 is similar. This is surprising for the float case, since the expressions are evaluated in double precision. Bruce