Is there a way to convert from 64-bit hexadecimal representation to decimal floating-point with a rabbit 4000?

I´m reading this hex value 0x403988544C886ECF thru serial port with a Rabbit 4000 and I need to convert it to a floating point IEEE-754 representation. I have already done this with a 32-bits hexadecimal using the following function:

(example)
FRoll = *(float *)&RRoll; (where RRoll is the 32-bits hex)

Is there any similar function for the 64-bits representation?

Thanks in advance!

I don’t think you’re going to find a simple solution to this problem. The Rabbit’s “double” is 32 bits, just like its “float”.

If it isn’t possible for you to make the conversion on the remote end of the serial connection (for example, by casting the 64-bit double to a 32-bit float), you’ll have to find existing code or write your own code to do the conversion.

If writing your own code, you’ll need to identify special values and convert them accordingly, and then break up the bits of the 64-bit double into the exponent and mantissa, and scale them down to the sizes available in a 32-bit float.

And then write a lot of unit tests to make sure you’re doing it correctly!

Here’s some code to convert from single-precision (32-bits) to half-precision (16-bits) that could serve as a model for going from 64 to 32 bits: https://stackoverflow.com/a/3542975/266392

And there might be code in this library to do the conversion: http://www.jhauser.us/arithmetic/SoftFloat.html