Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Panel | ||||
---|---|---|---|---|
| ||||
How can a UINT32 value represeting a float value been decoded as float in javascript? |
Panel | ||||
---|---|---|---|---|
| ||||
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 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); } |
Panel | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||
|