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
Negative numbers in JSON turn to zero in from_json() #334
Comments
Okay, I've got a fix for this, I'll submit a PR soon... |
- fix issue ChaiScript#334, where negative numbers loaded from JSON were being parsed as 0. - add unit tests to cover these cases.
I'm going to submit another PR, you can choose which of the two solutions you prefer! (-; Probably you'll go for the smaller change, isolated just to JSON code, I'd guess -- unless you think the regular parse_num should handle negatives (obviously, except for this JSON case, it doesn't need to right now)... |
- fix issue ChaiScript#334, where negative numbers loaded from JSON were being parsed as 0. - add unit tests to cover these cases.
You are correct that chaiscript's number parser has to be different because of that unary |
I merged #336, closing this |
When parsing a JSON file with negative numbers in it (floating point or integer), the negative numbers are converted to zeros.
Minimal Example to Reproduce Behavior
The above example results in the following output:
The text was updated successfully, but these errors were encountered: