public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Feng Wang" <wf_cs@yahoo.com>
To: "Tobias_Schlüter" <tobias.schlueter@physik.uni-muenchen.de>
Cc: fortran <fortran@gcc.gnu.org>, gcc@gcc.gnu.org
Subject: Are BUILT_IN_POWII and BUILT_IN_POWCI necessary? (RE: Exponentiation by integral exponents)
Date: Thu, 29 Apr 2004 15:50:00 -0000	[thread overview]
Message-ID: <20040429134443.17933.qmail@web15213.mail.bjs.yahoo.com> (raw)
In-Reply-To: <4090E61F.1040305@physik.uni-muenchen.de>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312, Size: 2443 bytes --]

 --- Tobias_Schlüter <tobias.schlueter@physik.uni-muenchen.de> µÄÕýÎÄ£º> [
forwarding to gcc@gcc.gnu.org so more knowledgeable people can comment 
> on the point I make in the last paragraph ]
> 
> Feng Wang wrote:
> > Hi, Tobi, Paul, etc
> >   I missed the discussion because of my poor modem. But I have implemented
> this
> > and the patch is under test. IMHO, we have to implement the algorithm
> described
> > by Knuth in the FE. BUILT_IN_POW only deals with Real type. How about
> complex
> > type? There are also many problems to consider when an integer is raised to
> an
> > negative integer. The result is just 0, -1, or 1. So it is not correct to
> > convert integer to real. 
> 
> This is a good point that I hadn't thought about.
> 
> > I think we should also implement the runtime library
> > function powi. When a value is raised to an varible integer, we just call
> the
> > library function. The value may be of integer type, real type or complex
> type.
> 
> Yeah, I thought so as well. I was already looking for an implementation.
> 
> > I have done these and in a few days I will give the patch. I didn't port
> Andy's
> > implementation. Andy's vertion only deal with exponent under 100 and don't
> > consider (integer ** negative integer). The main algorithm in my
> implementation
> > is from builtins.c and can deal with an arbitrary integer exponent. The
> > algorithm in powi library function is from libf77.
> 
> If your patch is finished I agree that we should go with your patch, as 
> mine is far from finished. I chose to port Andy's implementation as this 
> was my first step in GCC trees, and I didn't want to do something from 
> scratch :-)
> 
> I don't necessarily agree that this should be handled in the FE, though. 
> There might be other languages that have an "integral exponent" idiom, 
> so a language independent solution might be preferable.

To this point it is reasonable. But thus we will have to build and expand
BUILT_IN_POWII (int ** int) and  BUILT_IN_POWCI (complex ** int) in the BE. Is
this necessary?  Maybe the GCC community can give us some suggestion.

Feng Wang

_________________________________________________________
Do You Yahoo!? 
»ÝÆÕTTÓÎÏ·¾ç£¬ÍæÓÎÏ·£¬Öд󽱣¡
http://cn.rd.yahoo.com/mail_cn/tag/SIG=1402c0to2/**http%3A%2F%2Fhp.allyes.com%2Flaserjet%2Fgamestory%2Findex.html%3Fjumpid%3Dex_hphqapcn_MongooseLJ1010%2F201073CN407016%2FYahoo

      reply	other threads:[~2004-04-29 13:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20040429024944.52618.qmail@web15212.mail.bjs.yahoo.com>
2004-04-29 12:20 ` [gfortran] Exponentiation by integral exponents Tobias Schlüter
2004-04-29 15:50   ` Feng Wang [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=20040429134443.17933.qmail@web15213.mail.bjs.yahoo.com \
    --to=wf_cs@yahoo.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=tobias.schlueter@physik.uni-muenchen.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).