fix(ffi): GF16 round-to-nearest + overflow→Inf + full GF4-24 encode/decode#553
Merged
fix(ffi): GF16 round-to-nearest + overflow→Inf + full GF4-24 encode/decode#553
Conversation
…/decode BUG-001 (#546): encode_gf16 mantissa truncation → round-to-nearest-even - Add half-ULP detection + tie-break to even - Carry into exponent on mantissa overflow BUG-002 (#547): encode_gf16 overflow saturates to max-finite → +Inf - exp >= max_exp now returns canonical ±Inf (exp=max, mant=0) BUG-003 (#548): gf32_from_f64 — fix comment (GF32 = IEEE fp32 for FPGA) API-COMPLETENESS (#549): add from_f32/to_f32 for GF4/8/12/20/24 - All 7 GoldenFloat formats now have full encode/decode - Round-to-nearest-even on all formats - Proper overflow→Inf and underflow→zero handling build.rs: tolerate CC_FORCE_DISABLE for testing without C deps 16 tests passing Closes #546, Closes #547, Closes #548, Closes #549
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
gHashTag
added a commit
that referenced
this pull request
Apr 29, 2026
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
gHashTag
added a commit
that referenced
this pull request
Apr 29, 2026
6e28a8d to
0e88fb6
Compare
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
0e88fb6 to
7b4476c
Compare
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Closed
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 4 bugs and adds missing encode/decode for 5 formats.
Bug Fixes
BUG-001 (#546):
encode_gf16mantissa truncation → round-to-nearest-evenlower_14 > 0x2000)BUG-002 (#547):
encode_gf16overflow saturates to max-finite → canonical ±Infexp >= max_expnow returnsexp=63, mant=0(IEEE 754 Inf)gf16_is_inf()correctly returnstrueBUG-003 (#548):
gf32_from_f64paperware fixA1 (#545): Duplicate of BUG-001 — fixed by same mantissa rounding change
API Completeness (#549)
Added
from_f32/to_f32for GF4, GF8, GF12, GF20, GF24:[s:1][e:1][m:2][s:1][e:3][m:4][s:1][e:4][m:7][s:1][e:7][m:12][s:1][e:9][m:14]All 7 GoldenFloat formats now have full encode/decode/arithmetic.
Tests (16 passing)
Closes #546, Closes #547, Closes #548, Closes #549, Closes #545