public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Florian Weimer <fweimer@redhat.com>, libc-help@sourceware.org
Subject: Re: isnan and exceptions
Date: Tue, 1 Sep 2020 17:31:35 -0300	[thread overview]
Message-ID: <8e4e4dc2-e5cf-2102-2389-3dc53f3a5933@linaro.org> (raw)
In-Reply-To: <87wo1ipzfr.fsf@oldenburg2.str.redhat.com>



On 28/08/2020 12:23, Florian Weimer via Libc-help wrote:
> It seems that __builtin_isnanl raises Invalid Operation for sNaNs on
> x86-64, but glibc's isnanl implementation does not.
> 
> Is this expected?  Are both behaviors correct?
> 
> The background of my question is that if I replace isnanl with this:
> 
> int
> isnanl (long double x)
> {
>   return __builtin_isnanl (x);
> }
> 
> I get these test suite failures:
> 
> testing long double (without inline functions)
> Failure: isnan (sNaN): Exception "Invalid operation" set
> Failure: isnan (-sNaN): Exception "Invalid operation" set
> Failure: isnan_downward (sNaN): Exception "Invalid operation" set
> Failure: isnan_downward (-sNaN): Exception "Invalid operation" set
> Failure: isnan_towardzero (sNaN): Exception "Invalid operation" set
> Failure: isnan_towardzero (-sNaN): Exception "Invalid operation" set
> Failure: isnan_upward (sNaN): Exception "Invalid operation" set
> Failure: isnan_upward (-sNaN): Exception "Invalid operation" set

I think it is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66462 

As Wilco has noted, using unordered floating point comparison in
isnan expansion is not fully correct and as patch has been submitted
but later revert on gcc.  The last iteration [1] seems handle the
raised issues, but it was never committed. 

[1] https://gcc.gnu.org/legacy-ml/gcc-patches/2016-11/msg02567.html

      reply	other threads:[~2020-09-01 20:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-28 15:23 Florian Weimer
2020-09-01 20:31 ` Adhemerval Zanella [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=8e4e4dc2-e5cf-2102-2389-3dc53f3a5933@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=libc-help@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).