Notes on NaNs
This commit is contained in:
parent
b0de674117
commit
348cb3e2a2
|
@ -321,10 +321,17 @@ Any `Value` may be represented using the
|
|||
[compact binary syntax](#compact-binary-syntax) by directly prefixing
|
||||
the binary form of the `Value` with ASCII `SOH` (`%x01`), or by
|
||||
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 "}"
|
||||
|
||||
[^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"#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
|
||||
sets and dictionaries, and mask floats and doubles (perhaps
|
||||
[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
|
||||
more like float formats, with the byte count acting as a kind of
|
||||
exponent underneath the sign bit.
|
||||
and pick a specific `NaN`, and I don't know what to do about
|
||||
SignedIntegers. Perhaps make them more like float formats, with the
|
||||
byte count acting as a kind of exponent underneath the sign bit.
|
||||
|
||||
- Perhaps define separate additional canonicalization restrictions?
|
||||
Doesn't help the ordering, but does help the equivalence.
|
||||
|
|
Loading…
Reference in New Issue