Notes on NaNs

This commit is contained in:
Tony Garnock-Jones 2018-09-28 11:48:58 +01:00
parent b0de674117
commit 348cb3e2a2
1 changed files with 11 additions and 4 deletions

View File

@ -321,10 +321,17 @@ Any `Value` may be represented using the
[compact binary syntax](#compact-binary-syntax) by directly prefixing [compact binary syntax](#compact-binary-syntax) by directly prefixing
the binary form of the `Value` with ASCII `SOH` (`%x01`), or by the binary form of the `Value` with ASCII `SOH` (`%x01`), or by
enclosing a hexadecimal representation of the binary form of the enclosing a hexadecimal representation of the binary form of the
`Value` in the tokens `#hexvalue{` and `}`. `Value` in the tokens `#hexvalue{` and `}`.[^rationale-switch-to-binary]
Compact = %x01 <binary data> / %s"#hexvalue{" *(ws / HEXDIG) ws "}" Compact = %x01 <binary data> / %s"#hexvalue{" *(ws / HEXDIG) ws "}"
[^rationale-switch-to-binary]: **Rationale.** The textual syntax
cannot express every `Value`: specifically, it cannot express the
several million floating-point NaNs, or the two floating-point
Infinities. Since the compact binary format for `Value`s expresses
each `Value` with precision, embedding binary `Value`s solves the
problem.
`Boolean`s are the simple literal strings `#true` and `#false`. `Boolean`s are the simple literal strings `#true` and `#false`.
Boolean = %s"#true" / %s"#false" Boolean = %s"#true" / %s"#false"
@ -1370,9 +1377,9 @@ encoding ordering? We'd have to only use streaming forms, and avoid
the small integer encoding, and not store record arities, and sort the small integer encoding, and not store record arities, and sort
sets and dictionaries, and mask floats and doubles (perhaps sets and dictionaries, and mask floats and doubles (perhaps
[like this](https://stackoverflow.com/questions/43299299/sorting-floating-point-values-using-their-byte-representation)), [like this](https://stackoverflow.com/questions/43299299/sorting-floating-point-values-using-their-byte-representation)),
and I don't know what to do about SignedIntegers. Perhaps make them and pick a specific `NaN`, and I don't know what to do about
more like float formats, with the byte count acting as a kind of SignedIntegers. Perhaps make them more like float formats, with the
exponent underneath the sign bit. byte count acting as a kind of exponent underneath the sign bit.
- Perhaps define separate additional canonicalization restrictions? - Perhaps define separate additional canonicalization restrictions?
Doesn't help the ordering, but does help the equivalence. Doesn't help the ordering, but does help the equivalence.