Repository navigation
GH-55393: [C++][Compute] Fix precision and ties in floating round - #55470
Open
Ayush-CS-89112521 wants to merge 1 commit into
Open
Ayush-CS-89112521 wants to merge 1 commit into
Ayush-CS-89112521 wants to merge 1 commit into
Conversation
|
|
Collaborator
|
@Ayush-CS-89112521 Could you follow the Arrow PR template and add AI disclosure checkbox in the PR desc. Thanks! |
Author
|
Thanks for pointing that out, @Reranko05! Updated the PR description with the AI disclosure section. |
|
|
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.
Rationale for this change
RoundUtil::Pow10used float-suffixed constants (1e0F..1e15F), causing double scale factors to truncate to float32 precision and produce off-grid rounded values. In addition, computing fractional parts viaround_val - std::floor(round_val)caused catastrophic cancellation on negative numbers near halfway points, triggering false ties.What changes are included in this PR?
Pow10with typeTconstants (T(1e0)..T(1e15)).std::floorwithstd::abs(round_val - std::trunc(round_val))inRoundToMultiple,Round, andRoundBinary.Are these changes tested?
Yes, added unit tests in
scalar_round_arithmetic_test.cc.Are there any user-facing changes?
Just a bugfix.
Was AI used for this PR?
PR code and description written by:
Reviewed before submission by: