Skip to content

Extend the small inverse pow5 offset table#237

Closed
keith-packard wants to merge 1 commit intoulfjack:masterfrom
keith-packard:extend-small-inv-table
Closed

Extend the small inverse pow5 offset table#237
keith-packard wants to merge 1 commit intoulfjack:masterfrom
keith-packard:extend-small-inv-table

Conversation

@keith-packard
Copy link
Copy Markdown

@keith-packard keith-packard commented Apr 12, 2025

The maximum value for the invPow5 function is 342, which means the offset table needs 342 * 2 = 684 bits or > 21 32-bit values. Add the missing values by computing them based off the full table values.

@keith-packard keith-packard force-pushed the extend-small-inv-table branch from 12a63e0 to e20b956 Compare April 12, 2025 22:37
The maximum value for the invPow5 function is 342, which means the
offset table needs 342 * 2 = 684 bits or > 21 32-bit values. Add the
missing values by computing them based off the full table values.

Signed-off-by: Keith Packard <keithp@keithp.com>
@ulfjack
Copy link
Copy Markdown
Owner

ulfjack commented Jan 16, 2026

It would be good to add tests for this case; are there numbers that don't work correctly due to the missing entries?

@keith-packard
Copy link
Copy Markdown
Author

There are cases which access beyond the bounds of the array; that's what I discovered when I enabled array bounds checking and ran my test suite. I'm not sure I can easily re-create that situation though, it's been a long time.

@ulfjack
Copy link
Copy Markdown
Owner

ulfjack commented Jan 23, 2026

Ok, got it. The asserts are correctly failing the tests, and - for parsing - we need to support at least up to 324 (is the 342 a typo?). I filed #255 for this. Note that the table is generated from Java code. I'll update the generator and then update the file.

@ulfjack ulfjack closed this Jan 23, 2026
@keith-packard
Copy link
Copy Markdown
Author

Ok, got it. The asserts are correctly failing the tests, and - for parsing - we need to support at least up to 324 (is the 342 a typo?). I filed #255 for this. Note that the table is generated from Java code. I'll update the generator and then update the file.

Awesome. Thanks for digging into this; I'll update my C library with the new values.

@keith-packard
Copy link
Copy Markdown
Author

and, of course, if you ever decide to generate tables and code for 80- bit (intel/m68k) and 128-bit (ieee binary 128) forms, that'd be super exciting. I still have janky code for those two types and just haven't found the time to figure out how to fix that.

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