[Haskell-beginners] Double Trouble

Philip Scott haskell-beginners at foo.me.uk
Tue Nov 10 04:28:23 EST 2009


Hi Folks,

I'd just like to say thank you very much for your patient answers to my 
questions so far; it has been a real help on my Haskell adventure. Once 
I am become a Haskell god like y'all I will endeavour to repay the debt.

My current puzzle is doubles. I've extensively scoured the net and found 
various mentions of the same problem, but as far as I can see no 
answers; which I can't quite believe as it must be something people do 
all the time.

I need to interface my Haskell program with an existing C++ one over a 
TCP socket. I need to feed the C++ program doubles in standard 64-bit 
network order IEEE 765-1985 format, but if I serialize a double using 
Data.Binary I get something which
has altogeather too many bytes (I read somewhere it is an int and a long 
for the exponent and mantissa).

Any advice (or pointers to old threads, it isn't very easy to search the 
list archives) will be compensated for by a credit note for milk and 
cookies next time you are in the Cambridge, UK area :)

- Philip



More information about the Beginners mailing list