From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id F16AB3875DFD; Fri, 20 Mar 2020 09:13:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F16AB3875DFD Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Fix hypotf missing mask in hi+lo decomposition X-Act-Checkin: newlib-cygwin X-Git-Author: Fabian Schriever X-Git-Refname: refs/heads/master X-Git-Oldrev: 4ad9ba42fc3dd116bad8b9cb89d434256d3431fb X-Git-Newrev: 6b0c1e7cc8e4b0568f00c8444fff8da67688add3 Message-Id: <20200320091307.F16AB3875DFD@sourceware.org> Date: Fri, 20 Mar 2020 09:13:07 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Mar 2020 09:13:08 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=6b0c1e7cc8e4b0568f00c8444fff8da67688add3 commit 6b0c1e7cc8e4b0568f00c8444fff8da67688add3 Author: Fabian Schriever Date: Thu Mar 19 16:34:08 2020 +0100 Fix hypotf missing mask in hi+lo decomposition 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. Diff: --- 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))); }