This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to determine that 2.0 == (float) 2 in a front-end.
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 26 Jun 2002 21:33:55 +0200
- Subject: Re: How to determine that 2.0 == (float) 2 in a front-end.
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <Pine.LNX.4.33.0206252030070.17383-100000@www.eyesopen.com>
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)