Ayush-CS-89112521 opened a new pull request, #55470:
URL: https://github.com/apache/arrow/pull/55470

   ### Rationale for this change
   
   `RoundUtil::Pow10` used 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 via `round_val - 
std::floor(round_val)` caused catastrophic cancellation on negative numbers 
near halfway points, triggering false ties.
   
   ### What changes are included in this PR?
   
   - Replaced float-suffixed constants in `Pow10` with type `T` constants 
(`T(1e0)`..`T(1e15)`).
   - Replaced `std::floor` with `std::abs(round_val - std::trunc(round_val))` 
in `RoundToMultiple`, `Round`, and `RoundBinary`.
   - Added regression tests for scale precision, negative halfway ties, and 
signed zeros.
   
   ### Are these changes tested?
   
   Yes, added unit tests in `scalar_round_arithmetic_test.cc`.
   
   ### Are there any user-facing changes?
   
   Just a bugfix.
   
   * GitHub Issue: #55393


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to