How can a UINT32 value represeting a float value been decoded as float?
- Armin Beck
How can a UINT32 value represeting a float value been decoded as float in javascript?
Supposing you are using an existing display from the templates such as "ATVISE/Default/Number/in_out_value", then you can extend it with a function
from http://stackoverflow.com/questions/4414077/read-write-bytes-of-float-in-js named "Bytes2Float32()" to convert the UINT32 integer value to a float value.
function Bytes2Float32(bytes) {Â
   var sign = (bytes & 0x80000000) ? -1 : 1;Â
   var exponent = ((bytes >> 23) & 0xFF) - 127;Â
   var significand = (bytes & ~(-1 << 23));Â
    if (exponent == 128)Â
        return sign * ((significand) ? Number.NaN : Number.POSITIVE_INFINITY);Â
    if (exponent == -127) {Â
       if (significand == 0) return sign * 0.0;Â
       exponent = -126;Â
       significand /= (1 << 22);Â
   } else significand = (significand | (1 << 23)) / (1 << 23);Â
   return sign * significand * Math.pow(2, exponent);Â
}
Example: Feed the function with the value 0x42c83852 for example and it returns the value 100.11