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
JSON data loss resulting from toString's use of scientific notation #1863
Labels
Comments
Have you checked if |
andrewfb
added a commit
to andrewfb/Cinder
that referenced
this issue
Jul 2, 2017
The issue appears to be due to a bug in |
kitschpatrol
added a commit
to kitschpatrol/Cinder
that referenced
this issue
Jul 4, 2017
Thanks Mike, thanks Andrew. Andrew, your PR works for me. I wrote some unit tests to verify. PR for the tests if you want them is in #1867. |
andrewfb
added a commit
that referenced
this issue
Jul 9, 2017
Addressing #1863, JSON misrepresenting integer value
Fixed in #1866 |
3togo
pushed a commit
to 3togo/Cinder
that referenced
this issue
Aug 12, 2019
3togo
pushed a commit
to 3togo/Cinder
that referenced
this issue
Aug 12, 2019
3togo
pushed a commit
to 3togo/Cinder
that referenced
this issue
Aug 12, 2019
Addressing cinder#1863, JSON misrepresenting integer value
3togo
pushed a commit
to 3togo/Cinder
that referenced
this issue
Aug 12, 2019
…nUnitTests Added unit tests to check issue cinder#1863 and pr cinder#1866.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hmm, this doesn't look right:
I believe this is happening because JsonTree casts the
uint_32t
to adouble
, and then sends it throughtoString
which yields the4.29497e+09
, which is subsequently truncated to4
.If you tweak
toString
's implementation the to use fixed rather than scientific notation, this is resolved.E.g., in Utilities.h:
Which gives:
But not sure of any implications elsewhere? Better to make a special case of it in JsonTree's implementation? Any thoughts before I attempt a PR?
The duplication is unpleasant... but maybe a template specialization makes sense?
Something like the following In Utilities.h:
FWIW this is on a Mac, haven't duplicated on Windows yet. I'm unclear on where an instance of
std::ostringstream
derives its default formatting from, and whether this default is globally configurable.The text was updated successfully, but these errors were encountered: