Skip to content

Fix bugs in fixed-point arithmetic#5948

Merged
blp merged 3 commits intomainfrom
issue5946
Mar 28, 2026
Merged

Fix bugs in fixed-point arithmetic#5948
blp merged 3 commits intomainfrom
issue5946

Conversation

@blp
Copy link
Copy Markdown
Member

@blp blp commented Mar 28, 2026

This adds unit tests.

I submitted this separately from #5947 because I can't push to @mihaibudiu's repository.

mihaibudiu and others added 3 commits March 27, 2026 23:43
Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
These tests guard against regression for the fix in commit 0e3bc33
("[SQLLIB] Fix bug in DECIMAL division").

Signed-off-by: Ben Pfaff <blp@feldera.com>
This fixes two classes of bugs in fixed-point addition.

First, in the existing special case for handling addition of fixed-points
with different scales where shifting the addend with the smaller scale
left yielded a value that did not fit in i128, the special case was wrong
when the result's scale differed from that of the added with the larger
scale.  This fixes the problem and adds a test.

Second, the code did not handle the special case where the sum of the
addends does not fit in i128 in the larger of the scales of the addends
but it would fit with the scale of the result.  This also fixes that bug
and adds a test.

Signed-off-by: Ben Pfaff <blp@feldera.com>
@blp blp self-assigned this Mar 28, 2026
@blp blp added bug Something isn't working SQL compiler Related to the SQL compiler rust Pull requests that update Rust code user-reported Reported by a user or customer critical priority Critical issues that need immediate attention labels Mar 28, 2026
@blp blp requested review from gz, mihaibudiu and ryzhyk March 28, 2026 17:04
@blp blp added this pull request to the merge queue Mar 28, 2026
Merged via the queue into main with commit 23b0b1d Mar 28, 2026
1 check passed
@blp blp deleted the issue5946 branch March 28, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working critical priority Critical issues that need immediate attention rust Pull requests that update Rust code SQL compiler Related to the SQL compiler user-reported Reported by a user or customer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants