msvc round in core/math/round.hpp
reid-p opened this issue · comments
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
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.
Closing the issue as this is resolved