-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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 error on parsing DBL_MAX from string #1796
Labels
Comments
@sinannuman Do the tests pass on your platform? If I read the test code correctly we already have a test for DBL_MAX, see json/test/src/unit-regression.cpp Lines 705 to 725 in ed55414
|
I cannot reproduce the issue (macOS 10.14.6, Xcode 11.0): #include <iostream>
#include <sstream>
#include <cfloat>
#include "json.hpp"
using json = nlohmann::json;
int main() {
try
{
double d = DBL_MAX;
nlohmann::json js;
js["max"] = d;
std::stringstream ss;
ss << js["max"].dump();
std::cerr << ss.str() << std::endl;
nlohmann::json js2 = nlohmann::json::parse(ss.str());
std::cerr << js2.dump() << std::endl;
}
catch(const std::exception& e)
{
std::cerr << e.what() << '\n';
}
} Output:
|
nlohmann
added
the
state: needs more info
the author of the issue needs to provide more details
label
Oct 17, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Hello,
I am facing an exception with serialization on QNX platform. I am serializing a double with the DBL_MAX value (1.7976931348623157e+308). Then I try to parse that value from the string but the exception is thrown:
Code snippet is:
Exception:
[json.exception.out_of_range.406] number overflow parsing '1.7976931348623157e+308'
Related ticket:
#360
The text was updated successfully, but these errors were encountered: