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

Kokkos_ArthTraits.hpp 'min' inconsistency/bug #479

Open
nate945 opened this issue Oct 6, 2019 · 1 comment
Open

Kokkos_ArthTraits.hpp 'min' inconsistency/bug #479

nate945 opened this issue Oct 6, 2019 · 1 comment

Comments

@nate945
Copy link

nate945 commented Oct 6, 2019

The function ‘Kokkos::Details::ArithTraits::min()’ is documented as returning the same value as numeric_limts::min(), e.g. the smallest positive value of a real (e.g 1.17e-38 for a float). However for standard floats and doubles it appears to actually be equivalent to numeric_limits::lowest() and returns the most negative value of a real (e.g. -3.40e+38 for a float). Looking at the header file there are also some types where Kokkos min actually is compatible with numeric_limits::min() such as float128, dd_real, and qd_real. This difference in definition between the types could cause hard to debug problems in the future.

@nate945
Copy link
Author

nate945 commented Oct 6, 2019

Note there is a lot of code in Sierra and elsewhere that relies on the current 'lowest' return value for min. So if the behavior were to switch to the documented behavior a lot of things would break. For what it is worth I recommend resolving this by either:
a) Deleting the 'min' function and replacing with 'lowest' to force the update of dependent functions
or
b) Updating the header file comments and other documentation to reflect actual behavior of the function and update all the type specializations to behave consistently.

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

No branches or pull requests

1 participant