From: Jan Hubicka <jh@suse.cz>
To: Richard Henderson <rth@redhat.com>, Jan Hubicka <jh@suse.cz>,
gcc-patches@gcc.gnu.org, aj@suse.de
Subject: Re: Simplify floating point conversions II
Date: Wed, 06 Nov 2002 13:11:00 -0000 [thread overview]
Message-ID: <20021106211059.GB1316@atrey.karlin.mff.cuni.cz> (raw)
In-Reply-To: <20021106180930.GA22066@redhat.com>
> On Wed, Nov 06, 2002 at 06:54:41PM +0100, Jan Hubicka wrote:
> > + For fast math it would be safe probably to convert (float)sqrt(x)
> > + into sqrt((float)x), but in strict mode the argument can overflow. */
>
> I don't believe this to be true.
What you don't believe? That in ffast-math we can do the transformation?
Right, that is possible. I am not sure whehter we can afford the
possible overflow there. So I can drop the comment.
>
> > + /* Wind away possible cast. */
> > + if (TREE_CODE (arg0) == NOP_EXPR)
> > + arg0 = TREE_OPERAND (arg0, 0);
>
> Why would you do this? This might be casting down to double from
> long double. You should only strip casts when they widen the type.
Right, I will add that. For some reason I believed that these are
CONVERT.
>
> > + /* convert (outertype)((innertype0)a+(innertype1)b)
> > + into ((newtype)a+(newtype)b) where newtype
> > + is the widest mode from all of these. */
>
> This changes overflow characteristics of +. Consider
>
> (double)((float)a + (float)b)
>
> where A = B = 2**127. The result should be +Inf, not 2**128.
I am doing that only when the mode of + is wider.
>
> Finally, I think it is alarmingly incorrect that
>
> (float)((double)a + (double)b))
>
> does not result in a quantity of type float, as requested.
Here I do that. When a and b are floats, I will produce
(a+b)
is that wrong?
Honza
>
>
> r~
next prev parent reply other threads:[~2002-11-06 21:11 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-05 9:14 Simplify floating point conversions Jan Hubicka
2002-11-05 9:38 ` Richard Henderson
2002-11-05 9:42 ` Jan Hubicka
2002-11-06 1:23 ` Simplify floating point conversions II Jan Hubicka
2002-11-06 3:08 ` Michael Matz
2002-11-06 4:36 ` Jan Hubicka
2002-11-06 9:54 ` Jan Hubicka
2002-11-06 10:09 ` Richard Henderson
2002-11-06 13:11 ` Jan Hubicka [this message]
2002-11-06 13:19 ` Jan Hubicka
2002-11-06 13:35 ` Gabriel Dos Reis
2002-11-06 13:36 ` Jan Hubicka
2002-11-06 14:06 ` Gabriel Dos Reis
2002-11-06 14:29 ` Converting floor to rint Jan Hubicka
2002-11-06 14:47 ` Richard Henderson
2002-11-06 14:53 ` Jan Hubicka
2002-11-06 14:55 ` Gabriel Dos Reis
2002-11-07 1:21 ` Jan Hubicka
2002-11-07 1:32 ` Jakub Jelinek
2002-11-07 1:33 ` Gabriel Dos Reis
2002-11-07 1:44 ` Jan Hubicka
2002-11-07 1:52 ` Jakub Jelinek
2002-11-07 1:54 ` Jan Hubicka
2002-11-07 2:04 ` Jan Hubicka
2002-11-07 4:47 ` Gabriel Dos Reis
2002-11-07 4:56 ` Jan Hubicka
2002-11-07 5:14 ` Andreas Schwab
2002-11-07 5:27 ` Gabriel Dos Reis
2002-11-07 5:31 ` Jan Hubicka
2002-11-07 5:35 ` Andreas Schwab
2002-11-07 5:22 ` Gabriel Dos Reis
2002-11-07 5:43 ` Andreas Schwab
2002-11-07 6:23 ` Gabriel Dos Reis
2002-11-07 7:01 ` Jan Hubicka
2002-11-07 7:18 ` Gabriel Dos Reis
2002-11-06 13:48 ` Simplify floating point conversions III Jan Hubicka
2002-11-06 14:55 ` Richard Henderson
2002-11-07 2:54 ` Simplify floating point conversions IV Jan Hubicka
2002-11-18 15:01 ` Richard Henderson
2002-11-05 11:14 ` Simplify floating point conversions Geoff Keating
2002-11-06 1:09 ` Jan Hubicka
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=20021106211059.GB1316@atrey.karlin.mff.cuni.cz \
--to=jh@suse.cz \
--cc=aj@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=rth@redhat.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).