Add XMVectorRound half away from zero alternative

Open
#39 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp

Research direction

Start by reading XMVectorRound and the SSE4 _mm_round_ps and ARMv8 NEON vrndnq_f32 paths mentioned in the issue. Determine the alternative API and verify that halfway values round away from zero consistently across supported SIMD implementations; done means the new behavior is available without changing XMVectorRound's existing semantics.

Written by the indexing model from the issue text.

Description

proposal

The current XMVectorRound uses round-to-nearest (even) a.k.a. banker's rounding. This matches the implementation of the _mm_round_ps (SSE4) and vrndnq_f32 (ARMv8 NEON) intrinsics rounding behavior, so it can be implemented in a single instruction.

Many users, however, expect it to match roundf which C99 defines as handling half-way values by rounding away from zero a.k.a. commercial rounding. It might therefore be useful to provide an alternative version of XMVectorRound that supports half away-from-zero rounding instead of round-to-nearest (even).

See Wikipedia

Dominant language
C++
Stars
1.8k
Forks
262
Avg merge
20h 57m
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/DirectXMath

All issues in microsoft/DirectXMath

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.