-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Register format decimal128 #3209
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
Conversation
registries/_format/decimal128.md
Outdated
owner: | ||
issue: | ||
description: A decimal floating-point number with 34 significant decimal digits | ||
base_type: string number |
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.
should we only have string here? or at least warn about a loss of accuracy in case of JSON serialization?
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.
No, it's a well-known problem for some serializers and parsers, and already called out in https://www.rfc-editor.org/rfc/rfc8259#section-6
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.
@ralfhandl is this string, number
as in you can use either, or do you mean string number
as in "a string containing a number"? If the latter, I would just say string
. If the former, I suggest the comma for clarity 🧐
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 good callout for clarity. If we change this, we should also change it in the infamous decimal format
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.
@ralfhandl Are you referring to this line:
implementations will approximate JSON numbers within the expected precision
I don't think that RFC 8259 wording is particularly clear about potential loss of precision when storing decimals as numbers.
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.
@darrelmiller @ralfhandl we would probably want to reference https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-4.2.1 which includes:
Whitespace and formatting concerns, including different lexical
representations of numbers that are equal within the data model, are
thus outside the scope of JSON Schema. JSON Schema vocabularies
(Section 8.1) that wish to work with such differences in lexical
representations SHOULD define keywords to precisely interpret
formatted strings within the data model rather than relying on having
the original JSON representation Unicode characters available.
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.
@handrews It's "type": ["string", "number"]
, we use content negotiation to allow clients select whether the server will send JSON numbers or wrap the numbers as JSON strings.
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.
Can you update the type for decimal as well please for consistency?
|
Strange: I can only re-request a review from a single reviewer, trying to re-request for a second reviewer removes the re-request for the first reviewer 🤔 |
Format for 128-bit decimal floating-point numbers as proposed in proposal in #3190 (comment).
Fixes #603 with proposal for representing
NaN
,-INF
, andINF
.