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

Have we made a mistake by forbidding exponential notation? #10

Open
seagreen opened this issue Mar 17, 2017 · 4 comments
Open

Have we made a mistake by forbidding exponential notation? #10

seagreen opened this issue Mar 17, 2017 · 4 comments

Comments

@seagreen
Copy link
Owner

If anyone using JSON requires exponential notation please let me know here.

@impact27
Copy link

For scientific software you might work with large numbers. Forbidding exponential notation might mean adding 300 insignificant digits to your json file. Worst case your file could be composed of 99% useless data.

@mwerezak
Copy link

If you had to choose between not allowing exponential notation or allowing only exponential notation, for machine-to-machine communication it makes more sense to me to choose the latter, honestly. It's a far more natural representation of floating point data.

@ChristianKurz
Copy link

ChristianKurz commented Dec 10, 2017

I second the call to allow only exponential notation. This is very much needed in engineering.

For readability, i would use engineering notation (exponent are signed multiples of 3) , but that's debatable.

In other notes i wouldn't recommend disallowing trailing zeros. These are used to convey information about precision (significant figures). While that can be done in other ways, it's often unknown, if trailing zeros represent significance or not and information could be accidentially thrown away.

@seagreen
Copy link
Owner Author

@impact27: Good point, I'll think about that some more. The current simplicity of the EBNF and railroad diagram would be sad to give up, but we would definitely gain something from it.

@mwerezak: JSON Numbers aren't floats (though they can represent them), and I don't want to privilege floats over any of the other things they can represent.

@Shorty66: You're looking for a different project from Son. I share your feelings and think it would have been great if the various JSON parsers in the wild respected that 1.0e2 and 1.00e2 are two different JSON Numbers. Unfortunately many of them just munge them into the same value. The Son strategy is: "sometimes you need to give up, since we can't trust that parsers will treat these things differently it's best not to keep the extraneous features around". But Son isn't meant for all use cases, and it would be cool to see projects that actually use those features to good effect.

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

4 participants