From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28314 invoked by alias); 19 Sep 2004 18:34:32 -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 28268 invoked from network); 19 Sep 2004 18:34:31 -0000 Received: from unknown (HELO web52801.mail.yahoo.com) (206.190.39.165) by sourceware.org with SMTP; 19 Sep 2004 18:34:31 -0000 Message-ID: <20040919183425.53419.qmail@web52801.mail.yahoo.com> Received: from [217.9.225.6] by web52801.mail.yahoo.com via HTTP; Sun, 19 Sep 2004 11:34:25 PDT Date: Sun, 19 Sep 2004 19:17:00 -0000 From: Luchezar Belev Subject: Re: why not consfold sin(const) To: Robert Dewar Cc: gcc@gcc.gnu.org In-Reply-To: <414DAD7E.30606@gnat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2004-09/txt/msg01137.txt.bz2 Robert Dewar wrote: > Luchezar Belev wrote: > ... > Second, surely in any reasonably written program you would expect such > constants to only be defined once, so I wonder how useful this would > be in practice. >... Here is one example of how this could be useful: Imagine you have some defined floating point const MY_CONST in your program and you use it in various floating point expressions in different ways. Say somewhere you use the expression x+MY_CONST, somewhere else you use the expression log(x)/log(MY_CONST), and somewhere else exp(2-x*(MY_CONST + sqrt(MY_CONST))) and so on. Of course you could define different consts for 1/log(MY_CONST) and MY_CONST+sqrt(MY_CONST), but that's not very beautifuf, especially if you would like to change the value of MY_CONST from time to time - then you would have to recalculate all of it's derivated consts too. Lucho __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail