Re: [PATCH] Fix hypotf missing mask in hi+lo decomposition

Corinna Vinschen via Newlib <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Mar 19 16:34, Fabian Schriever wrote:
> 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
> 

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl50idMACgkQ9TYGna5E
T6D15Q//TAjpmcNnZAaD21vnc3dWLd/K3/0g+5Gv4S/IG3x9SHy/p5eSOJuO5Jx4
gyEcUJ/IKLxLb5+SHQL+/cY2hlqkis/7fHS3IkVsd3P3jhT1M7ziteNYUgaoWsSa
yofGNI9BYmWGPr5E+B2W018ZowW8ru5gyoWaZKnBDENrP4K12Fx8He6h23HtyUZr
xb30eIp8fpKWWTCaMQq3LEwsXfJxjr7mXo4/C+ataZ3dgnos5pY1j9PYckJBmrlz
SZrpMxP5u1t9SFr2EsevJXb4TZKOuRlFhhENFLr5TqYn3ojwKVIx6cFHzSOMFuec
LyyGZm5ty6PT3Wu6tmAQqpP+gjAA6LgZVrHWRtP/YiYU514cD4V2EFa4fYUnGi0Z
ZpcDZD5BQ5enWoKP4Pkkw5Rf8zLrd98YW43s4qAoEnKceBvOon14wNymUZzQfVM1
3/L2dR9gp4Fe39mU8JnDNb9+Kqzl5KygJRuU8bcLpjYx18OsE3QB4ThqS8NFnIuQ
Hjki5a7QNaGAjod0hRWZQht6ZrB7qPFarU8xJdCNpx+HtQlHqMXFW/qSMINYV/zV
aqwHW/cu9U+2bppMcwLWd8Nfn2ThwcLoGvihZRmm39IFL95Q68bQkNlagX5epakL
ZZObGiYt+JwkHr8VlMTY4plKb0OSFDk/i/kZAl/oqBRdl5masHU=
=ELAa
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.