Subj : Re: Any help on why? To : borland.public.cpp.borlandcpp From : Bob Gonder Date : Wed Jul 07 2004 02:45 pm Stan DeGroff wrote: >Just pasted your code in. Same result.... (I just pipe the output to a TXT Yeah, was the 64bit double being read as two 32bit values by each %x. >I would be tempted to say the %X is not mapping the full floating point >number correctly, however, >The "result" value does. Not quite, what you see as "result" is actually "xresult" The first 0 is the lower portion of xresult, the second number is the upper portion. >Ok now, I tried something which does verify that %X does NOT map correctly >on float, infact it messes up the next number as well. Yeah, that's what happens when you use the incorrect sizes. >Next, How can we get the hexadecimal format for a float??? >I tried using %LX. Here's result: > >1.500000 = 3FF8000000000000 > 0012FF88, 0012FF88 > looks closer, except for verifing tha 3FF8 0000 is indead 1.5 Ok, so BC5.02 supports LX, That's the right answer. It also looks like you are using Windows Target, not DOS, as your floats are 64 bits. Wayne posted a link on the format in another sub-thread. >Question: In fortran I can map an array of integers on top of an array of >floating point. >This allows me to gain access to the data in multiplt formats. This is done >by using the >"equate" operand. > >Is there a similar operation within C ??? See union. For 64bit floats: union { float f; INT64 i; }number; number.f = 1.23; printf( "%LI", number.i ); /* warning..going to be really big number */ /* Not going to be 1 or 123. Somewhere around 4 billion billion */ .