-
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
Convert arguments to double in _GENERIC_MATH2_BASE
#3253
Conversation
This template implements the "sufficient additional overloads" for two-argument `<cmath>` functions (`atan2`, `hypot`, `pow`, `fmod`, `remainder`, `copysign`, `nextafter`, `fdim`, `fmax`, and `fmin`) by calling either an intrinsic or a C library function either of which expects `double` arguments. We previously converted the arguments to `_Common_float_type_t` which is `long double` when at least one argument is `long double`, resulting in narrowing conversion warnings at `/W4`. We now convert the arguments to `double` instead of `_Common_float_type_t`. Fixes microsoft#3246
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.
Thank you!
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.
Looks good - I checked <cmath>
for other occurrences of casting arguments to common
(case-insensitive) and found none.
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Thanks for investigating and fixing this warning! 🔍 |
This template implements the "sufficient additional overloads" for two-argument
<cmath>
functions (atan2
,hypot
,pow
,fmod
,remainder
,copysign
,nextafter
,fdim
,fmax
, andfmin
) by calling either an intrinsic or a C library function either of which expectsdouble
arguments. We previously converted the arguments to_Common_float_type_t
which islong double
when at least one argument islong double
, resulting in narrowing conversion warnings at/W4
. We now convert the arguments todouble
instead of_Common_float_type_t
.Fixes #3246