diff --git a/libs/math/include/psemek/math/math.hpp b/libs/math/include/psemek/math/math.hpp index d6c0c633..40d3d3e8 100644 --- a/libs/math/include/psemek/math/math.hpp +++ b/libs/math/include/psemek/math/math.hpp @@ -174,6 +174,12 @@ namespace psemek::math return (x / y) + ((x % y) == 0 ? 0 : 1); } + template + T fmod(T x, T m) + { + return (x >= 0) ? std::fmod(x, m) : (m - std::fmod(-x, m)); + } + template bool make_min(T & target, T const & source) {