-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
<charconv>
: Fix from_chars
for floating-point types
#3670
<charconv>
: Fix from_chars
for floating-point types
#3670
Conversation
- handle non-zero tail digits in the integral part - change the calculation of the exponent part
Thank you! 😻 😻 😻 These changes are exceptionally clean and I pushed only the tiniest of nitpicks. |
I'm speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Thanks again so much for investigating and fixing these bugs in my favorite header! 😻 🎉 🚀 |
This PR
Fixes #1792. Fixes #3161.