public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/99048] __gcc_qadd produces spurious NaN Date: Fri, 12 Feb 2021 16:54:55 +0000 [thread overview] Message-ID: <bug-99048-4-89NzdH7MTm@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-99048-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99048 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- a = -2.5118280672773279e+307 c = 1.7976931348623157e+308 c is in particular the maximum normalized number, __DBL_MAX__, binary 0x7fefffffffffffff. 126 z = a + c; z = 1.546510328134583e+308 and that is finite. 144 q = a - z; But this is -inf. 145 zz = q + c + (a - (q + z)) + aa + cc; and everything goes downhill from there, as a, c, z, aa and cc are all finite, but q is -inf and a - (-inf + finite) is +inf and -inf + +inf is nan. So, the code: z = a + c; if (nonfinite (z)) { ... } else { q = a - z; would need another if (nonfinite (q)) check after computation of q (and I don't believe it could just compute q = a - z; right after z = a + c; and replace if (nonfinite (z)) with if (nonfinite (q)) because if a is +-inf and c is finite, z will be +-inf and q will be nan.
next prev parent reply other threads:[~2021-02-12 16:54 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-09 23:33 [Bug libgcc/99048] New: " bbarenblat at gmail dot com 2021-02-12 16:26 ` [Bug target/99048] " segher at gcc dot gnu.org 2021-02-12 16:54 ` jakub at gcc dot gnu.org [this message] 2021-02-12 17:02 ` segher at gcc dot gnu.org
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=bug-99048-4-89NzdH7MTm@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.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: linkBe 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).