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

Option for parsers to intepret precision of numbers #152

Closed
awwright opened this issue Nov 21, 2016 · 5 comments
Closed

Option for parsers to intepret precision of numbers #152

awwright opened this issue Nov 21, 2016 · 5 comments

Comments

@awwright
Copy link
Member

In some cases, parsers may want to expose the precision of a number in addition to its value -- especially for scientific cases where 1.2e4 is different than 12000.000 - same value, very different precisions.

In this case, we should allow parsers to define "integer" as "any number with a precision of exactly 1" instead of its current definition "any number with a zero fractional part".

This is a bit esoteric, but it is a totally valid use of JSON.

@Relequestual
Copy link
Member

I'm for further discussing and fleshing out this thought! Seems like a sensible solution to the issue presented.

@HotelDon
Copy link

I'm a bit confused as to what "having a precision of exactly one" actually means. Mathematical precision, at least as far as I can tell, refers to all the digits in a number, so having a precision of one would include only the numbers 0 through 9.

@handrews
Copy link
Contributor

I feel like this is best addressed by a format, along the lines of json-schema-org/json-schema-vocabularies#45 but perhaps something accounting for exponential notation? These cases do not necessarily need to be solved by the same format value.

@handrews
Copy link
Contributor

@awwright I'm pretty sure that since we define JSON Schema over the data model and not over the JSON text, this doesn't work. Or at least not in any interoperable way, as the mapping of floating-point text to internal representations is not standardized.

We've rejected numerous requests around distinctions that are only present in the JSON text for numeric formats, so I'm going to close this. @awwright if I missed something please re-open/re-file.

@awwright
Copy link
Member Author

This is fine. I haven't come across any use-cases in the... four... years this has been open.

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

No branches or pull requests

4 participants