This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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! 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]