Skip to content

Commit

Permalink
refactor!: remove redundant Sign overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Nov 14, 2024
1 parent 44d3aec commit 72dbaa7
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 205 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- X10D: Removed `IEnumerable<T>.LowestCommonMultiple` for all integer types in favour of generic math.
- X10D: Removed `IEnumerable<T>.Product` for all integer types in favour of generic math.
- X10D: Removed `IEnumerable<T>.RangeTo` for all integer types in favour of generic math.
- X10D: Removed `T.Sign` for all numeric types in favour of generic math.

### Removed

Expand Down
34 changes: 0 additions & 34 deletions X10D/src/Math/DecimalExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,40 +90,6 @@ public static decimal Saturate(this decimal value)
return System.Math.Clamp(value, 0.0m, 1.0m);
}

/// <summary>
/// Returns an integer that indicates the sign of this decimal number.
/// </summary>
/// <param name="value">A signed number.</param>
/// <returns>
/// A number that indicates the sign of <paramref name="value" />, as shown in the following table.
///
/// <list type="table">
/// <listheader>
/// <term>Return value</term>
/// <description>Meaning</description>
/// </listheader>
///
/// <item>
/// <term>-1</term>
/// <description><paramref name="value" /> is less than zero.</description>
/// </item>
/// <item>
/// <term>0</term>
/// <description><paramref name="value" /> is equal to zero.</description>
/// </item>
/// <item>
/// <term>1</term>
/// <description><paramref name="value" /> is greater than zero.</description>
/// </item>
/// </list>
/// </returns>
[Pure]
[MethodImpl(CompilerResources.MaxOptimization)]
public static int Sign(this decimal value)
{
return System.Math.Sign(value);
}

/// <summary>
/// Returns the square root of this decimal number.
/// </summary>
Expand Down
35 changes: 0 additions & 35 deletions X10D/src/Math/DoubleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,41 +300,6 @@ public static double Sinh(this double value)
return System.Math.Sinh(value);
}

/// <summary>
/// Returns an integer that indicates the sign of this double-precision floating-point number.
/// </summary>
/// <param name="value">A signed number.</param>
/// <returns>
/// A number that indicates the sign of <paramref name="value" />, as shown in the following table.
///
/// <list type="table">
/// <listheader>
/// <term>Return value</term>
/// <description>Meaning</description>
/// </listheader>
///
/// <item>
/// <term>-1</term>
/// <description><paramref name="value" /> is less than zero.</description>
/// </item>
/// <item>
/// <term>0</term>
/// <description><paramref name="value" /> is equal to zero.</description>
/// </item>
/// <item>
/// <term>1</term>
/// <description><paramref name="value" /> is greater than zero.</description>
/// </item>
/// </list>
/// </returns>
/// <exception cref="ArithmeticException"><paramref name="value" /> is equal to <see cref="double.NaN" />.</exception>
[Pure]
[MethodImpl(CompilerResources.MaxOptimization)]
public static int Sign(this double value)
{
return System.Math.Sign(value);
}

/// <summary>
/// Returns the square root of this double-precision floating-point number.
/// </summary>
Expand Down
34 changes: 0 additions & 34 deletions X10D/src/Math/Int16Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,6 @@ public static int MultiplicativePersistence(this short value)
return ((long)value).MultiplicativePersistence();
}

/// <summary>
/// Returns an integer that indicates the sign of this 16-bit signed integer.
/// </summary>
/// <param name="value">A signed number.</param>
/// <returns>
/// A number that indicates the sign of <paramref name="value" />, as shown in the following table.
///
/// <list type="table">
/// <listheader>
/// <term>Return value</term>
/// <description>Meaning</description>
/// </listheader>
///
/// <item>
/// <term>-1</term>
/// <description><paramref name="value" /> is less than zero.</description>
/// </item>
/// <item>
/// <term>0</term>
/// <description><paramref name="value" /> is equal to zero.</description>
/// </item>
/// <item>
/// <term>1</term>
/// <description><paramref name="value" /> is greater than zero.</description>
/// </item>
/// </list>
/// </returns>
[Pure]
[MethodImpl(CompilerResources.MaxOptimization)]
public static int Sign(this short value)
{
return System.Math.Sign(value);
}

/// <summary>
/// Wraps the current 16-bit signed integer between a low and a high value.
/// </summary>
Expand Down
34 changes: 0 additions & 34 deletions X10D/src/Math/Int32Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,6 @@ public static int MultiplicativePersistence(this int value)
return ((long)value).MultiplicativePersistence();
}

/// <summary>
/// Returns an integer that indicates the sign of this 32-bit signed integer.
/// </summary>
/// <param name="value">A signed number.</param>
/// <returns>
/// A number that indicates the sign of <paramref name="value" />, as shown in the following table.
///
/// <list type="table">
/// <listheader>
/// <term>Return value</term>
/// <description>Meaning</description>
/// </listheader>
///
/// <item>
/// <term>-1</term>
/// <description><paramref name="value" /> is less than zero.</description>
/// </item>
/// <item>
/// <term>0</term>
/// <description><paramref name="value" /> is equal to zero.</description>
/// </item>
/// <item>
/// <term>1</term>
/// <description><paramref name="value" /> is greater than zero.</description>
/// </item>
/// </list>
/// </returns>
[Pure]
[MethodImpl(CompilerResources.MaxOptimization)]
public static int Sign(this int value)
{
return System.Math.Sign(value);
}

/// <summary>
/// Wraps the current 32-bit signed integer between a low and a high value.
/// </summary>
Expand Down
34 changes: 0 additions & 34 deletions X10D/src/Math/Int64Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,40 +88,6 @@ public static int MultiplicativePersistence(this long value)
return persistence;
}

/// <summary>
/// Returns an integer that indicates the sign of this 64-bit signed integer.
/// </summary>
/// <param name="value">A signed number.</param>
/// <returns>
/// A number that indicates the sign of <paramref name="value" />, as shown in the following table.
///
/// <list type="table">
/// <listheader>
/// <term>Return value</term>
/// <description>Meaning</description>
/// </listheader>
///
/// <item>
/// <term>-1</term>
/// <description><paramref name="value" /> is less than zero.</description>
/// </item>
/// <item>
/// <term>0</term>
/// <description><paramref name="value" /> is equal to zero.</description>
/// </item>
/// <item>
/// <term>1</term>
/// <description><paramref name="value" /> is greater than zero.</description>
/// </item>
/// </list>
/// </returns>
[Pure]
[MethodImpl(CompilerResources.MaxOptimization)]
public static int Sign(this long value)
{
return System.Math.Sign(value);
}

/// <summary>
/// Wraps the current 64-bit signed integer between a low and a high value.
/// </summary>
Expand Down
34 changes: 0 additions & 34 deletions X10D/src/Math/SingleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,40 +268,6 @@ public static float Saturate(this float value)
return System.Math.Clamp(value, 0.0f, 1.0f);
}

/// <summary>
/// Returns an integer that indicates the sign of this single-precision floating-point number.
/// </summary>
/// <param name="value">A signed number.</param>
/// <returns>
/// A number that indicates the sign of <paramref name="value" />, as shown in the following table.
///
/// <list type="table">
/// <listheader>
/// <term>Return value</term>
/// <description>Meaning</description>
/// </listheader>
///
/// <item>
/// <term>-1</term>
/// <description><paramref name="value" /> is less than zero.</description>
/// </item>
/// <item>
/// <term>0</term>
/// <description><paramref name="value" /> is equal to zero.</description>
/// </item>
/// <item>
/// <term>1</term>
/// <description><paramref name="value" /> is greater than zero.</description>
/// </item>
/// </list>
/// </returns>
[Pure]
[MethodImpl(CompilerResources.MaxOptimization)]
public static int Sign(this float value)
{
return MathF.Sign(value);
}

/// <summary>
/// Returns the square root of this single-precision floating-point number.
/// </summary>
Expand Down

0 comments on commit 72dbaa7

Please sign in to comment.