From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14531 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: new exp fails erfc in libc-test Date: Thu, 8 Aug 2019 20:11:58 +0200 Message-ID: <20190808181158.GG22009@port70.net> References: Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="72170"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) To: musl@lists.openwall.com Original-X-From: musl-return-14547-gllmg-musl=m.gmane.org@lists.openwall.com Thu Aug 08 20:12:15 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1hvmtZ-000Ich-8V for gllmg-musl@m.gmane.org; Thu, 08 Aug 2019 20:12:13 +0200 Original-Received: (qmail 6130 invoked by uid 550); 8 Aug 2019 18:12:10 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 6112 invoked from network); 8 Aug 2019 18:12:09 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:14531 Archived-At: * Dan Gohman [2019-08-07 17:47:54 -0700]: > As of the patch which introduced the new exp implementations: > > http://git.musl-libc.org/cgit/musl/commit/?id=e16f7b3c02e17d0ace779a11f0d53a9c05fdd434 > > I am seeing a test failure in the erfc test in libc-test on at least x86-64 > (erfc calls exp internally): > > src/math/special/erfc.h:6: RN erfc(0x1.5db559fe5c0bap+0) want > 0x1.b53cf571d328fp-5 got 0x1.b53cf571d328cp-5 ulperr -2.609 = -0x1.8p+1 + > 0x1.900982p-2 > > Please let me know if there's any other information which would be useful. erfc in this range returns exp(a)*exp(b)/x which is R(R(R(exp(a)) * R(exp(b))) / x) where R is the round to nearest operation. each rounding may introduce about eps/2 relative error so about 2eps error overall. 1 eps relative error translates to 1..2 ulp error, so 4 ulp error bound in this case, but in practice the actual worst case is likely closer to 3 ulp for this expression. this analysis assumes a correctly rounded exp and exact a and b, so this algorithm cannot be expected to have < 2.6ulp error, no matter what exp is used. so i guess i will just have to update the error threshold in the erfc test. btw the new exp algorithm happens to be correctly rounded on the input that is used during that test, while the old algorithm is off by one.