Hex to float conversion trouble

ziggomatic's icon

Having a really tough time trying to figure out how to convert a specific type of hex data into into float values.

The data packets I am receiving are grouped together as 8 characters, and appears like this example:

68CA20C3

Converted to Hex the result should equal something like -389.2559814453125.

I've tried to get some some assistance from chatgpt today and in several iterations all we could get was an incorrect conversion result of 7636179012646915478126592.

I was told this sort of conversion is extremely easy in C code, yet I cant find any native Max support for doing this.

Any help here would be greatly appreciated, thank you.

Source Audio's icon

you have to describe that "specific" hex data.

in any case, that result -389.2559814453125 for HEX input 68CA20C3

can not be correct no matter what format your input has,

unless you invented own format.

taken that it is float 32 and little endian result would be -160.790649

ziggomatic's icon

I am trying to cast 32 bit unsigned data into a float.

I have been told the term for this hex data conversion is “casting”.

Jan M's icon

Hello ZIGGOMATIC,


If as you write your initial data is 32 bit unsigned (integer I assume??) the result of any casting can never be negative as it is unsigned (negative values do not exist).

What is its exactly what you want to achieve? Where does the Hexadecimal values you use come from?

It sounds a bit to be you are stuck a on a detail that may not even be necessary, when looking on what you want to achieve in a wider view. This happens often, when AI is your assistant unfortunately....