This is the mail archive of the gcc-help@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] |
I've looked in libgcc2.c and am unfortunately a bit unsure about how to get GCC to directly cast an integer value to a float type. For example, I would like to do something like this:
float __floatsisf(long i) { return (float)0x40c00000; /* float value 6.0 */ }
but the cast will of course turn this into some completely different number. Can someone quickly explain how to do this?
float __floatsisf(long i) { u.i = 0x40c00000; return u.f; }
-- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |