Skip to content
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

Positive exponent sign in roundtrip #22

Closed
emilk opened this issue Dec 13, 2015 · 2 comments
Closed

Positive exponent sign in roundtrip #22

emilk opened this issue Dec 13, 2015 · 2 comments

Comments

@emilk
Copy link
Contributor

emilk commented Dec 13, 2015

roundtrip27.json is [1.7976931348623157e308], but I feel [1.7976931348623157e+308] should be equally correct output as JSON allows (but does not mandate) a positive exponent sign.

@miloyip
Copy link
Owner

miloyip commented Dec 14, 2015

Yes. Roundtirp tests are not required by JSON standard.
For example, 1 can be stringified as +1, 1.0, 1.00, 1e0, 1e-0, 1e+0, etc.
But often JSON generators will produce shortest output which can be sufficiently restored to the original data.

@emilk
Copy link
Contributor Author

emilk commented Dec 15, 2015

Brevity makes sense, but some other roundtrip tests are not briefest possible, like [0.0] (roundtrip20.json) which shortest form is [0]. So I guess the goal of these test are then "shortest form that restores data and type (int vs float)". That's fine, I just wanted to wrap my head around the rationale =)

Feel free to close this!

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

No branches or pull requests

2 participants