cbor-wg / edn-literal

Application-oriented literals for CBOR extended diagnostic notation
Other
0 stars 7 forks source link

Hex floating point #7

Closed cabo closed 1 year ago

cabo commented 1 year ago

EDN should support hex floating point notation, as in 0x0.1p-2

https://en.cppreference.com/w/cpp/language/floating_literal

chrysn commented 1 year ago

Small detail I couldn't get from the C++ reference: Is it legal for a hex literal to offer more precision than fits in a float? For Decimal that makes sense because it's not an exact conversion, but would 0x1.000000000000000000000001p0 (insert zeros until the final one is not part of the mantissa of a f64 any more) be accepted by EDN processors?

[edit: Either way, sounds like a good thing to have]

cabo commented 1 year ago

Great question. If you type 100000000000000000000 into cbor.me, you get:

C2                       # tag(2)
   49                    # bytes(9)
      056BC75E2D63100000 # ...

Maybe your observation should become part of our Tag 5 project...

cabo commented 1 year ago

Fixed in 6f61745