8000 Floating point byte order does not round-trip · Issue #807 · stephane/libmodbus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Floating point byte order does not round-trip #807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
johannes1971 opened this issue May 1, 2025 · 1 comment
Open

Floating point byte order does not round-trip #807

johannes1971 opened this issue May 1, 2025 · 1 comment

Comments

@johannes1971
Copy link
johannes1971 commented May 1, 2025

Maybe I just completely misunderstand how this works, but is it the intention that modbus_set_float_xxxx does not round-trip with modbus_get_float_xxxx? I.e.

std::array<uint16_t, 2> arr;
modbus_set_float_abcd (24.2, arr.data ());
LOG (std::format ("{}", modbus_get_float_abcd (arr.data ()))); // returns "-12.100244"

modbus_set_float_badc (24.2, arr.data ());
LOG (std::format ("{}", modbus_get_float_badc (arr.data ()))); // returns "-12.100244"

modbus_set_float_cdab (24.2, arr.data ());
LOG (std::format ("{}", modbus_get_float_cdab (arr.data ()))); // returns "-12.100244"

modbus_set_float_dcba (24.2, arr.data ());
LOG (std::format ("{}", modbus_get_float_dcba (arr.data ()))); // returns "-12.100244"

As it is, I have to apply a different byte order depending on whether I'm reading or writing, which feels rather counter-intuitive.

@johannes1971
Copy link
Author

Is there any news on the question I raised above?

I'm after two pieces of information. The first is why round-tripping doesn't seem to work; this seems rather counter-intuitive to me, and I'd like to figure out if I'm doing something wrong. The second, perhaps more fundamental issue, is whether this library is still being maintained, or if the maintainers have given up and moved on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0