This is the mail archive of the
mailing list for the GCC project.
Re: why not consfold sin(const)
- From: Luchezar Belev <l_belev at yahoo dot com>
- To: Robert Dewar <dewar at gnat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 19 Sep 2004 11:34:25 -0700 (PDT)
- Subject: Re: why not consfold sin(const)
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.
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!