-
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
Fix num_get
's float-parsing problem
#3982
Conversation
I haven't checked the standard carefully, but please check whether this is just another problem:
Relevant logic: |
I'm speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
I think this is the correct behavior according to [facet.num.get.virtuals]/3.3.6:
|
For the tests introduced in this pr, clang accepts all and gcc is (wrongly?) rejecting those with |
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.
Just style nitpicks; ignore me.
// Also test GH-3980 <iostream>: Wrong reading of float values | ||
template <class Flt> | ||
void test_gh_3980() { | ||
auto test_case = [](const char* str, double expected) { |
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: there are a log of str
s floating around here, it might be nice to call this parameter "input" or something.
@@ -532,6 +532,23 @@ void test_gh_3378() { | |||
} | |||
} | |||
|
|||
// Also test GH-3980 <iostream>: Wrong reading of float values | |||
template <class Flt> |
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: vwls pls.
Flt
isn't that much shorter than Float
. If you want a descriptive name, be descriptive. If you want a short name, T
would work fine here and honestly std::floating_point T
(or static_assert(std::is_floating_point_v<T>)
in the function body) would be even better.
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.
Float
specifically is dangerous due to the potential confusion with float
. Floating
or any other name avoids that hazard.
Thanks for fixing this major regression! 🛠️ ✨ 🎉 |
Fixes #3980 / DevCom-10450662 / VSO-1876474 / AB#1876474
Also fixes DevCom-10445082 / VSO-1873604 / AB#1873604.
Likely fixes VSO-1874745 / AB#1874745.
Likely fixes VSO-1876601 / AB#1876601.