public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
To: gcc@gcc.gnu.org
Cc: roger@eyesopen.com
Subject: Question on valid transformations for cbrt
Date: Sat, 06 Mar 2004 18:54:00 -0000	[thread overview]
Message-ID: <200403061854.i26Isn2m018933@caip.rutgers.edu> (raw)

I'm in the process of writing some transformations for builtin cbrt.
However it occurs to me that certain combinations might be invalid
when converting to pow, because pow doesn't like negative values with
non-integral powers.  E.g.:

	cbrt(sqrt(x)) -> pow(x, 1/6)

can be considered "safe" with -ffast-math IMO because if x was
negative the original sqrt would have choked anyway.  However here:

	cbrt(pow(x,y)) -> pow(x,y/3)

if x is negative and y is say 5, the first form would succeed but the
second would get an error EDOM because 5/3 is non-integral.  So I
don't think the latter is a valid transformation even with
-ffast-math.

(Perhaps the latter is okay if x passes tree_expr_nonnegative_p, but
that might not be worth it.)

Thoughts?

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu

             reply	other threads:[~2004-03-06 18:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-06 18:54 Kaveh R. Ghazi [this message]
2004-03-07 15:11 ` Roger Sayle
2004-03-10 15:32   ` Segher Boessenkool
2004-03-10 16:06     ` Robert Dewar
2004-04-02  0:22   ` Geoff Keating

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=200403061854.i26Isn2m018933@caip.rutgers.edu \
    --to=ghazi@caip.rutgers.edu \
    --cc=gcc@gcc.gnu.org \
    --cc=roger@eyesopen.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).