-
Notifications
You must be signed in to change notification settings - Fork 98
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
Decimal precision truncated when serialize/deserialize std::vector<double> container #417
Comments
TL;DR: Use at least C++17 (because it provides ryml::Tree serialized;
ryml::NodeRef root = serialized.rootref();
root |= ryml::SEQ;
for(const double v : test_vec)
root.append_child() << ryml::fmt::real(v, 17, ryml::FTOA_FLOAT); For more details, see the linked PR, which adds an example and explanation to the quickstart. |
biojppm
added a commit
that referenced
this issue
Apr 3, 2024
biojppm
added a commit
that referenced
this issue
Apr 3, 2024
biojppm
added a commit
that referenced
this issue
Apr 3, 2024
biojppm
added a commit
that referenced
this issue
Apr 3, 2024
@biojppm Thank you for providing detailed examples and great project. |
biojppm
added a commit
that referenced
this issue
Apr 3, 2024
biojppm
added a commit
that referenced
this issue
Apr 3, 2024
biojppm
added a commit
that referenced
this issue
Apr 3, 2024
biojppm
added a commit
that referenced
this issue
Apr 3, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi author, I found that the std::vector lost precision during the process of deserializing, As the following sample code:
The program will output:
elem 1.23234
elem 2.12323
elem 3.67848
How can I avoid losing numerical accuracy ?
The text was updated successfully, but these errors were encountered: