You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected that small doubles would be represented in dumped JSON as a javascript number in scientific notation, but instead it just appears as 0.000000
Looking at the json code, it appears this is due to using std::to_string() for all numbers, which is equivalent to sprintf("%f", ...) whereas sprintf("%g", ...) would be more appropriate. To fix this, the dump function would need to use something other than to_string to format floating point numbers. I'll try to put together a PR for this although C++ is far from my best language.
The text was updated successfully, but these errors were encountered:
I expected that small doubles would be represented in dumped JSON as a javascript number in scientific notation, but instead it just appears as
0.000000
Example:
Expected output:
d=1.23456e-89 j=1.23456e-89
Actual output:
d=1.23456e-89 j=0.000000
Looking at the json code, it appears this is due to using
std::to_string()
for all numbers, which is equivalent tosprintf("%f", ...)
whereassprintf("%g", ...)
would be more appropriate. To fix this, the dump function would need to use something other than to_string to format floating point numbers. I'll try to put together a PR for this although C++ is far from my best language.The text was updated successfully, but these errors were encountered: