From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20441 invoked from network); 19 Aug 2023 06:11:12 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 19 Aug 2023 06:11:12 -0000 Received: (qmail 13908 invoked by uid 550); 19 Aug 2023 06:11:09 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 13870 invoked from network); 19 Aug 2023 06:11:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:message-id:from:to:cc:in-reply-to:subject: references; bh=PFgl4VIYXGQCp69AXRwkI4ajG+zyJhwINsf9D4MsjDc=; b=ryf/9+tJd3kIXmZY8e+perQBNx8O7tgIUsCD0mk1VF9vpUl3jHrNBRWW qvBstPx6E5ffeU18N9Cpw3Ax7PEdxSEmd/B5+qFYDYFzVl6d4qDhqFaJS /30E0YUGmd3MiQIHzak4hdi1sN70B9vXkMbBR8p2UYk32oleQgmnyg68t A=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Paul.Zimmermann@inria.fr; spf=None smtp.helo=postmaster@coriandre Received-SPF: SoftFail (mail3-relais-sop.national.inria.fr: domain of Paul.Zimmermann@inria.fr is inclined to not designate 152.81.9.227 as permitted sender) identity=mailfrom; client-ip=152.81.9.227; receiver=mail3-relais-sop.national.inria.fr; envelope-from="Paul.Zimmermann@inria.fr"; x-sender="Paul.Zimmermann@inria.fr"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:128.93.142.0/24 ip4:192.134.164.0/24 ip4:128.93.162.160 ip4:89.107.174.7 mx ~all" Received-SPF: None (mail3-relais-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@coriandre) identity=helo; client-ip=152.81.9.227; receiver=mail3-relais-sop.national.inria.fr; envelope-from="Paul.Zimmermann@inria.fr"; x-sender="postmaster@coriandre"; x-conformance=spf_only X-IronPort-AV: E=Sophos;i="6.01,185,1684792800"; d="scan'208";a="63764256" Date: Sat, 19 Aug 2023 08:10:56 +0200 Message-Id: From: Paul Zimmermann To: Szabolcs Nagy Cc: musl@lists.openwall.com In-Reply-To: <20230818211600.GE3448312@port70.net> (message from Szabolcs Nagy on Fri, 18 Aug 2023 23:16:00 +0200) References: <20230818211600.GE3448312@port70.net> Subject: [musl] Re: [PATCH 1/2] math: fix ld80 acoshl(x) for x < 0 Dear Szabolcs, ok for me, I now get a largest error of 2.99 ulp: NEW acosh 0 -1 0x1.1ecdb5b8f0c5d79p+0l [3] [2.99] 2.98085 2.980840623325726 Thank you for fixing that rapidly! Paul > Date: Fri, 18 Aug 2023 23:16:00 +0200 > From: Szabolcs Nagy > Cc: musl@lists.openwall.com > > acosh(x) is nan for x < 1, but x < 0 cases were not handled specially > and acoshl gave wrong result for some -0x1p32 < x < -2 values, e.g.: > > acoshl(-0x1p20) returned -inf, > acoshl(-0x1.4p20) returned -0x1.db365758403aa9acp+0L, > > fixed by checking the sign bit and handling it specially. > > reported by Paul Zimmermann. > --- > src/math/acoshl.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/src/math/acoshl.c b/src/math/acoshl.c > index 8d4b43f6..943cec17 100644 > --- a/src/math/acoshl.c > +++ b/src/math/acoshl.c > @@ -10,14 +10,18 @@ long double acoshl(long double x) > long double acoshl(long double x) > { > union ldshape u = {x}; > - int e = u.i.se & 0x7fff; > + int e = u.i.se; > > if (e < 0x3fff + 1) > - /* |x| < 2, invalid if x < 1 or nan */ > + /* 0 <= x < 2, invalid if x < 1 */ > return log1pl(x-1 + sqrtl((x-1)*(x-1)+2*(x-1))); > if (e < 0x3fff + 32) > - /* |x| < 0x1p32 */ > + /* 2 <= x < 0x1p32 */ > return logl(2*x - 1/(x+sqrtl(x*x-1))); > + if (e & 0x8000) > + /* x < 0 or x = -0, invalid */ > + return (x - x) / (x - x); > + /* 0x1p32 <= x or nan */ > return logl(x) + 0.693147180559945309417232121458176568L; > } > #elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 > -- > 2.41.0 > >