Chris Kuklewicz wrote: > Who can suggest a way to cast from Float to Word32 and Double to Word64 > using ghc? The actual task is that I need to write out the Float as a > little endian sequence of four bytes and also be able to read it back in. > The writing and reading are done in Put and Get monads to ByteString (from > the "binary" package).
I think alloca-like hacks is really the wrong direction and asking for trouble. You are trying to translate between platform-dependent native floats, and IEEE floats in a specified platform-independent binary format for Google. So use encodeFloat/decodeFloat - fast primitives in GHC - on the native side, and a hand-written Binary instance for the exact format you need on the Google side. My opinion, YMMV. Regards, Yitz _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users