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

Precision loss when adding a nested model #313

Closed
hauke76 opened this issue Jul 6, 2020 · 2 comments
Closed

Precision loss when adding a nested model #313

hauke76 opened this issue Jul 6, 2020 · 2 comments

Comments

@hauke76
Copy link
Contributor

hauke76 commented Jul 6, 2020

Hi,

I stumbled over the issue that adding nested models results in a floating point precision loss. When adding a nested model, the _includeSDF is converted to a string through a call to Element::ToString. This ultimately calls Param::GetAsString() which uses the ParamStreamer to write data to a std::ostream. By injecting std::setprecision(std::numeric_limits<T>::max_digits10) in the output stream this precision loss can be prevented.

Kind regards,
Hauke

@hauke76
Copy link
Contributor Author

hauke76 commented Jul 6, 2020

I created a pull request for the master branch here: #314
I have a similar fix available for v6.x and it would be great if you could consider that as a merge request as well.

@EricCousineau-TRI
Copy link
Collaborator

Given merge of #314, closing this issue. Thanks!

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

2 participants