public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [gfortran] Exponentiation by integral exponents
       [not found] <20040429024944.52618.qmail@web15212.mail.bjs.yahoo.com>
@ 2004-04-29 12:20 ` Tobias Schlüter
  2004-04-29 15:50   ` Are BUILT_IN_POWII and BUILT_IN_POWCI necessary? (RE: Exponentiation by integral exponents) Feng Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Schlüter @ 2004-04-29 12:20 UTC (permalink / raw)
  To: Feng Wang; +Cc: fortran, gcc

[ 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.

- Tobi

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Are BUILT_IN_POWII and BUILT_IN_POWCI necessary? (RE: Exponentiation by integral exponents)
  2004-04-29 12:20 ` [gfortran] Exponentiation by integral exponents Tobias Schlüter
@ 2004-04-29 15:50   ` Feng Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Feng Wang @ 2004-04-29 15:50 UTC (permalink / raw)
  To: Tobias_Schlüter; +Cc: fortran, gcc

[-- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-04-29 13:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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   ` Are BUILT_IN_POWII and BUILT_IN_POWCI necessary? (RE: Exponentiation by integral exponents) Feng Wang

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).