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

Short example does not include infinity and NaN #204

Closed
skoehler opened this issue Jul 25, 2019 · 3 comments
Closed

Short example does not include infinity and NaN #204

skoehler opened this issue Jul 25, 2019 · 3 comments
Assignees

Comments

@skoehler
Copy link

Please enhance the example in README.md so that it also shows +/-infinity and NaN values. I'd like to know how these are represented and whether it's compatible with python.

@jordanbtucker
Copy link
Member

Infinity and NaN are used just like any other numeric value. Just like in ES5, they are case sensitive. You can put a + or - directly in front of them.

They are both compatible with Python. In Python 2, Infinity and NaN are represented by float('inf') and float('nan'). In Python 3, they are represented by math.inf and math.nan.

@skoehler
Copy link
Author

skoehler commented Jul 26, 2019

Sure, I already looked it up in the sources. Just make life easier for lazy people like me. Also, you want to show off all your features in your small example, no?

@jordanbtucker
Copy link
Member

See json5/json5-spec#2

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

No branches or pull requests

2 participants