1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-14 04:15:41 +00:00

(#15) Improve xmldoc for IsOdd/IsEven

This commit is contained in:
Oliver Booth 2021-03-10 14:57:49 +00:00
parent 08e89d3ab0
commit f6b885b46b
5 changed files with 56 additions and 39 deletions

View File

@ -31,29 +31,29 @@ namespace X10D.DoubleExtensions
} }
/// <summary> /// <summary>
/// Determines if the <see cref="double" /> is even. /// Returns a value indicating whether the current value is evenly divisible by 2.
/// </summary> /// </summary>
/// <param name="number">The number.</param> /// <param name="value">The value whose parity to check.</param>
/// <returns> /// <returns>
/// Returns <see langword="true" /> if <paramref name="number" /> is even, <see langword="false" /> /// <see langword="true" /> if <paramref name="value" /> is evenly divisible by 2, or <see langword="false" />
/// otherwise. /// otherwise.
/// </returns> /// </returns>
public static bool IsEven(this double number) public static bool IsEven(this double value)
{ {
return Math.Abs(number % 2.0) < double.Epsilon; return Math.Abs(value % 2.0) < double.Epsilon;
} }
/// <summary> /// <summary>
/// Determines if the <see cref="double" /> is odd. /// Returns a value indicating whether the current value is not evenly divisible by 2.
/// </summary> /// </summary>
/// <param name="number">The number.</param> /// <param name="value">The value whose parity to check.</param>
/// <returns> /// <returns>
/// Returns <see langword="true" /> if <paramref name="number" /> is odd, <see langword="false" /> /// <see langword="true" /> if <paramref name="value" /> is not evenly divisible by 2, or <see langword="false" />
/// otherwise. /// otherwise.
/// </returns> /// </returns>
public static bool IsOdd(this double number) public static bool IsOdd(this double value)
{ {
return !number.IsEven(); return !value.IsEven();
} }
/// <summary> /// <summary>

View File

@ -47,20 +47,26 @@ namespace X10D.Int16Extensions
} }
/// <summary> /// <summary>
/// Returns a value indicating whether the current 16-bit signed integer is even. /// Returns a value indicating whether the current value is not evenly divisible by 2.
/// </summary> /// </summary>
/// <param name="value">The number to check.</param> /// <param name="value">The value whose parity to check.</param>
/// <returns><see langword="true" /> if <paramref name="value" /> is even, or <see langword="false" /> otherwise.</returns> /// <returns>
/// <see langword="true" /> if <paramref name="value" /> is not evenly divisible by 2, or <see langword="false" />
/// otherwise.
/// </returns>
public static bool IsEven(this short value) public static bool IsEven(this short value)
{ {
return value % 2 == 0; return value % 2 == 0;
} }
/// <summary> /// <summary>
/// Returns a value indicating whether the current 16-bit signed integer is odd. /// Returns a value indicating whether the current value is not evenly divisible by 2.
/// </summary> /// </summary>
/// <param name="value">The number to check.</param> /// <param name="value">The value whose parity to check.</param>
/// <returns><see langword="true" /> if <paramref name="value" /> is odd, or <see langword="false" /> otherwise.</returns> /// <returns>
/// <see langword="true" /> if <paramref name="value" /> is not evenly divisible by 2, or <see langword="false" />
/// otherwise.
/// </returns>
public static bool IsOdd(this short value) public static bool IsOdd(this short value)
{ {
return !value.IsEven(); return !value.IsEven();

View File

@ -47,20 +47,26 @@ namespace X10D.Int32Extensions
} }
/// <summary> /// <summary>
/// Returns a value indicating whether the current 32-bit signed integer is even. /// Returns a value indicating whether the current value is evenly divisible by 2.
/// </summary> /// </summary>
/// <param name="value">The number to check.</param> /// <param name="value">The value whose parity to check.</param>
/// <returns><see langword="true" /> if <paramref name="value" /> is even, or <see langword="false" /> otherwise.</returns> /// <returns>
/// <see langword="true" /> if <paramref name="value" /> is evenly divisible by 2, or <see langword="false" />
/// otherwise.
/// </returns>
public static bool IsEven(this int value) public static bool IsEven(this int value)
{ {
return value % 2 == 0; return value % 2 == 0;
} }
/// <summary> /// <summary>
/// Returns a value indicating whether the current 32-bit signed integer is odd. /// Returns a value indicating whether the current value is not evenly divisible by 2.
/// </summary> /// </summary>
/// <param name="value">The number to check.</param> /// <param name="value">The value whose parity to check.</param>
/// <returns><see langword="true" /> if <paramref name="value" /> is odd, or <see langword="false" /> otherwise.</returns> /// <returns>
/// <see langword="true" /> if <paramref name="value" /> is not evenly divisible by 2, or <see langword="false" />
/// otherwise.
/// </returns>
public static bool IsOdd(this int value) public static bool IsOdd(this int value)
{ {
return !value.IsEven(); return !value.IsEven();

View File

@ -44,22 +44,27 @@ namespace X10D.Int64Extensions
{ {
return BitConverter.GetBytes(value); return BitConverter.GetBytes(value);
} }
/// <summary> /// <summary>
/// Returns a value indicating whether the current 64-bit signed integer is even. /// Returns a value indicating whether the current value is evenly divisible by 2.
/// </summary> /// </summary>
/// <param name="value">The number to check.</param> /// <param name="value">The value whose parity to check.</param>
/// <returns><see langword="true" /> if <paramref name="value" /> is even, or <see langword="false" /> otherwise.</returns> /// <returns>
/// <see langword="true" /> if <paramref name="value" /> is evenly divisible by 2, or <see langword="false" />
/// otherwise.
/// </returns>
public static bool IsEven(this long value) public static bool IsEven(this long value)
{ {
return value % 2 == 0; return value % 2 == 0;
} }
/// <summary> /// <summary>
/// Returns a value indicating whether the current 64-bit signed integer is odd. /// Returns a value indicating whether the current value is not evenly divisible by 2.
/// </summary> /// </summary>
/// <param name="value">The number to check.</param> /// <param name="value">The value whose parity to check.</param>
/// <returns><see langword="true" /> if <paramref name="value" /> is odd, or <see langword="false" /> otherwise.</returns> /// <returns>
/// <see langword="true" /> if <paramref name="value" /> is not evenly divisible by 2, or <see langword="false" />
/// otherwise.
/// </returns>
public static bool IsOdd(this long value) public static bool IsOdd(this long value)
{ {
return !value.IsEven(); return !value.IsEven();

View File

@ -32,29 +32,29 @@ namespace X10D.SingleExtensions
} }
/// <summary> /// <summary>
/// Determines if the <see cref="float" /> is even. /// Returns a value indicating whether the current value is evenly divisible by 2.
/// </summary> /// </summary>
/// <param name="number">The number.</param> /// <param name="value">The value whose parity to check.</param>
/// <returns> /// <returns>
/// Returns <see langword="true" /> if <paramref name="number" /> is even, <see langword="false" /> /// <see langword="true" /> if <paramref name="value" /> is evenly divisible by 2, or <see langword="false" />
/// otherwise. /// otherwise.
/// </returns> /// </returns>
public static bool IsEven(this float number) public static bool IsEven(this float value)
{ {
return ((double)number).IsEven(); return value % 2 == 0;
} }
/// <summary> /// <summary>
/// Determines if the <see cref="float" /> is odd. /// Returns a value indicating whether the current value is not evenly divisible by 2.
/// </summary> /// </summary>
/// <param name="number">The number.</param> /// <param name="value">The value whose parity to check.</param>
/// <returns> /// <returns>
/// Returns <see langword="true" /> if <paramref name="number" /> is odd, <see langword="false" /> /// <see langword="true" /> if <paramref name="value" /> is not evenly divisible by 2, or <see langword="false" />
/// otherwise. /// otherwise.
/// </returns> /// </returns>
public static bool IsOdd(this float number) public static bool IsOdd(this float value)
{ {
return !number.IsEven(); return !value.IsEven();
} }
/// <summary> /// <summary>