What is the difference between Float32, Float32LE and Float32MLE?

505 Views Asked by At

I'm working in a SCADA system with Modbus protocol. It offers me these data types and I don't know what's the difference between them. Could anyone please clarify?

1

There are 1 best solutions below

0
Markus Safar On

Float32 or sometimes Float32BE is the default representation of a float value by using big endian. For a float with 32 bits (which is typically encoded by using the IEEE 754 standard) we need 4 bytes which leads to the following memory layout:
Byte 1, Byte 2, Byte 3, Byte 4 or ABCD (to use a more common and readable example with 4 different characters).

Float32LE stands for little endian and is represented in the following memory layout:
Byte 4, Byte 3, Byte 2, Byte 1 or DCBA

Float32MLE stands for mid-little-endian and is represented in the following memory layout:
Byte 3, Byte 4, Byte 1, Byte 2 or CDAB

To complete the list of possibilities you can also find something called
Float32MBE which is mid-big-endian and represented in the following memory layout:
Byte 2, Byte 1, Byte 3, Byte 4 or BACD