Double Trouble

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Double Trouble

Philip Scott-2
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

Reply | Threaded
Open this post in threaded view
|

Double Trouble

Krzysztof Skrzętnicki
Perhaps this module will help:

http://hackage.haskell.org/package/data-binary-ieee754

Regards

Krzysztof Skrz?tnicki

On Tue, Nov 10, 2009 at 10:28, Philip Scott <[hidden email]> wrote:

> 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
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/beginners
>
Reply | Threaded
Open this post in threaded view
|

Double Trouble

Philip Scott-2
Hi ho,

> Perhaps this module will help:
>
> http://hackage.haskell.org/package/data-binary-ieee754
>
>  
>> 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).
>>    

Thank you very much; I will take a look at that! I have no idea how I
missed it, I went through every package on hackage that had 'binary' in
the name, I must have sailed right past :)

- Philip