Explain what "normal" is in Double.IsNormal#12281
Explain what "normal" is in Double.IsNormal#12281sfiruch wants to merge 1 commit intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @dotnet/area-system-runtime |
There was a problem hiding this comment.
Pull request overview
Updates the API documentation for Double.IsNormal to clarify what “normal” means directly in the summary text.
Changes:
- Replaces the
IsNormal<summary>text with an explicit definition (not NaN, not infinite, not subnormal, and not zero).
| <see langword="true" /> if the value is normal; <see langword="false" /> otherwise.</returns> | ||
| <remarks>This effectively checks the value is not NaN, not infinite, not subnormal, and not zero.</remarks> |
There was a problem hiding this comment.
The updated
explains what “normal” means, but the text still relies on the term “normal” without the definition. Consider updating to use the same explicit criteria (or add the definition there) so readers don’t have to infer it from the summary/remarks.
Also, the criteria list is now repeated in both
and , which creates duplication that can drift over time. Consider removing the redundant list from or using for additional context instead of repeating the same definition.
Suggested change
<see langword="true" /> if the value is normal; <see langword="false" /> otherwise.</returns>
<remarks>This effectively checks the value is not NaN, not infinite, not subnormal, and not zero.</remarks>
<see langword="true" /> if the value is not NaN, not infinite, not subnormal, and not zero; <see langword="false" /> otherwise.</returns>
<remarks>Use this method to determine whether a double-precision floating-point number is a normal value before performing calculations that assume finite, nonzero magnitudes.</remarks>
| <see langword="true" /> if the value is normal; <see langword="false" /> otherwise.</returns> | |
| <remarks>This effectively checks the value is not NaN, not infinite, not subnormal, and not zero.</remarks> | |
| <see langword="true" /> if the value is not NaN, not infinite, not subnormal, and not zero; <see langword="false" /> otherwise.</returns> | |
| <remarks>Use this method to determine whether a double-precision floating-point number is a normal value before performing calculations that assume finite, nonzero magnitudes.</remarks> |
| <Docs> | ||
| <param name="d">A double-precision floating-point number.</param> | ||
| <summary>Determines whether the specified value is normal.</summary> | ||
| <summary>Determines whether the specified value is not NaN, not infinite, not subnormal, and not zero.</summary> |
There was a problem hiding this comment.
If you're wanting to not be repetitive, then repeating subnormal doesn't really help either.. The technical definition is:
| <summary>Determines whether the specified value is not NaN, not infinite, not subnormal, and not zero.</summary> | |
| <summary>Determines whether the specified value is a finite non-zero value with magnitude greater than or equal to <c>2<sup>-1022</sup></c>.</summary> |
There was a problem hiding this comment.
I would expect Single, Half, NFloat, and INumberBase<TSelf> to all be updated in the same PR.
I would also expect other definitions like IsInfinite, IsSubnormal, IsFinite, etc to be updated if required.
There was a problem hiding this comment.
And as per the Copilot guidance below, the summary and remarks are effectively just mirroring eachother now, so the remarks need to either be removed or updated.
Summary
The documentation for Double.IsNormal is wholly unhelpful. It says it checks if a number is "Normal". Only in the remarks, "normal" is explained. This changes it to make it clear what it actually checks.