Skip to content

Fix VSX rounding#1320

Merged
serge-sans-paille merged 1 commit intoxtensor-stack:masterfrom
Andreas-Krebbel:fix-vsx-rounding
Apr 24, 2026
Merged

Fix VSX rounding#1320
serge-sans-paille merged 1 commit intoxtensor-stack:masterfrom
Andreas-Krebbel:fix-vsx-rounding

Conversation

@Andreas-Krebbel
Copy link
Copy Markdown
Contributor

This fixes a problem with rounding in the VSX support revealed by #1318

vec_round on Power unfortunately behaves inconsistently across different data types:

For float vectors vec_round is implemented by vrfin. vrfin uses "round to nearest with ties to even" which does NOT match the std::round rounding mode (ties away form zero)

For double vectors however, vec_round is implemented by xvrdpi which uses the std::round rounding mode.

So far this went unnoticed because test_rounding only tested the first four input values for float vectors. For these four values the rounding mode difference doesn't change anything. test_rounding fails with #1318 and with this PR it is clean again on IBM Power. Tested on a Power10 system.

@serge-sans-paille serge-sans-paille merged commit 9cf14f9 into xtensor-stack:master Apr 24, 2026
75 checks passed
@Andreas-Krebbel Andreas-Krebbel deleted the fix-vsx-rounding branch April 24, 2026 16:15
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