
Andrew Coppin wrote:
Note that the challenge asks for the "internal" bitmap representation of an IEEE double-precision integer
Actually it didn't. It asked for the machine's internal representation of a double precision float, and you are not guaranteed that this representation conforms to IEEE 7-whatsit. It is beyond me what you're going to do with that unspecified representation, though.
Did I mention that this is a silly challange yet?
Silly, yes. Challenge, no. We can do the same the C++ guy did, it's only a question if we need to. Something close to this: | import Foreign.Marshal | import Foreign.Ptr | import Data.Word | | valueToBytes :: Storable a => a -> IO [Word8] | valueToBytes a = with a $ \p -> peekBytes (castPtr b) (sizeOf a) Reversing the list and hammering it down to single bits is trivial after that. -Udo -- Structure is _nothing_ if it is all you got. Skeletons _spook_ people if they try to walk around on their own. I really wonder why XML does not. -- Erik Naggum