Skip to content

Make note on change from previous behavior #3766

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 31, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions xml/System/Double.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1815,6 +1815,7 @@
<Docs>
<summary>Converts the string representation of a number to its double-precision floating-point number equivalent.</summary>
<altmember cref="Overload:System.Double.TryParse" />
<remarks>In .NET Core 3.0 and above, parsing will attempt to parse the input as if to infinite precision, and then round to the nearest representation as per IEEE 754. This behavior is different and not backwards compatible with previous versions, where attempting to parse a given value that was too large to represent failed.</remarks>
</Docs>
</MemberGroup>
<Member MemberName="Parse">
Expand Down Expand Up @@ -1861,6 +1862,8 @@
<format type="text/markdown"><![CDATA[

## Remarks
In .NET Core 3.0 and above, parsing will attempt to parse the input as if to infinite precision, and then round to the nearest representation as per IEEE 754. This behavior is different and not backwards compatible with previous versions, where attempting to parse a given value that was too large to represent failed.

The `s` parameter can contain the current culture's <xref:System.Globalization.NumberFormatInfo.PositiveInfinitySymbol%2A?displayProperty=nameWithType>, <xref:System.Globalization.NumberFormatInfo.NegativeInfinitySymbol%2A?displayProperty=nameWithType>, <xref:System.Globalization.NumberFormatInfo.NaNSymbol%2A?displayProperty=nameWithType>, or a string of the form:

[*ws*][*sign*][*integral-digits*[*,*]]*integral-digits*[*.*[*fractional-digits*]][E[*sign*]*exponential-digits*][*ws*]
Expand Down Expand Up @@ -1959,6 +1962,8 @@ If a separator is encountered in the `s` parameter during a parse operation, and
<format type="text/markdown"><![CDATA[

## Remarks
In .NET Core 3.0 and above, parsing will attempt to parse the input as if to infinite precision, and then round to the nearest representation as per IEEE 754. This behavior is different and not backwards compatible with previous versions, where attempting to parse a given value that was too large to represent failed.

The `style` parameter defines the style elements (such as white space, thousands separators, and currency symbols) that are allowed in the `s` parameter for the parse operation to succeed. It must be a combination of bit flags from the <xref:System.Globalization.NumberStyles> enumeration. The following <xref:System.Globalization.NumberStyles> members are not supported:

- <xref:System.Globalization.NumberStyles.AllowHexSpecifier>
Expand Down Expand Up @@ -2089,6 +2094,8 @@ If a separator is encountered in the `s` parameter during a parse operation, and
<format type="text/markdown"><![CDATA[

## Remarks
In .NET Core 3.0 and above, parsing will attempt to parse the input as if to infinite precision, and then round to the nearest representation as per IEEE 754. This behavior is different and not backwards compatible with previous versions, where attempting to parse a given value that was too large to represent failed.

This overload of the <xref:System.Double.Parse%28System.String%2CSystem.IFormatProvider%29> method is typically used to convert text that can be formatted in a variety of ways to a <xref:System.Double> value. For example, it can be used to convert the text that is entered by a user into an HTML text box to a numeric value.

The `s` parameter is interpreted using a combination of the <xref:System.Globalization.NumberStyles.Float?displayProperty=nameWithType> and <xref:System.Globalization.NumberStyles.AllowThousands?displayProperty=nameWithType> flags. The `s` parameter can contain <xref:System.Globalization.NumberFormatInfo.PositiveInfinitySymbol%2A?displayProperty=nameWithType>, <xref:System.Globalization.NumberFormatInfo.NegativeInfinitySymbol%2A?displayProperty=nameWithType>, or <xref:System.Globalization.NumberFormatInfo.NaNSymbol%2A?displayProperty=nameWithType> for the culture specified by `provider`, or it can contain a string of the form:
Expand Down Expand Up @@ -2177,6 +2184,8 @@ If a separator is encountered in the `s` parameter during a parse operation, and
<remarks>
<format type="text/markdown"><![CDATA[

In .NET Core 3.0 and above, parsing will attempt to parse the input as if to infinite precision, and then round to the nearest representation as per IEEE 754. This behavior is different and not backwards compatible with previous versions, where attempting to parse a given value that was too large to represent failed.

If `s` is out of range of the <xref:System.Double> data type, the method returns <xref:System.Double.NegativeInfinity?displayProperty=nameWithType> if `s` is less than <xref:System.Double.MinValue?displayProperty=nameWithType> and <xref:System.Double.PositiveInfinity?displayProperty=nameWithType> if `s` is greater than <xref:System.Double.MaxValue?displayProperty=nameWithType>.

]]></format>
Expand Down Expand Up @@ -2239,6 +2248,8 @@ If `s` is out of range of the <xref:System.Double> data type, the method returns
<format type="text/markdown"><![CDATA[

## Remarks
In .NET Core 3.0 and above, parsing will attempt to parse the input as if to infinite precision, and then round to the nearest representation as per IEEE 754. This behavior is different and not backwards compatible with previous versions, where attempting to parse a given value that was too large to represent failed.

The `style` parameter defines the style elements (such as white space, thousands separators, and currency symbols) that are allowed in the `s` parameter for the parse operation to succeed. It must be a combination of bit flags from the <xref:System.Globalization.NumberStyles> enumeration. The following <xref:System.Globalization.NumberStyles> members are not supported:

- <xref:System.Globalization.NumberStyles.AllowHexSpecifier>
Expand Down Expand Up @@ -3690,6 +3701,7 @@ If a separator is encountered in the `s` parameter during a parse operation, and
</AssemblyInfo>
<Docs>
<summary>Converts the string representation of a number to its double-precision floating-point number equivalent. A return value indicates whether the conversion succeeded or failed.</summary>
<remarks>In .NET Core 3.0 and above, parsing will attempt to parse the input as if to infinite precision, and then round to the nearest representation as per IEEE 754. This behavior is different and not backwards compatible with previous versions, where attempting to parse a given value that was too large to represent failed.</remarks>
<altmember cref="Overload:System.Double.Parse" />
</Docs>
</MemberGroup>
Expand Down Expand Up @@ -3726,7 +3738,7 @@ If a separator is encountered in the `s` parameter during a parse operation, and
<summary>Converts the span representation of a number in a specified style and culture-specific format to its double-precision floating-point number equivalent. A return value indicates whether the conversion succeeded or failed.</summary>
<returns>
<see langword="true" /> if <paramref name="s" /> was converted successfully; otherwise, <see langword="false" />.</returns>
<remarks>To be added.</remarks>
<remarks>In .NET Core 3.0 and above, parsing will attempt to parse the input as if to infinite precision, and then round to the nearest representation as per IEEE 754. This behavior is different and not backwards compatible with previous versions, where attempting to parse a given value that was too large to represent failed.</remarks>
</Docs>
</Member>
<Member MemberName="TryParse">
Expand Down Expand Up @@ -3780,6 +3792,8 @@ If a separator is encountered in the `s` parameter during a parse operation, and
<format type="text/markdown"><![CDATA[

## Remarks
In .NET Core 3.0 and above, parsing will attempt to parse the input as if to infinite precision, and then round to the nearest representation as per IEEE 754. This behavior is different and not backwards compatible with previous versions, where attempting to parse a given value that was too large to represent failed.

This overload differs from the <xref:System.Double.Parse%28System.String%29?displayProperty=nameWithType> method by returning a Boolean value that indicates whether the parse operation succeeded instead of returning the parsed numeric value. It eliminates the need to use exception handling to test for a <xref:System.FormatException> in the event that `s` is invalid and cannot be successfully parsed.

The `s` parameter can contain the current culture's <xref:System.Globalization.NumberFormatInfo.PositiveInfinitySymbol%2A?displayProperty=nameWithType>, <xref:System.Globalization.NumberFormatInfo.NegativeInfinitySymbol%2A?displayProperty=nameWithType>, <xref:System.Globalization.NumberFormatInfo.NaNSymbol%2A?displayProperty=nameWithType> (the string comparison is case-sensitive), or a string of the form:
Expand Down Expand Up @@ -3868,7 +3882,7 @@ If a separator is encountered in the `s` parameter during a parse operation, and
<summary>Converts a character span containing the string representation of a number in a specified style and culture-specific format to its double-precision floating-point number equivalent. A return value indicates whether the conversion succeeded or failed.</summary>
<returns>
<see langword="true" /> if <paramref name="s" /> was converted successfully; otherwise, <see langword="false" />.</returns>
<remarks>To be added.</remarks>
<remarks>In .NET Core 3.0 and above, parsing will attempt to parse the input as if to infinite precision, and then round to the nearest representation as per IEEE 754. This behavior is different and not backwards compatible with previous versions, where attempting to parse a given value that was too large to represent failed.</remarks>
</Docs>
</Member>
<Member MemberName="TryParse">
Expand Down Expand Up @@ -3927,6 +3941,8 @@ If a separator is encountered in the `s` parameter during a parse operation, and
<format type="text/markdown"><![CDATA[

## Remarks
In .NET Core 3.0 and above, parsing will attempt to parse the input as if to infinite precision, and then round to the nearest representation as per IEEE 754. This behavior is different and not backwards compatible with previous versions, where attempting to parse a given value that was too large to represent failed.

The <xref:System.Double.TryParse%2A> method is like the <xref:System.Double.Parse%28System.String%2CSystem.Globalization.NumberStyles%2CSystem.IFormatProvider%29> method, except this method does not throw an exception if the conversion fails. If the conversion succeeds, the return value is `true` and the `result` parameter is set to the outcome of the conversion. If the conversion fails, the return value is `false` and the `result` parameter is set to zero. This eliminates the need to use exception handling to test for a <xref:System.FormatException> in the event that `s` is invalid and cannot be successfully parsed.

The `style` parameter defines the allowable format of the `s` parameter for the parse operation to succeed. It must be a combination of bit flags from the <xref:System.Globalization.NumberStyles> enumeration. The following <xref:System.Globalization.NumberStyles> members are not supported:
Expand Down
Loading