Search code examples
javatypesfloating-pointieee-11073

How to convert IEEE-11073 16-bit SFLOAT to simple float in Java?


The title speaks for itself: How to convert IEEE-11073 16-bit SFLOAT to simple float in Java?


Solution

  • You can use bit shifting. extract the sign, exponent and mantissa and shift these so they are in float format. You may need to correct for Infinity and NaN.

    As @PretiP's answer points out the exponent is base 10 so you would need to multiply or divide by a power of 10 to get the final value.