From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6778 invoked by alias); 29 Apr 2004 13:44:52 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 6640 invoked from network); 29 Apr 2004 13:44:48 -0000 Received: from unknown (HELO web15213.mail.bjs.yahoo.com) (202.43.216.143) by sources.redhat.com with SMTP; 29 Apr 2004 13:44:48 -0000 Message-ID: <20040429134443.17933.qmail@web15213.mail.bjs.yahoo.com> Received: from [61.187.54.11] by web15213.mail.cnb.yahoo.com via HTTP; Thu, 29 Apr 2004 21:44:43 CST Date: Thu, 29 Apr 2004 15:50:00 -0000 From: =?gb2312?q?Feng=20Wang?= Subject: Are BUILT_IN_POWII and BUILT_IN_POWCI necessary? (RE: Exponentiation by integral exponents) To: "Tobias_Schlüter" Cc: fortran , gcc@gcc.gnu.org In-Reply-To: <4090E61F.1040305@physik.uni-muenchen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: 8bit X-SW-Source: 2004-04/txt/msg01385.txt.bz2 --- Tobias_Schlüter µÄÕýÎÄ£º> [ 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