Use float.Equals in equality checks to handle NaN cases
Some checks failed
Build Android / Game (Android, Release ARM64) (push) Has been cancelled
Build iOS / Game (iOS, Release ARM64) (push) Has been cancelled
Build Linux / Editor (Linux, Development x64) (push) Has been cancelled
Build Linux / Game (Linux, Release x64) (push) Has been cancelled
Build macOS / Editor (Mac, Development ARM64) (push) Has been cancelled
Build macOS / Game (Mac, Release ARM64) (push) Has been cancelled
Build Windows / Editor (Windows, Development x64) (push) Has been cancelled
Build Windows / Game (Windows, Release x64) (push) Has been cancelled
Cooker / Cook (Mac) (push) Has been cancelled
Tests / Tests (Linux) (push) Has been cancelled
Tests / Tests (Windows) (push) Has been cancelled

This commit is contained in:
2026-01-04 03:09:17 +02:00
parent 1b8e25cb86
commit 56a85f6ac0
24 changed files with 47 additions and 47 deletions

View File

@@ -678,7 +678,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in BoundingBox other)
{
return Minimum == other.Minimum && Maximum == other.Maximum;
return Minimum.Equals(other.Minimum) && Maximum.Equals(other.Maximum);
}
/// <summary>

View File

@@ -131,7 +131,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in BoundingFrustum other)
{
return pMatrix == other.pMatrix;
return pMatrix.Equals(other.pMatrix);
}
/// <summary>

View File

@@ -492,7 +492,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in BoundingSphere other)
{
return Center == other.Center && Radius == other.Radius;
return Center.Equals(other.Center) && Radius.Equals(other.Radius);
}
/// <summary>

View File

@@ -210,7 +210,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in Color other)
{
return R == other.R && G == other.G && B == other.B && A == other.A;
return R.Equals(other.R) && G.Equals(other.G) && B.Equals(other.B) && A.Equals(other.A);
}
/// <inheritdoc />

View File

@@ -1582,7 +1582,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in Double2 other)
{
return X == other.X && Y == other.Y;
return X.Equals(other.X) && Y.Equals(other.Y);
}
/// <summary>

View File

@@ -1880,7 +1880,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in Double3 other)
{
return X == other.X && Y == other.Y && Z == other.Z;
return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z);
}
/// <summary>

View File

@@ -1379,7 +1379,7 @@ namespace FlaxEngine
/// <returns><c>true</c> if the specified <see cref="Double4" /> is equal to this instance; otherwise, <c>false</c>.</returns>
public bool Equals(in Double4 other)
{
return X == other.X && Y == other.Y && Z == other.Z && W == other.W;
return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z) && W.Equals(other.W);
}
/// <summary>

View File

@@ -1658,7 +1658,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in Float2 other)
{
return X == other.X && Y == other.Y;
return X.Equals(other.X) && Y.Equals(other.Y);
}
/// <summary>

View File

@@ -1912,7 +1912,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in Float3 other)
{
return X == other.X && Y == other.Y && Z == other.Z;
return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z);
}
/// <summary>

View File

@@ -1419,7 +1419,7 @@ namespace FlaxEngine
/// <returns><c>true</c> if the specified <see cref="Float4" /> is equal to this instance; otherwise, <c>false</c>.</returns>
public bool Equals(in Float4 other)
{
return X == other.X && Y == other.Y && Z == other.Z && W == other.W;
return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z) && W.Equals(other.W);
}
/// <summary>

View File

@@ -198,7 +198,7 @@ namespace FlaxEngine
/// <param name="value"></param>
public static double InverseLerp(double a, double b, double value)
{
if (a == b)
if (a.Equals(b))
return 0d;
return Saturate((value - a) / (b - a));
}

View File

@@ -228,7 +228,7 @@ namespace FlaxEngine
/// <param name="value"></param>
public static float InverseLerp(float a, float b, float value)
{
if (a == b)
if (a.Equals(b))
return 0f;
return Saturate((value - a) / (b - a));
}

View File

@@ -3236,22 +3236,22 @@ namespace FlaxEngine
/// <returns><c>true</c> if the specified <see cref="Matrix" /> is equal to this instance; otherwise, <c>false</c>.</returns>
public bool Equals(in Matrix other)
{
return other.M11 == M11 &&
other.M12 == M12 &&
other.M13 == M13 &&
other.M14 == M14 &&
other.M21 == M21 &&
other.M22 == M22 &&
other.M23 == M23 &&
other.M24 == M24 &&
other.M31 == M31 &&
other.M32 == M32 &&
other.M33 == M33 &&
other.M34 == M34 &&
other.M41 == M41 &&
other.M42 == M42 &&
other.M43 == M43 &&
other.M44 == M44;
return other.M11.Equals(M11) &&
other.M12.Equals(M12) &&
other.M13.Equals(M13) &&
other.M14.Equals(M14) &&
other.M21.Equals(M21) &&
other.M22.Equals(M22) &&
other.M23.Equals(M23) &&
other.M24.Equals(M24) &&
other.M31.Equals(M31) &&
other.M32.Equals(M32) &&
other.M33.Equals(M33) &&
other.M34.Equals(M34) &&
other.M41.Equals(M41) &&
other.M42.Equals(M42) &&
other.M43.Equals(M43) &&
other.M44.Equals(M44);
}
/// <summary>

View File

@@ -483,7 +483,7 @@ namespace FlaxEngine
/// <returns><c>true</c> if the specified <see cref="Matrix2x2"/> is equal to this instance; otherwise, <c>false</c>.</returns>
public bool Equals(in Matrix2x2 other)
{
return M11 == other.M11 && M12 == other.M12 && M21 == other.M21 && M22 == other.M22;
return M11.Equals(other.M11) && M12.Equals(other.M12) && M21.Equals(other.M21) && M22.Equals(other.M22);
}
/// <summary>

View File

@@ -2125,15 +2125,15 @@ namespace FlaxEngine
/// <returns><c>true</c> if the specified <see cref="Matrix3x3"/> is equal to this instance; otherwise, <c>false</c>.</returns>
public bool Equals(in Matrix3x3 other)
{
return M11 == other.M11 &&
M12 == other.M12 &&
M13 == other.M13 &&
M21 == other.M21 &&
M22 == other.M22 &&
M23 == other.M23 &&
M31 == other.M31 &&
M32 == other.M32 &&
M33 == other.M33;
return M11.Equals(other.M11) &&
M12.Equals(other.M12) &&
M13.Equals(other.M13) &&
M21.Equals(other.M21) &&
M22.Equals(other.M22) &&
M23.Equals(other.M23) &&
M31.Equals(other.M31) &&
M32.Equals(other.M32) &&
M33.Equals(other.M33);
}
/// <summary>

View File

@@ -397,7 +397,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in OrientedBoundingBox value)
{
return Extents == value.Extents && Transformation == value.Transformation;
return Extents.Equals(value.Extents) && Transformation.Equals(value.Transformation);
}
/// <summary>

View File

@@ -587,7 +587,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in Plane other)
{
return Normal == other.Normal && D == other.D;
return Normal.Equals(other.Normal) && D.Equals(other.D);
}
/// <summary>

View File

@@ -1714,7 +1714,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in Quaternion other)
{
return X == other.X && Y == other.Y && Z == other.Z && W == other.W;
return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z) && W.Equals(other.W);
}
/// <summary>

View File

@@ -433,7 +433,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in Ray other)
{
return Position == other.Position && Direction == other.Direction;
return Position.Equals(other.Position) && Direction.Equals(other.Direction);
}
/// <summary>

View File

@@ -499,7 +499,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in Rectangle other)
{
return Location == other.Location && Size == other.Size;
return Location.Equals(other.Location) && Size.Equals(other.Size);
}
/// <inheritdoc />

View File

@@ -705,7 +705,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in Transform other)
{
return Translation == other.Translation && Orientation == other.Orientation && Scale == other.Scale;
return Translation.Equals(other.Translation) && Orientation.Equals(other.Orientation) && Scale.Equals(other.Scale);
}
/// <summary>

View File

@@ -1782,7 +1782,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in Vector2 other)
{
return X == other.X && Y == other.Y;
return X.Equals(other.X) && Y.Equals(other.Y);
}
/// <summary>

View File

@@ -2141,7 +2141,7 @@ namespace FlaxEngine
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(in Vector3 other)
{
return X == other.X && Y == other.Y && Z == other.Z;
return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z);
}
/// <summary>

View File

@@ -1493,7 +1493,7 @@ namespace FlaxEngine
/// <returns><c>true</c> if the specified <see cref="Vector4" /> is equal to this instance; otherwise, <c>false</c>.</returns>
public bool Equals(in Vector4 other)
{
return X == other.X && Y == other.Y && Z == other.Z && W == other.W;
return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z) && W.Equals(other.W);
}
/// <summary>