-
Notifications
You must be signed in to change notification settings - Fork 226
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
Constexpr next #789
Constexpr next #789
Conversation
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
@NAThompson Can you review this? It is almost a 1:1 copy of the existing nextafter implementation with standard library cmath functions being replaced by our ccmath functions. The results match exactly which makes me feel good about the other functions. |
@mborland : Looks good; make sure to squash merge with a nice commit message. |
[ci skip]
constexpr result_type float_next(const T& val); | ||
|
||
template <typename T> | ||
struct has_hidden_guard_digits; |
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.
In the runtime version of this code, these traits classes were introduced as a point of specialization for multiprecision types that have guard digits (cpp_dec_float, gmp_float). I think it's probably irrelevant for this use case were we'll be dealing with builtin types only.
// Special version for some base other than 2: | ||
// | ||
template <typename T> | ||
constexpr T float_next_imp(const T& val, const std::false_type&) |
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.
Do we actually need to support bases other than 2 in the constexpr case? I would be inclined to remove this and static_assert that the radix is 2.
// Special version for bases other than 2: | ||
// | ||
template <typename T> | ||
constexpr T float_prior_imp(const T& val, const std::false_type&) |
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.
as above, possibly delete all this?
Implements constexpr:
nextafter
,nextafterf
,nextafterl
,nexttoward
,nexttowardf
, andnexttowardl
. Once this and #734 are complete all functions pending standardization will be constexpr.