From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gtd-gmbh.de (mail.gtd.eu [46.24.46.35]) by sourceware.org (Postfix) with ESMTPS id 803D13885C3E for ; Thu, 19 Mar 2020 15:38:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 803D13885C3E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gtd-gmbh.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=prvs=1347596c9d=fabian.schriever@gtd-gmbh.de X-MDAV-Result: clean X-MDAV-Processed: gtd-gmbh.de, Thu, 19 Mar 2020 16:34:24 +0100 Received: from localhost.localdomain [(78.42.121.247)] by gtd-gmbh.de (MDaemon PRO v19.5.4) with ESMTPA id md50013626792.msg; Thu, 19 Mar 2020 16:34:24 +0100 X-Spam-Processed: gtd-gmbh.de, Thu, 19 Mar 2020 16:34:24 +0100 (not processed: message from trusted or authenticated source) X-MDRemoteIP: 78.42.121.247 X-MDHelo: localhost.localdomain X-MDArrival-Date: Thu, 19 Mar 2020 16:34:24 +0100 X-Authenticated-Sender: fabian.schriever@gtd-gmbh.de X-Return-Path: prvs=1347596c9d=fabian.schriever@gtd-gmbh.de X-Envelope-From: fabian.schriever@gtd-gmbh.de X-MDaemon-Deliver-To: newlib@sourceware.org From: Fabian Schriever To: newlib@sourceware.org Cc: Fabian Schriever Subject: [PATCH] Fix hypotf missing mask in hi+lo decomposition Date: Thu, 19 Mar 2020 16:34:08 +0100 Message-Id: <20200319153408.1413-1-fabian.schriever@gtd-gmbh.de> X-Mailer: git-send-email 2.24.1.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-24.0 required=5.0 tests=GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2020 15:38:15 -0000 Add the missing mask for the decomposition of hi+lo which caused some errors of 1-2 ULP. This change is taken over from FreeBSD: https://github.com/freebsd/freebsd/commit/95436ce20dab5a34ba46373410b96411b1734578 Additionally I've removed some variable assignments which were never read before being overwritten again in the next 2 lines. --- newlib/libm/math/ef_hypot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/newlib/libm/math/ef_hypot.c b/newlib/libm/math/ef_hypot.c index 9368eb41c..a70c92b88 100644 --- a/newlib/libm/math/ef_hypot.c +++ b/newlib/libm/math/ef_hypot.c @@ -29,7 +29,7 @@ ha &= 0x7fffffffL; GET_FLOAT_WORD(hb,y); hb &= 0x7fffffffL; - if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;} + if(hb > ha) { j = ha; ha = hb; hb = j; } SET_FLOAT_WORD(a,ha); /* a <- |a| */ SET_FLOAT_WORD(b,hb); /* b <- |b| */ if((ha-hb)>0xf000000L) {return a+b;} /* x/y > 2**30 */ @@ -72,7 +72,7 @@ a = a+a; SET_FLOAT_WORD(y1,hb&0xfffff000L); y2 = b - y1; - SET_FLOAT_WORD(t1,ha+0x00800000L); + SET_FLOAT_WORD(t1,(ha+0x00800000L)&0xfffff000UL); t2 = a - t1; w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); } -- 2.24.1.windows.2