-
Notifications
You must be signed in to change notification settings - Fork 67
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
Super-fy the Super JSON format doc #5386
Conversation
docs/formats/jsup.md
Outdated
@@ -149,7 +149,7 @@ conforming to any floating point representation that cannot be | |||
interpreted as an integer, e.g., `1.` or `1.0` instead of | |||
`1` or `1e3` instead of `1000`. Unlike JSON, a floating point number can | |||
also be one of: | |||
`Inf`, `+Inf`, `-Inf`, or `Nan`. | |||
`Inf`, `+Inf`, `-Inf`, or `NaN`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out case is important here.
$ super -version
Version: v1.18.0-69-g5ab9615c
$ echo '1 NaN 2' | super -z -c 'yield typeof(this)' -
<int64>
<float64>
<int64>
The following causes a syntax error, which makes sense to me:
$ echo '1 Nan 2' | super -z -c 'yield typeof(this)' -
stdio:stdin: Super JSON syntax error
Not sure how to explain this though. A bug?
$ echo 'Nan' | super -z -c 'yield typeof(this)' -
[no output]
Also related, it looks like Inf
requires the explicit +
or -
at the moment.
$ echo '1 +Inf -Inf 2' | super -z -c 'yield typeof(this)' -
<int64>
<float64>
<float64>
<int64>
$ echo '1 Inf 2' | super -z -c 'yield typeof(this)' -
stdio:stdin: Super JSON syntax error
$ echo 'Inf' | super -z -c 'yield typeof(this)' -
[no output]
Whereas NaN
seemed like an easy docs fix since that's the way it's shown in Excel/etc., it's not clear to me if we'd rather add support for plain Inf
to the grammar or drop it from the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bug in the jsup parser for any input that is a single identifier then EOF. It shouldn't be too hard to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding Inf, in IEEE floating point, there's a +Inf
and a -Inf
. I think we should have one way to represent +Inf
in Super JSON and we could change +Inf
to Inf
. I think we went with +Inf
because the golang fmt
library prints it that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the same spirit as #5368.