JHEnt:
Also based on the measurement of this output I would say the 64bit float is normalized? A different meassage outputs radians which would be 0.xxxxxxxx and would be denormallized?
In IEEE floating point, except for very small numbers, every number is normalized, which means for non-zero/special numbers, the binary exponent is set so that the top mantissa bit is always 1, and in the encoding, this bit is implicit, and not actually recorded. The formats are:
- 64-bit: 1 bit sign, 11 bit exponent (biased at -1023), 1 bit implicit value, 52 bit mantissa - Double-precision floating-point format - Wikipedia
- 32-bit: 1 bit sign, 8 bit exponent (biased at -127), 1 bit implicit value, 23 bit mantissa - Single-precision floating-point format - Wikipedia
A denormal 64-bit value has 0 in the exponent field (which is 2**-1024), and then the fractional part is the 52 bits in the mantissa. A denormal 32-bit value has 0 in the exponent field (2**-128) and the fractional part is the 23 bit mantissa. So if you extract the top 20 bits of the mantissa from the double and plop it into the bottom 20 out of 23 bits in the single precision, it would work.
One other thing to watch out for is the AVR is little endian, which means the least significant byte is the first byte. If you are transmitting raw values from another computer, you might need to swap bytes, depending on whether the remote system is big endian or little endian. Typically, if you are transmitting values in standard format, the network order is big endian, so you may need to swap bytes as you are getting them from the wire.