<charconv>: Fix from_chars for floating-point types#3670
Merged
StephanTLavavej merged 5 commits intomicrosoft:mainfrom Apr 28, 2023
Merged
<charconv>: Fix from_chars for floating-point types#3670StephanTLavavej merged 5 commits intomicrosoft:mainfrom
<charconv>: Fix from_chars for floating-point types#3670StephanTLavavej merged 5 commits intomicrosoft:mainfrom
Conversation
- handle non-zero tail digits in the integral part - change the calculation of the exponent part
StephanTLavavej
approved these changes
Apr 27, 2023
Member
|
Thank you! 😻 😻 😻 These changes are exceptionally clean and I pushed only the tiniest of nitpicks. |
Member
|
I'm speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
strega-nil-ms
approved these changes
Apr 27, 2023
Contributor
strega-nil-ms
left a comment
There was a problem hiding this comment.
Minor change that would be nice for readability, but isn't necessary.
| // Adjust _Exponent and _Exponent_adjustment when they have different signedness to avoid overflow. | ||
| if (_Exponent > 0 && _Exponent_adjustment < 0) { | ||
| if (_Is_hexadecimal) { | ||
| const ptrdiff_t _Further_adjustment = (_STD max)(-((_Exponent - 1) / 4 + 1), _Exponent_adjustment); |
Contributor
There was a problem hiding this comment.
Not worth resetting testing, but it'd be nice in these "_Further_adjustment is negative" cases, to instead negate the other term and use (_STD min); this would imo, make it much clearer what's happening, and you won't be adding and subtracting a negative number.
Member
|
Thanks again so much for investigating and fixing these bugs in my favorite header! 😻 🎉 🚀 |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Fixes #1792. Fixes #3161.