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

msvc round in core/math/round.hpp #3569

Closed
reid-p opened this issue Dec 4, 2023 · 2 comments
Closed

msvc round in core/math/round.hpp #3569

reid-p opened this issue Dec 4, 2023 · 2 comments

Comments

@reid-p
Copy link

reid-p commented Dec 4, 2023

mlpack 4.0.1

Somehow calling std::round in my code ends up calling the round implementation in mlpack/core/math/round.hpp
The behaviour of the rounding implemented here is different to std::round.

In particular -0.5 is rounded toward 0, instead of away as per the c++ standard.

MSVC does implement round now.
see: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/round-roundf-roundl?view=msvc-170

I think this could be modified with a guard on the version number?
eg: #if _MSC_VER < 1930

@rcurtin
Copy link
Member

rcurtin commented Dec 4, 2023

Oh wow, that file is something I have not seen in years. I don't think it's needed at all anymore (and as you pointed out its behavior is incorrect anyway!). I opened #3570 to remove the file entirely.

@shrit
Copy link
Member

shrit commented Dec 18, 2023

Closing the issue as this is resolved

@shrit shrit closed this as completed Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants