Skip to content

feature: inline support for f16 - #19

Merged
NicolasDP merged 1 commit into
primetype:masterfrom
dcSpark:inline-f16
Jul 6, 2026
Merged

feature: inline support for f16#19
NicolasDP merged 1 commit into
primetype:masterfrom
dcSpark:inline-f16

Conversation

@SebastienGllmt

@SebastienGllmt SebastienGllmt commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

This PR implement #18 but without requiring stable rust-lang/rust#116909 (since it's been years and it's not stable yet, so I want to just fix the bug in this library since otherwise every f16-encoded float read by any cbor_event consumer is silently corrupted)

Quick Q&A on the implementation

Q: Why didn't you just use a crate
A: Because this project is meant to have zero dependencies (per the README)

Q: How do you know the implementation is correct
A: There is a crate called half that gives f16 support before it's part of stable. I added this as a dev dependency, and checked that results match for all possible f16 (for bits in 0..=u16::MAX {)

Related issue: #10

@NicolasDP NicolasDP left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@NicolasDP
NicolasDP merged commit 83a0fee into primetype:master Jul 6, 2026
15 of 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.

2 participants