Skip to content

Commit 0c85bb9

Browse files
authored
Clarify INumber.IsPositive and INumber.IsNegative documentation (#80026)
* Clarify INumber.IsPositive and INumber.IsNegative documentation * Add clarification for negative zero
1 parent 339a204 commit 0c85bb9

File tree

1 file changed

+12
-6
lines changed
  • src/libraries/System.Private.CoreLib/src/System/Numerics

1 file changed

+12
-6
lines changed

src/libraries/System.Private.CoreLib/src/System/Numerics/INumberBase.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,13 @@ static virtual TSelf CreateTruncating<TOther>(TOther value)
166166
/// <returns><c>true</c> if <paramref name="value" /> is NaN; otherwise, <c>false</c>.</returns>
167167
static abstract bool IsNaN(TSelf value);
168168

169-
/// <summary>Determines if a value is negative.</summary>
169+
/// <summary>Determines if a value represents a negative real number.</summary>
170170
/// <param name="value">The value to be checked.</param>
171-
/// <returns><c>true</c> if <paramref name="value" /> is negative; otherwise, <c>false</c>.</returns>
172-
/// <remarks>This function returning <c>false</c> does not imply that <see cref="IsPositive(TSelf)" /> will return <c>true</c>. A complex number, <c>a + bi</c> for non-zero <c>b</c>, is not positive nor negative</remarks>
171+
/// <returns><c>true</c> if <paramref name="value" /> represents negative zero or a negative real number; otherwise, <c>false</c>.</returns>
172+
/// <remarks>
173+
/// <para>If this type has signed zero, then <c>-0</c> is also considered negative.</para>
174+
/// <para>This function returning <c>false</c> does not imply that <see cref="IsPositive(TSelf)" /> will return <c>true</c>. A complex number, <c>a + bi</c> for non-zero <c>b</c>, is not positive nor negative</para>
175+
/// </remarks>
173176
static abstract bool IsNegative(TSelf value);
174177

175178
/// <summary>Determines if a value is negative infinity.</summary>
@@ -191,10 +194,13 @@ static virtual TSelf CreateTruncating<TOther>(TOther value)
191194
/// </remarks>
192195
static abstract bool IsOddInteger(TSelf value);
193196

194-
/// <summary>Determines if a value is positive.</summary>
197+
/// <summary>Determines if a value represents zero or a positive real number.</summary>
195198
/// <param name="value">The value to be checked.</param>
196-
/// <returns><c>true</c> if <paramref name="value" /> is positive; otherwise, <c>false</c>.</returns>
197-
/// <remarks>This function returning <c>false</c> does not imply that <see cref="IsNegative(TSelf)" /> will return <c>true</c>. A complex number, <c>a + bi</c> for non-zero <c>b</c>, is not positive nor negative</remarks>
199+
/// <returns><c>true</c> if <paramref name="value" /> represents (positive) zero or a positive real number; otherwise, <c>false</c>.</returns>
200+
/// <remarks>
201+
/// <para>If this type has signed zero, then <c>-0</c> is not considered positive, but <c>+0</c> is.</para>
202+
/// <para>This function returning <c>false</c> does not imply that <see cref="IsNegative(TSelf)" /> will return <c>true</c>. A complex number, <c>a + bi</c> for non-zero <c>b</c>, is not positive nor negative</para>
203+
/// </remarks>
198204
static abstract bool IsPositive(TSelf value);
199205

200206
/// <summary>Determines if a value is positive infinity.</summary>

0 commit comments

Comments
 (0)