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

NaN appendix #13

Closed
wants to merge 4 commits into from
Closed

Conversation

laurencelundblade
Copy link

It takes week or so to implement basic CBOR integer and float encoding. I’m not as smart as some here, but I get by… It took me many many months to figure out NaN payloads. I’ve put what I learned in a NaN Appendix to the CDE draft to save others these months.

It’s a fairly long addition, but it seems worthwhile to me to cover the details explicitly. It’s an appendix, not the main document, which signals to the reader that they don’t have to read it.

It makes a recommendation that protocol designers not use NaN payloads because there are better ways to accomplish the same.

@cabo
Copy link
Collaborator

cabo commented Jul 7, 2024

Thanks! I think the most valuable part here is the table at the end.
The explanation probably should first explain that CBOR supports IEEE 754, what a NaN is, that a NaN always has a payload, and which payload values aren't available because they would mean something different than a NaN. A quick discussion of the quiet/signaling bit, the fact that IEEE 754 doesn't define it, but there is a de facto standard needs to follow, and then we can introduce the "basic" NaN with sign 0, quiet bit 1, all other payload bits zero. The reason why some applications are not using foo = float / null or foo = float / payload where payload can be anything but float. Then a quick discussion of implementation considerations for preferred serialization, including the weirdness that two NaNs do not compare equal in most platforms, even if they are equal wrt to their payloads.

I'm not sure this shouldn't be a separate draft, to which CDE could refer for information.
It's night here already, but I could turn your input and the above outline into a draft about NaN and CBOR.

@cabo
Copy link
Collaborator

cabo commented Jul 7, 2024

@cabo
Copy link
Collaborator

cabo commented Jul 8, 2024

Now became part of https://datatracker.ietf.org/doc/draft-bormann-cbor-numbers/
Still needs to be referenced properly; ran out of time.

@cabo cabo closed this in dc32a97 Nov 3, 2024
cabo added a commit that referenced this pull request Nov 3, 2024
Outcome of 2024-10-16 interim, also close #13 (now covered in cbor-numbers and properly referenced).
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

Successfully merging this pull request may close these issues.

2 participants