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

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

Nobody has claimed this yet.

Assessment

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

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.

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 ;)

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

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 Unity-Technologies/Unity.Mathematics

All issues in Unity-Technologies/Unity.Mathematics

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.