diff --git a/Engine.Core/Math.cs b/Engine.Core/Math.cs index 5d203db..cb7f4b8 100644 --- a/Engine.Core/Math.cs +++ b/Engine.Core/Math.cs @@ -129,7 +129,13 @@ public static class Math /// The first number. /// The second number. /// The number whose absolute value is larger. - public static float MaxMagnitude(float x, float y) => MathF.MaxMagnitude(x, y); + public static T AbsMax(T x, T y) where T : INumber + { + T xAbs = Abs(x); + T yAbs = Abs(y); + + return (xAbs > yAbs) ? x : y; + } /// /// Returns the smaller of two numbers. @@ -146,7 +152,13 @@ public static class Math /// The first number. /// The second number. /// The number whose absolute value is smaller. - public static float MinMagnitude(float x, float y) => MathF.MinMagnitude(x, y); + public static T AbsMin(T x, T y) where T : INumber + { + T xAbs = Abs(x); + T yAbs = Abs(y); + + return (xAbs < yAbs) ? x : y; + } /// /// Returns a specified number raised to the specified power.