Skip to content
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

YAML Floating Point Precision in Output Files #1016

Open
holdsworth opened this issue Jul 28, 2021 · 4 comments
Open

YAML Floating Point Precision in Output Files #1016

holdsworth opened this issue Jul 28, 2021 · 4 comments

Comments

@holdsworth
Copy link

When saving a file with new API you cannot set explicitly the number of digits after the . thus when having a double of the form 1.0 it is saved as 1, which causes issues later on if you're deducing parameter type based on input, this badly hurts the config file (especially when you re-save it)

The fix would be to modify the last else in inner_encode function (line 102 in node/convert.h file) from stream << ... to stream << std::setprecision(12) << std::fixed << rhs;

Note that you can expose the set precision to be externally modified, would you like me to send a PR?

@jbeder
Copy link
Owner

jbeder commented Jul 28, 2021 via email

@fujitatomoya
Copy link

@jbeder we have been blocked by this problem for a long time. besides i am new for yaml-cpp, could you give us a clue how to address this issue?

@jbeder
Copy link
Owner

jbeder commented Dec 7, 2023

I think the OP was going to submit PR? Anyways, patches welcome.

@fujitatomoya
Copy link

fujitatomoya commented Dec 22, 2023

I am not sure who OP is, but with suggested code, i tried with fujitatomoya/ros2_persist_parameter_server#13 (comment) but it did not work. it would be appreciated if you can tell me i got anything wrong.

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

3 participants