public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: Fabian Schriever <fabian.schriever@gtd-gmbh.de>
Cc: newlib@sourceware.org
Subject: Re: [PATCH] Fix hypotf missing mask in hi+lo decomposition
Date: Fri, 20 Mar 2020 10:16:03 +0100	[thread overview]
Message-ID: <20200320091603.GH778468@calimero.vinschen.de> (raw)
In-Reply-To: <20200319153408.1413-1-fabian.schriever@gtd-gmbh.de>

[-- Attachment #1: Type: text/plain, Size: 1457 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      parent reply	other threads:[~2020-03-20  9:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19 15:34 Fabian Schriever
2020-03-19 22:27 ` Keith Packard
2020-03-20  9:16 ` Corinna Vinschen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200320091603.GH778468@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=fabian.schriever@gtd-gmbh.de \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).