From: Joseph Myers <joseph@codesourcery.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <rguenther@suse.de>, <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix up sqrt(x) < c and sqrt(x) >= c match.pd folding (PR tree-optimization/91734)
Date: Tue, 17 Sep 2019 21:16:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.21.1909172109530.3323@digraph.polyomino.org.uk> (raw)
In-Reply-To: <20190914004014.GE25273@laptop.zalov.cz>
On Sat, 14 Sep 2019, Jakub Jelinek wrote:
> Hi!
>
> As mentioned in the PR, the sqrt (x) < c optimization into x < c*c
> sometimes breaks the boundary case, if c2=c*c is inexact then in some cases
> we need to optimize it into x <= c*c rather than x < c*c. The original
And in some cases the boundary case is wrong in the other direction and we
need to optimize it into x < nextdown (c*c). For example, say c ==
0x1.001002p+0f; (double) c * c == 0x1.002005004004p+0, and rounding to
nearest float gives c * c == 0x1.002006p+0f, so nextdownf (c * c) ==
0x1.002004p+0f; in double precision, sqrt (0x1.002004p+0f) ==
0x1.0010017fe8006p+0, and rounding to nearest float gives c again. So x <
c*c does not in fact imply sqrt (x) < c in that case.
--
Joseph S. Myers
joseph@codesourcery.com
prev parent reply other threads:[~2019-09-17 21:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-14 0:40 Jakub Jelinek
2019-09-16 6:57 ` Richard Biener
2019-09-21 6:14 ` [PATCH] Fix up sqrt(x) < c and sqrt(x) >= c match.pd folding (PR tree-optimization/91734, take 2) Jakub Jelinek
2019-09-30 7:03 ` Patch ping Jakub Jelinek
2019-10-04 20:57 ` [PATCH] Fix up sqrt(x) < c and sqrt(x) >= c match.pd folding (PR tree-optimization/91734, take 2) Jeff Law
2019-09-17 21:16 ` Joseph Myers [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=alpine.DEB.2.21.1909172109530.3323@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=rguenther@suse.de \
/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).