Skip to content
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

Merged
merged 23 commits into from
Jun 29, 2022
Merged

Constexpr next #789

merged 23 commits into from
Jun 29, 2022

Conversation

mborland
Copy link
Member

Implements constexpr: nextafter, nextafterf, nextafterl, nexttoward, nexttowardf, and nexttowardl. Once this and #734 are complete all functions pending standardization will be constexpr.

@mborland mborland marked this pull request as ready for review June 28, 2022 00:40
@mborland
Copy link
Member Author

@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.

@NAThompson
Copy link
Collaborator

@mborland : Looks good; make sure to squash merge with a nice commit message.

[ci skip]
@mborland mborland merged commit ae0fe3d into boostorg:develop Jun 29, 2022
@mborland mborland deleted the constexpr_next branch June 29, 2022 15:45
constexpr result_type float_next(const T& val);

template <typename T>
struct has_hidden_guard_digits;
Copy link
Collaborator

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&)
Copy link
Collaborator

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&)
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants