You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hex-float and ordinary numeric parsing now select the longest matching custom sign, preferring PositiveSign on equal-length matches. This makes custom prefix-overlapping signs round-trip consistently for hexadecimal floats, scientific (E) formats, and integers. Regression coverage includes double, float, Half, BFloat16, and Int32.
Use culture-aware exponent signs and the standard numeric parser sign precedence for hexadecimal floating-point values.
Co-authored-by: Copilot App <[email protected]>
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.
Document the provider-specific signs and decimal separator, and cover BFloat16 round-trips with custom signs.
Co-authored-by: Copilot App <[email protected]>
Checking PositiveSign first regresses round-tripping when it is a prefix of NegativeSign. For example, with PositiveSign = "-" and NegativeSign = "-+", formatting -3.0 now produces -+0x1.8p-1, but this branch consumes only - as a positive sign and then fails at + before the 0x; a negative exponent has the same problem. The reverse prefix direction is covered by the new tests, but this direction is not. Please disambiguate overlapping signs (for example, prefer the longer match while retaining positive preference for equal signs) and cover both prefix orientations.
Prefer the longer custom sign during hex-float parsing so formatted values round-trip when one sign prefixes the other.
Co-authored-by: Copilot App <[email protected]>
Select the longer matching custom sign consistently across hexadecimal floats, decimal numbers, and integers, while preferring positive signs on ties.
Co-authored-by: Copilot App <[email protected]>
Addressed in dde4478485d. Sign parsing now chooses the longer matching sign across hexadecimal floats, ordinary decimal parsing (including E exponents and trailing signs), and integers; equal-length matches continue to prefer PositiveSign. Added round-trip coverage for custom prefix-overlapping signs across double, float, Half, BFloat16, and Int32.
The checked CoreLib build passed. System.Runtime.Tests reported 78,557 total, 0 failed, and 87 skipped (78,470 passed).
Fixes Issue #135039
main PR #135132
# Description
Backport the fix for overlapping custom signs in numeric parsing and
hexadecimal floating-point formatting. Parsing now prefers the longer
matching sign, with `PositiveSign` preferred when the signs have equal
length.
# Customer Impact
With custom signs that share a prefix, parsing could select the wrong
sign and produce an incorrect value or fail to round-trip formatted
text.
# Regression
No. Hexadecimal floating-point formatting and parsing are new in .NET
11; this fixes a bug in the new functionality rather than a regression
from an earlier release.
# Testing
- `dotnet build /t:test
src\libraries\System.Runtime\tests\System.Runtime.Tests\System.Runtime.Tests.csproj
--configuration Debug` — passed; 77,838 total, 0 failed, 87 skipped.
- `dotnet build /t:test
src\libraries\System.Runtime.Numerics\tests\System.Runtime.Numerics.Tests\System.Runtime.Numerics.Tests.csproj
--configuration Debug` — passed; 8,427 total, 0 failed, 0 skipped.
# Risk
Low. The change is limited to choosing between matching numeric signs,
and regression coverage exercises custom signs across numeric types and
parsing paths.
# Package authoring no longer needed in .NET 9
IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet
package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older
versions.
> [!NOTE]
> This PR description was generated with GitHub Copilot.
Co-authored-by: Copilot App <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hex-float and ordinary numeric parsing now select the longest matching custom sign, preferring
PositiveSignon equal-length matches. This makes custom prefix-overlapping signs round-trip consistently for hexadecimal floats, scientific (E) formats, and integers. Regression coverage includesdouble,float,Half,BFloat16, andInt32.Validation
System.Runtime.Tests— 78,557 total, 0 failed, 87 skipped (78,470 passed).Resolves #135039
Note
This PR description was generated with GitHub Copilot.