X Tutup
Skip to content

Fix negative zero#188

Merged
stleary merged 7 commits intostleary:masterfrom
johnjaylward:FixNegativeZero
Jan 30, 2016
Merged

Fix negative zero#188
stleary merged 7 commits intostleary:masterfrom
johnjaylward:FixNegativeZero

Conversation

@johnjaylward
Copy link
Copy Markdown
Contributor

Fixes #187 -0 now returns as a double.

@johnjaylward
Copy link
Copy Markdown
Contributor Author

test cases submitted

@stleary
Copy link
Copy Markdown
Owner

stleary commented Jan 28, 2016

What problem does this code solve?
Parser should follow the JSON spec and produce numeric values from '-0' and '-0.0'
This is a user-found defect. See issue #187.

Changes to the API?
XML.stringToValue(String) is deprecated in favor of JSONObject.stringToValue(String)

Changes to how the code behaves?
Negative zero strings are now parsed to Double instead of String.

Does it break the unit tests?
No, but new unit tests will be committed after this code is committed. See stleary/JSON-Java-unit-test#39.

Will this require a new release?
No, I am proposing for this change to be rolled into the next release. If you disagree, please
post in this thread

Should the documentation be updated?
No.

@johnjaylward
Copy link
Copy Markdown
Contributor Author

-0 and -0.0 both parse to Double since Long/Integer would lose the sign.

@stleary
Copy link
Copy Markdown
Owner

stleary commented Jan 28, 2016

Got it, thanks.

@coderextreme
Copy link
Copy Markdown

This fixed over 6300 instances in our JSON documents. Thanks everyone for the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup