This is the mail archive of the gcc@gcc.gnu.org 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: How to determine that 2.0 == (float) 2 in a front-end.


Roger Sayle wrote:

> > That aside, what is the procedure a front-end has to follow to determine
> > that a constant A (some float mode) is in fact "equal" to a constant I
> > (some integer mode) ?
 
> For a small number of privilged constants, including 2.0, there are
> routines in tree.c to determine whether a tree node has a particular
> floating point value.  In this case, "int real_twop (tree expr)".
> 
> The code in these routines should help coming up with an implementation
> for the more general case.

Thanks - I'll try this suggestion together with another one I received
from Paul Koning this weekend.

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)


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