Skip to content

System.Numerics Vector2/3/4 static methods possibly have incorrect return type, and lack documentation #121689

@Quidney

Description

@Quidney

Description

Define:

[IsX refers to methods that start with Is indicating it checks whether 'it is' and then X is interchangeable based on the oparation]
IsX methods of Vectors have Vector return type, instead of the expected bool. (Let me clarify, I assume it returns a bool, because it has Is in the name, and as per convention, methods such as float.IsNaN(float) return a bool. I cannot confirm because both microsoft documentation and the metadata lack any useful information.)

Example:

If we take Vector2 for the demonstration, and inspect the Vector2.IsNaN(Vector2) method, we can see that it doesn't check if the value passed is NaN, it returns a new Vector2, where the NaN part is NaN, and the Non-NaN part is 0: (It looks like it is masking, although if that is the intended functionality is not clear due to aforementioned problem

Vector2 isNaNNaN = Vector2.IsNaN(Vector2.NaN);
Vector2 isNaNNonNaN = Vector2.IsNaN(Vector2.UnitX);
Vector2 isNaNOneNaN = Vector2.IsNaN(new Vector2(float.NaN, 3.14f));

Log(isNaNNaN);
Log(isNaNNonNaN);
Log(isNaNOneNaN);

Outputs:

<NaN. NaN>
<0. 0>
<NaN. 0>

The methods also lack public documentation.

Vector2 IsX methods for reference [from Metadata]:

 //
 // Parameters:
 //   vector:
 public static Vector2 IsEvenInteger(Vector2 vector);
 //
 // Parameters:
 //   vector:
 public static Vector2 IsFinite(Vector2 vector);
 //
 // Parameters:
 //   vector:
 public static Vector2 IsInfinity(Vector2 vector);
 //
 // Parameters:
 //   vector:
 public static Vector2 IsInteger(Vector2 vector);
 //
 // Parameters:
 //   vector:
 public static Vector2 IsNaN(Vector2 vector);
 //
 // Parameters:
 //   vector:
 public static Vector2 IsNegative(Vector2 vector);
 //
 // Parameters:
 //   vector:
 public static Vector2 IsNegativeInfinity(Vector2 vector);
 //
 // Parameters:
 //   vector:
 public static Vector2 IsNormal(Vector2 vector);
 //
 // Parameters:
 //   vector:
 public static Vector2 IsOddInteger(Vector2 vector);
 //
 // Parameters:
 //   vector:
 public static Vector2 IsPositive(Vector2 vector);
 //
 // Parameters:
 //   vector:
 public static Vector2 IsPositiveInfinity(Vector2 vector);
 //
 // Parameters:
 //   vector:
 public static Vector2 IsSubnormal(Vector2 vector);
 //
 // Parameters:
 //   vector:
 public static Vector2 IsZero(Vector2 vector);

Reproduction Steps

  1. Start a .NET 10 Project,
  2. Make any operations with static Vector2/Vector3/Vector3 IsX methods

Expected behavior

To be given a boolean

Actual behavior

It masks the given Vector2, which complicates checking 'IsNaN' for example as IEEE NaN != NaN.

Regression?

No response

Known Workarounds

No response

Configuration

.NET 10
C#14
Visual Studio 2026 [November 2025 Feature Update]

Other information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions