Unity-Technologies / Unity-Technologies/Unity.Mathematics

Remove `IsNaN` checks from `min()` and `max()`

Open
#243 0 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.4k
Forks
159
PR merge metrics
No merged PRs in 30d

Description

  • horrendous code gen

  • hides NaNs which would otherwise be easily caught while debugging

  • propagates throughout the entire Unity.Mathematics.math library

  • ... while breaking the rule of NaN propagation

  • checking for NaN does neither comply to IEEE754, nor any native SIMD instruction sets, nor any C/C++ library - not even UnityEngine.Mathf

  • if we want to copy HLSL 1:1, at least flush denormals to zero and make it even more expensive ;)

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.

Research direction

Start by locating the min() and max() implementations and their IsNaN checks in the Unity.Mathematics.math library. Remove the checks so NaN propagation follows the issue's stated IEEE754 and native SIMD expectations, then verify the affected math behavior and generated code.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
performance
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.