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.


> 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


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