aboutsummaryrefslogtreecommitdiff
path: root/src/openvic/utility/FloatUtils.hpp
blob: 4fc83fdd035c01fa41c021b63800b72099aae8c4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
#include <cstdint>

namespace OpenVic::FloatUtils {
   constexpr int round_to_int(double num) {
      return (num > 0.0) ? (num + 0.5) : (num - 0.5);
   }

   constexpr int64_t round_to_int64(double num) {
      return (num > 0.0) ? (num + 0.5) : (num - 0.5);
   }
}