Skip to content

float_sz support for round-trip float (de)serialization - #34

Merged
NicolasDP merged 5 commits into
primetype:masterfrom
dcSpark:float-round-trip
Aug 3, 2026
Merged

float_sz support for round-trip float (de)serialization#34
NicolasDP merged 5 commits into
primetype:masterfrom
dcSpark:float-round-trip

Conversation

@SebastienGllmt

@SebastienGllmt SebastienGllmt commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Previously, byte-level round-tripping was only guaranteed for f64-encoded floats. An f16/f32-encoded float decodes to f64

This PR updates it to support round-trip (de)serialization for f16 and f32 as well

To achieve this, I have Fable 5 write the code, and then brute-for test every possible f16 and f32 representation possible on my computer to check they all round-trip

  • for f16: I kept the float16_exhaustive_byte_roundtrip test since it's fast
  • for f32: I set the test to #[ignore] after running it locally (since it's a long test)

The reason I need this is that some projects I care about for cddl-codegen use any and therefore I need an AnyCbor (but doing so without float support gets kind of hacky and it was easier to just add float support upstream)

This closes #16

@NicolasDP
NicolasDP merged commit 4c3218c into primetype:master Aug 3, 2026
16 checks passed
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.

Please clarify that floats are not supported and do not attempt to parse them

2 participants