-1

I tried to convert Unsigned 16 type floating point number but I couldn't find which functions or conversation method do I have to use for this.

For example I have 3 decimal numbers and these numbers have came with these hex value BD97 >>>>>>> 38.84

3098 >>>>>>> 38.96

8497 >>>>>>>> 38.79

I belive these are half precision floating point but couldn't understand how can I convert them. Is there any body help on this matter?

Update :

I'm sorry I think I couln't explain clearly. The values I wrote above comes from a kind of serial bus but these values also printed on display. Value from serial bus coming Unsigned16(I think this is special 16bit data type).

For example when I read 0xBD97 from bus, machine display shows 38.84 or when I read 0x3098, display shows 38.96.

The interesting thing is, these hex value which I get from bus seems irrelevant to the data shown on display. So, I thought this data was half precision data but I couldn't find how to convert it.

Thanks

1 Answers1

0

The data being read from the bus does not seem to use a floating-point format. Based on the two data items provided, it seems to be an integer scaled by a factor of 1000. We observe that 8497 = 0x9784 = 38788 → 38.79, and that 3098 = 0x9830 = 38960 → 38.96.

njuffa
  • 23,970
  • 4
  • 78
  • 130