Skip to content

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

@reid-p

Description

@reid-p

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions