public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>,
	 "libc-alpha@sourceware.org" <libc-alpha@sourceware.org>
Cc: nd@arm.com
Subject: Re: [PATCH] Use fabs(f/l) rather than __fabs
Date: Tue, 03 Oct 2017 14:33:00 -0000	[thread overview]
Message-ID: <59D39F92.302@arm.com> (raw)
In-Reply-To: <DB6PR0801MB2053B16BF79A3E6ECD6D7359837E0@DB6PR0801MB2053.eurprd08.prod.outlook.com>

On 29/09/17 14:02, Wilco Dijkstra wrote:
> diff --git a/sysdeps/ieee754/dbl-64/e_log10.c b/sysdeps/ieee754/dbl-64/e_log10.c
> index dfb7d056caee5f592048559b448c899aa11e9de2..677cbc4df8739521c50a72d5ab657f438c74c129 100644
> --- a/sysdeps/ieee754/dbl-64/e_log10.c
> +++ b/sysdeps/ieee754/dbl-64/e_log10.c
> @@ -65,7 +65,7 @@ __ieee754_log10 (double x)
>    if (hx < 0x00100000)
>      {                           /* x < 2**-1022  */
>        if (__glibc_unlikely (((hx & 0x7fffffff) | lx) == 0))
> -	return -two54 / __fabs (x);	/* log(+-0)=-inf  */
> +	return -two54 / fabs (x);	/* log(+-0)=-inf  */
>        if (__glibc_unlikely (hx < 0))
>  	return (x - x) / (x - x);       /* log(-#) = NaN */
>        k -= 54;
> diff --git a/sysdeps/ieee754/dbl-64/e_log2.c b/sysdeps/ieee754/dbl-64/e_log2.c
> index 2f3da129f83dd0dc2fc7da78cfce3804febdbac5..e4a6aff9a3b5aa68c03603bf4cb8bb78507ea9c6 100644
> --- a/sysdeps/ieee754/dbl-64/e_log2.c
> +++ b/sysdeps/ieee754/dbl-64/e_log2.c
> @@ -83,7 +83,7 @@ __ieee754_log2 (double x)
>    if (hx < 0x00100000)
>      {                           /* x < 2**-1022  */
>        if (__glibc_unlikely (((hx & 0x7fffffff) | lx) == 0))
> -	return -two54 / __fabs (x);        /* log(+-0)=-inf */
> +	return -two54 / fabs (x);        /* log(+-0)=-inf */
>        if (__glibc_unlikely (hx < 0))
>  	return (x - x) / (x - x);       /* log(-#) = NaN */
>        k -= 54;


note that on aarch64 wrong code is generated for these fabs
changes, most likely a gcc bug, still investigating.

it is not visible on aarch64 because the compat wrapper
handles the log(0) case, but without the wrapper (e.g. ilp32)
log(0) in downward rounding becomes +inf instead of -inf,
because fabs(x) is compiled to x-x for x==0 for some reason.

  parent reply	other threads:[~2017-10-03 14:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-29 13:02 Wilco Dijkstra
2017-09-29 16:30 ` Joseph Myers
2017-09-29 18:34   ` Wilco Dijkstra
2017-09-29 19:56     ` Joseph Myers
2017-09-29 20:00     ` Gabriel F. T. Gomes
2017-10-03 14:33 ` Szabolcs Nagy [this message]
2017-10-03 15:49   ` Szabolcs Nagy

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=59D39F92.302@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=libc-alpha@sourceware.org \
    --cc=nd@arm.com \
    /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).