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:
95436ce20d

Additionally I've removed some variable assignments which were never
read before being overwritten again in the next 2 lines.
This commit is contained in:
Fabian Schriever 2020-03-19 16:34:08 +01:00 committed by Corinna Vinschen
parent 4ad9ba42fc
commit 6b0c1e7cc8
1 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@
ha &= 0x7fffffffL; ha &= 0x7fffffffL;
GET_FLOAT_WORD(hb,y); GET_FLOAT_WORD(hb,y);
hb &= 0x7fffffffL; 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(a,ha); /* a <- |a| */
SET_FLOAT_WORD(b,hb); /* b <- |b| */ SET_FLOAT_WORD(b,hb); /* b <- |b| */
if((ha-hb)>0xf000000L) {return a+b;} /* x/y > 2**30 */ if((ha-hb)>0xf000000L) {return a+b;} /* x/y > 2**30 */
@ -72,7 +72,7 @@
a = a+a; a = a+a;
SET_FLOAT_WORD(y1,hb&0xfffff000L); SET_FLOAT_WORD(y1,hb&0xfffff000L);
y2 = b - y1; y2 = b - y1;
SET_FLOAT_WORD(t1,ha+0x00800000L); SET_FLOAT_WORD(t1,(ha+0x00800000L)&0xfffff000UL);
t2 = a - t1; t2 = a - t1;
w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b)));
} }