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

Avoid to use std::to_string to pass floating point simulation parameters #246

Merged
merged 2 commits into from
Sep 27, 2020

Conversation

traversaro
Copy link
Contributor

std::to_string truncates the values with 1e-6 precision, and is prone to locale-related bug.

Fix #245 .

std::to_string truncates the values with 1e-6 precision, and is prone
to locale-related bug.

Fix robotology-legacy#245
Copy link
Collaborator

@diegoferigo diegoferigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for the fix!!

@diegoferigo
Copy link
Collaborator

Let me know if you want to add a test or if I can merge as it is.

@traversaro
Copy link
Contributor Author

Let me know if you want to add a test or if I can merge as it is.

I added a test in 07d0686 . I had to add also a pytest.approx, as in IEEE 754 math it is not true that a + a + a == 3*a .

@diegoferigo
Copy link
Collaborator

diegoferigo commented Sep 27, 2020

That's actually the right way to handle floating point comparisons, thanks! Merging.

@diegoferigo diegoferigo merged commit b1d6820 into robotology-legacy:devel Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Impossible to set timestep lower then 1e-7
2 participants