Hi all,
Going to use a ML1400 to talk to a Krohne gas meter via Modbus. Krohne's totals come as doubles (64-bit floats). I was wondering if anyone had come up with a good way to do the 64 to 32-bit float conversion (since ML's do not recognize doubles).
It looks like I can just isolate the sign bit, mantissa, and exponent with bit operations, then run them through a compute to do the downcast, as shown in the first answer here: https://social.msdn.microsoft.com/Forums/vstudio/en-US/fee6cb46-9918-430c-8c99-861a716a1552/convert-from-64-bit-double-to-float?forum=vclanguage , but if someone has something already they'd be willing to share, or a better suggestion of how to do it, I'd appreciate it.
Going to use a ML1400 to talk to a Krohne gas meter via Modbus. Krohne's totals come as doubles (64-bit floats). I was wondering if anyone had come up with a good way to do the 64 to 32-bit float conversion (since ML's do not recognize doubles).
It looks like I can just isolate the sign bit, mantissa, and exponent with bit operations, then run them through a compute to do the downcast, as shown in the first answer here: https://social.msdn.microsoft.com/Forums/vstudio/en-US/fee6cb46-9918-430c-8c99-861a716a1552/convert-from-64-bit-double-to-float?forum=vclanguage , but if someone has something already they'd be willing to share, or a better suggestion of how to do it, I'd appreciate it.