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: Roger Sayle <roger at eyesopen dot com>
- To: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Tue, 25 Jun 2002 20:35:53 -0600 (MDT)
- Subject: Re: How to determine that 2.0 == (float) 2 in a front-end.
> 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.
I hope this helps.
Roger
--
Roger Sayle, E-mail: roger@eyesopen.com
OpenEye Scientific Software, WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road, Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507. Fax: (+1) 505-473-0833