-
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
Finish P0811R3 midpoint and lerp #1048
Conversation
* Removes workaround for missing `bit_cast()` and mark `lerp()` constexpr. * Changes how `lerp()` handles infinity inputs according to microsoft#65 (comment) and microsoft#65 (comment).
* Adds constexpr tests. * Updates test cases for infinity inputs according to the new behavior.
clang-format has seemingly changed its mind on some unrelated code :\
return _Val2; | ||
} | ||
} else { | ||
if (_STD _Is_nan(_Val1) || _STD _Is_nan(_Val2)) { |
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.
Before I purposely put this test below the high limit tests before the NaN tests because we expect NaNs to be uncommon; you're fixing -fassociative-math
and friends but it seems like that would still be fixed if you put this in the old location?
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.
Performing the high limit test with <=
raises undeserved FE_INVALID
when the input value is NaN.
Alternative approaches:
- Test with quiet comparison
islessequal
- Test with
bit_cast
tricks - Just ignore the issue of
FE_INVALID
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.
I see, to raise floating point exceptions. Can you add a comment to places where you do seemingly needless operations to raise the right exceptions and add tests for that? Otherwise that's likely to break. (I understand that requires /fp:except
which might be annoying to set up in our tests :( )
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.
Hmmm actually it looks like we already have an /fp:except
flavor tested:
PM_CL="/EHsc /MDd /D_ITERATOR_DEBUG_LEVEL=2 /std:c++latest /fp:except /Zc:preprocessor"
so you should just be able to do that.
This comment has been minimized.
This comment has been minimized.
libcxx test for The test asserts |
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.
LGTM
It's technically nonconformant to explicitly specialize a non-inline variable template (and _INLINE_VAR is inline for C++17 and above). MSVC accepts this, but it causes problems for Clang. tests/std/tests/Dev09_172666_tr1_tuple_odr detected this in the MSVC-internal repo, but not on GitHub due to an oversight that we just discovered and are fixing (it has one.cpp and two.cpp files instead of test.cpp, so we need to add a custom run script). We can fix this by just using a struct template with static constexpr data members. A couple of other changes here: Use is_floating_point_v instead of ::value, and _Float_abs_bits doesn't need to static_cast at the end (the inputs to bitwise-AND are the same type and are unsigned int or unsigned long long, so there's no integral promotions involved). cmath: Add Oxford comma to comment. numeric: Now that we require is_integral_v, _Arithmetic should be renamed to _Integral.
Pushed a change to fix a test failure that we just encountered: Fix a subtle conformance issue. It's technically nonconformant to explicitly specialize a non-inline variable template (and We can fix this by just using a struct template with A couple of other changes here: Use cmath: Add Oxford comma to comment. numeric: Now that we require |
Thanks for increasing |
Removes workaround for missing
bit_cast()
and marklerp()
constexpr.Changes how
lerp()
handles infinity inputs according to P0811R3 midpoint(), lerp() #65 (comment) and P0811R3 midpoint(), lerp() #65 (comment).Adds constexpr tests for
lerp()
, and updates test cases for infinity inputs according to the new behavior.Resolves #65.