Optimize BigInteger.ToString for large decimal string#112178
Merged
tannergooding merged 9 commits intodotnet:mainfrom Sep 16, 2025
Merged
Optimize BigInteger.ToString for large decimal string#112178tannergooding merged 9 commits intodotnet:mainfrom
BigInteger.ToString for large decimal string#112178tannergooding merged 9 commits intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-numerics |
huoyaoyuan
reviewed
Feb 5, 2025
src/libraries/System.Runtime.Numerics/src/System/Number.BigInteger.cs
Outdated
Show resolved
Hide resolved
EgorBo
reviewed
Feb 5, 2025
src/libraries/System.Runtime.Numerics/src/System/Number.BigInteger.cs
Outdated
Show resolved
Hide resolved
efcf4e1 to
bf75784
Compare
bf75784 to
86f4a53
Compare
This was referenced Feb 11, 2025
Open
Closed
2abfe84 to
f825641
Compare
Contributor
There was a problem hiding this comment.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (3)
src/libraries/System.Runtime.Numerics/src/System/Number.BigInteger.cs:797
- [nitpick] The variable name 'digitRatio' is ambiguous. It should be renamed to something more descriptive like 'logBase2ToBase1E9Ratio'.
const double digitRatio = 1.070328873472;
src/libraries/System.Runtime.Numerics/src/System/Number.BigInteger.cs:933
- [nitpick] The method name 'BigIntegerToBase1E9' could be more descriptive. Consider renaming it to 'ConvertBigIntegerToBase1E9'.
private static void BigIntegerToBase1E9(ReadOnlySpan<uint> bits, Span<uint> base1E9Buffer, out int leadingWritten)
src/libraries/System.Runtime.Numerics/tests/BigInteger/BigIntegerToStringTests.cs:13
- The variable 'result' is initialized to 'null' but is not explicitly set in the 'catch' block, which could lead to a 'NullReferenceException'. Ensure 'result' is properly handled in the 'catch' block.
string result = null;
tannergooding
approved these changes
Sep 16, 2025
This was referenced Sep 25, 2025
Closed
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR is a counterpart to #55121. divide-and-conquer algorithm
Number.FormatBigInteger()can run inThe computational complexity of division have been improved by #96895.
Benchmark
Code