Unity-Technologies / Unity-Technologies/Unity.Mathematics

Why does `math.sign` return the input type?

Open
#208 2 comments 0 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

I noticed this difference when working on my own (mostly) compatible library.
This is different than the System.Math and hlsl definition where they always return an integer type.

Any particular reason why this change is done?

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 with the math.sign API and compare its return-type behavior with the System.Math and HLSL definitions mentioned in the issue. Determine whether returning the input type is intentional; done requires a maintainer decision about the API behavior and any corresponding project changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.